Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

final pre-JOSS merge including docs #240

Merged
merged 37 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
2509804
first rtd commit
samueldmcdermott Sep 23, 2024
26d9bc1
updated `conf.py` for DeepSZSim details
samueldmcdermott Sep 23, 2024
6ecb974
added index.rst for rtd build
samueldmcdermott Sep 23, 2024
a24c66d
added api.rst and updated index.rst for rtd build
samueldmcdermott Sep 23, 2024
54c4222
updated api.rst
samueldmcdermott Sep 23, 2024
7855bba
updated conf.py and index.rst
samueldmcdermott Sep 23, 2024
5f7324d
added Makefile
samueldmcdermott Sep 23, 2024
60239f4
added some docs files
samueldmcdermott Sep 23, 2024
1ec0fbf
updated `index.rst`
samueldmcdermott Sep 23, 2024
ab5384c
updated `index.rst`
samueldmcdermott Sep 23, 2024
6e49b30
updated `index.rst`
samueldmcdermott Sep 23, 2024
201e87f
updated `index.rst`
samueldmcdermott Sep 23, 2024
2719a60
updated `index.rst`
samueldmcdermott Sep 23, 2024
44d007a
added deepszsim.rst
samueldmcdermott Sep 24, 2024
72c05c3
removed autoapi.extension
samueldmcdermott Sep 24, 2024
06e4401
added build folder
samueldmcdermott Sep 24, 2024
eea3563
changed index.rst
samueldmcdermott Sep 24, 2024
d48b316
changed autoapi_dirs in conf.py
samueldmcdermott Sep 24, 2024
1342a4f
changed autoapi_dirs in conf.py
samueldmcdermott Sep 24, 2024
2c23988
changed autoapi_dirs in conf.py
samueldmcdermott Sep 24, 2024
2c5716c
removed `docs/source/_build`
samueldmcdermott Sep 24, 2024
e306285
updated requirements.txt
samueldmcdermott Sep 24, 2024
5375f28
updated requirements.txt
samueldmcdermott Sep 24, 2024
47e243f
updated index.rst
samueldmcdermott Sep 24, 2024
71bd3c0
updated index.rst
samueldmcdermott Sep 24, 2024
147083f
updated index.rst
samueldmcdermott Sep 24, 2024
d6392a6
moved documentation in the class of `simclusters.py` to be visible to…
samueldmcdermott Sep 27, 2024
8dad985
updated requirements.txt and reverted location of docstring for simcl…
samueldmcdermott Sep 27, 2024
f3b1c80
changed max depth to 3
samueldmcdermott Sep 27, 2024
fd3db22
added `:special-members:` to `simclusters`
samueldmcdermott Sep 27, 2024
a4d11ad
removed `:special-members:` from `simclusters` and changed class docu…
samueldmcdermott Sep 27, 2024
0a3aacf
edited `simclusters` documentation
samueldmcdermott Sep 27, 2024
9551999
added some instructions to deepszsim.rst
samueldmcdermott Sep 27, 2024
d69a99a
removed an unused subdirectory
samueldmcdermott Sep 27, 2024
aa80949
Merge pull request #238 from deepskies/dev-rtd
bnord Oct 15, 2024
7197394
updated pyproject.toml for numpy/pixell compatibility and for yaml ac…
samueldmcdermott Oct 15, 2024
9c7c55c
updated pyproject.toml for yaml accessibility to built package
samueldmcdermott Oct 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions deepszsim/io_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def update_val(self, attr, new_val):
print("not a valid attribute")


def write_params_yaml_new()
def write_params_yaml_new():
"""
write updated yaml file to disk
incorporate run id
Expand All @@ -92,7 +92,7 @@ def write_params_yaml_new()
yaml_file.write( dump )


def _generate_run_id(random_digits=6):
def _generate_run_id(random_digits=6):
'''
'''

Expand Down
72 changes: 37 additions & 35 deletions deepszsim/simclusters.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,48 +9,50 @@
from datetime import datetime as dt

class simulate_clusters:
"""
class for simulating a distribution of clusters

Parameters
----------
M200: float or array-like of float
the mass contained within R200 in solar masses (same length as z_dist)
redshift_z: float or array-like of float
the redshift of the cluster (unitless) (same length as M200_dist)
num_halos: None or int
number of halos to simulate if none supplied
halo_params_dict: None or dict
parameters from which to sample halos if `num_halos` specified,
must contain `zmin`, `zmax`, `m200min_SM`, `m200max_SM`
R200_Mpc: None or float or np.ndarray(float)
if None, will calculate the R200 values corresponding to a given set of
M200 and redshift_z values for the specified cosmology
profile: str
Name of profile, currently only supports "Battaglia2012"
image_size_pixels: None or int
image size in pixels (should be odd; if even, will return images whose
sides are `image_size_pixels+1` in length)
image_size_arcmin: None or float
image size in arcmin
pixel_size_arcmin: None or float
pixel size in arcmin
alpha: float
fixed to equal 1.0 in Battaglia 2012
gamma: float
fixed to equal -0.3 in Battaglia 2012
load_vars_yaml: None or str
path to yaml file with params; if `None`, must explicitly include image specifications
seed: None or int
random seed value to sample with
tqverb: bool
whether or not to display tqdm progress bar while making T maps
"""
def __init__(self, M200 = None, redshift_z = None, num_halos = None, halo_params_dict = None,
R200_Mpc = None, profile = "Battaglia2012",
image_size_pixels = None, image_size_arcmin = None, pixel_size_arcmin = None,
alpha = 1.0, gamma = -0.3,
load_vars_yaml = os.path.join(os.path.dirname(__file__), 'Settings', 'config_simACTDR5.yaml'),
seed = None, tqverb = False
):
"""
Parameters
----------
M200: float or array-like of float
the mass contained within R200 in solar masses (same length as z_dist)
redshift_z: float or array-like of float
the redshift of the cluster (unitless) (same length as M200_dist)
num_halos: None or int
number of halos to simulate if none supplied
halo_params_dict: None or dict
parameters from which to sample halos if `num_halos` specified,
must contain `zmin`, `zmax`, `m200min_SM`, `m200max_SM`
R200_Mpc: None or float or np.ndarray(float)
if None, will calculate the R200 values corresponding to a given set of
M200 and redshift_z values for the specified cosmology
profile: str
Name of profile, currently only supports "Battaglia2012"
image_size_pixels: None or int
image size in pixels (should be odd; if even, will return images whose
sides are `image_size_pixels+1` in length)
image_size_arcmin: None or float
image size in arcmin
pixel_size_arcmin: None or float
pixel size in arcmin
alpha: float
fixed to equal 1.0 in Battaglia 2012
gamma: float
fixed to equal -0.3 in Battaglia 2012
load_vars_yaml: None or str
path to yaml file with params; if `None`, must explicitly include image specifications
seed: None or int
random seed value to sample with
tqverb: bool
whether or not to display tqdm progress bar while making T maps
"""

if (M200 is not None) and (redshift_z is not None):
self.M200, self.redshift_z = M200, redshift_z
Expand Down
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

if "%1" == "" goto help

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
11 changes: 11 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
sphinx==7.1.2
sphinx-rtd-theme==1.3.0rc1
numpy
camb
h5py
astropy
colossus
tqdm
pixell
pandas
scipy
8 changes: 8 additions & 0 deletions docs/source/api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
API
===

.. autosummary::
:toctree::
:maxdepth: 2

deepszsim
39 changes: 39 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Configuration file for the Sphinx documentation builder.
import os
import sys
sys.path.insert(0, os.path.abspath('../../'))

# -- Project information

project = 'DeepSZSim'
copyright = '2024, DeepSkies'
author = 'DeepSkies'

release = '0.1'
version = '0.1.0'

# -- General configuration

extensions = [
'sphinx.ext.duration',
'sphinx.ext.doctest',
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.intersphinx',
# 'autoapi.extension',
]

intersphinx_mapping = {
'python': ('https://docs.python.org/3/', None),
'sphinx': ('https://www.sphinx-doc.org/en/master/', None),
}
intersphinx_disabled_domains = ['std']

templates_path = ['_templates']

# -- Options for HTML output

html_theme = 'sphinx_rtd_theme'

# -- Options for EPUB output
epub_show_urls = 'footnote'
106 changes: 106 additions & 0 deletions docs/source/deepszsim.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
deepszsim package
=================

Documentation for `DeepSZSim <https://www.github.com/DeepSkies/DeepSZSim/>`_.

To create a simulation of two SZ clusters as quickly as possible, run
``tc = deepszsim.simulate_clusters(num_halos=2).get_T_maps()``, which will return a dictionary with two entries, accessed by ``tc.clusters``. Each of these entries includes a ``params`` subdirectory and a ``maps`` subdirectory.

Submodules
----------

deepszsim.dm\_halo\_dist module
-------------------------------

.. automodule:: deepszsim.dm_halo_dist
:members:
:undoc-members:
:show-inheritance:

deepszsim.filters module
------------------------

.. automodule:: deepszsim.filters
:members:
:undoc-members:
:show-inheritance:

deepszsim.io\_params module
---------------------------

.. automodule:: deepszsim.io_params
:members:
:undoc-members:
:show-inheritance:

deepszsim.load\_vars module
---------------------------

.. automodule:: deepszsim.load_vars
:members:
:undoc-members:
:show-inheritance:

deepszsim.make\_sz\_cluster module
----------------------------------

.. automodule:: deepszsim.make_sz_cluster
:members:
:undoc-members:
:show-inheritance:

deepszsim.noise module
----------------------

.. automodule:: deepszsim.noise
:members:
:undoc-members:
:show-inheritance:

deepszsim.read\_yaml module
---------------------------

.. automodule:: deepszsim.read_yaml
:members:
:undoc-members:
:show-inheritance:

deepszsim.simclusters module
----------------------------

.. automodule:: deepszsim.simclusters
:members:
:undoc-members:
:show-inheritance:

deepszsim.simtools module
-------------------------

.. automodule:: deepszsim.simtools
:members:
:undoc-members:
:show-inheritance:

deepszsim.utils module
----------------------

.. automodule:: deepszsim.utils
:members:
:undoc-members:
:show-inheritance:

deepszsim.visualization module
------------------------------

.. automodule:: deepszsim.visualization
:members:
:undoc-members:
:show-inheritance:

Module contents
---------------

.. automodule:: deepszsim
:members:
:undoc-members:
:show-inheritance:
12 changes: 12 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Welcome to DeepSZSim's documentation!
=====================================

**DeepSZSim** offers fast simulation of clusters observed via the Sunyaev-Zel'dovich effect in the CMB.

Check out the `github <https://www.github.com/DeepSkies/DeepSZSim/>`_ for installation and usage examples.

.. toctree::
:maxdepth: 3
:caption: Contents:

deepszsim
7 changes: 7 additions & 0 deletions docs/source/modules.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
deepszsim
=========

.. toctree::
:maxdepth: 3

deepszsim
12 changes: 8 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ build-backend = "setuptools.build_meta"

[project]
name = "deepszsim"
version = "0.1.0"
version = "0.1.1"
description = "code for fast simulations of galaxy clusters"
authors = [{name = "Eve Vavagiakis", email = "[email protected]"}]
license = {text="LICENSE.txt"}
requires-python = ">= 3.9, <3.12"
dependencies = [
"camb >= 1.4.0",
"h5py >= 3.8.0",
"numpy >= 1.24.3",
"numpy >= 1.24.3, <2",
"astropy >= 6.0",
"colossus >= 1.3.0",
"tqdm >= 4.66.0",
Expand All @@ -23,5 +23,9 @@ dependencies = [
pytest = "^7.3.1"
pytest-cov = "^4.0.0"

[tool.setuptools.packages.find]
namespaces = false
[tool.setuptools]
packages = ["deepszsim"]
include-package-data = true

[tool.setuptools.package-data]
"deepszsim" = ["Settings/*.yaml"]
13 changes: 13 additions & 0 deletions readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: "2"

build:
os: "ubuntu-22.04"
tools:
python: "3.11"

python:
install:
- requirements: docs/requirements.txt

sphinx:
configuration: docs/source/conf.py
Loading