Skip to content

Commit a704fce

Browse files
authored
Merge pull request #250 from LSSTDESC/issue/238/reorganize
Issue/238/reorganize
2 parents 3bb255c + 69b4c8b commit a704fce

File tree

106 files changed

+699
-759
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+699
-759
lines changed

docs/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ def run_apidoc(_):
199199
from sphinx.ext.apidoc import main as apidoc_main
200200
cur_dir = os.path.normpath(os.path.dirname(__file__))
201201
output_path = os.path.join(cur_dir, 'api')
202-
modules = os.path.normpath(os.path.join(cur_dir, "../rail"))
202+
modules = os.path.normpath(os.path.join(cur_dir, "../src/rail"))
203203
paramlist = ['--separate', '--implicit-namespaces', '--no-toc', '-f', '-M', '-o', output_path, modules]
204204
apidoc_main(paramlist)
205205

examples/core/FileIO_DataStore.ipynb

+3-3
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@
5454
"outputs": [],
5555
"source": [
5656
"from rail.core.utils import RAILDIR\n",
57-
"trainFile = os.path.join(RAILDIR, 'tests/data/test_dc2_training_9816.hdf5')\n",
58-
"testFile = os.path.join(RAILDIR, 'tests/data/test_dc2_validation_9816.hdf5')\n",
57+
"trainFile = os.path.join(RAILDIR, 'rail/examples/testdata/test_dc2_training_9816.hdf5')\n",
58+
"testFile = os.path.join(RAILDIR, 'rail/examples/testdata/test_dc2_validation_9816.hdf5')\n",
5959
"\n",
6060
"traindata_io = tables_io.read(trainFile)[\"photometry\"]"
6161
]
@@ -386,7 +386,7 @@
386386
"name": "python",
387387
"nbconvert_exporter": "python",
388388
"pygments_lexer": "ipython3",
389-
"version": "3.9.12"
389+
"version": "3.9.7"
390390
}
391391
},
392392
"nbformat": 4,

examples/core/Pipe_Example.ipynb

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
"outputs": [],
7676
"source": [
7777
"from rail.core.utils import RAILDIR\n",
78-
"flow_file = os.path.join(RAILDIR, 'examples/goldenspike/data/pretrained_flow.pkl')\n",
78+
"flow_file = os.path.join(RAILDIR, 'rail/examples/goldenspike/data/pretrained_flow.pkl')\n",
7979
"bands = ['u','g','r','i','z','y']\n",
8080
"band_dict = {band:f'mag_{band}_lsst' for band in bands}\n",
8181
"rename_dict = {f'mag_{band}_lsst_err':f'mag_err_{band}_lsst' for band in bands}\n",
@@ -317,7 +317,7 @@
317317
"name": "python",
318318
"nbconvert_exporter": "python",
319319
"pygments_lexer": "ipython3",
320-
"version": "3.9.12"
320+
"version": "3.9.7"
321321
}
322322
},
323323
"nbformat": 4,

examples/core/hyperbolic_magnitude_test.ipynb

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"outputs": [],
6868
"source": [
6969
"from rail.core.utils import RAILDIR\n",
70-
"testFile = os.path.join(RAILDIR, 'tests', 'data', 'test_dc2_training_9816.pq')\n",
70+
"testFile = os.path.join(RAILDIR, 'rail', 'examples', 'testdata', 'test_dc2_training_9816.pq')\n",
7171
"test_mags = DS.read_file(\"test_data\", TableHandle, testFile)"
7272
]
7373
},
@@ -228,7 +228,7 @@
228228
"name": "python",
229229
"nbconvert_exporter": "python",
230230
"pygments_lexer": "ipython3",
231-
"version": "3.9.12"
231+
"version": "3.9.7"
232232
}
233233
},
234234
"nbformat": 4,

examples/core/iterator_test.ipynb

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
"outputs": [],
7070
"source": [
7171
"from rail.core.utils import RAILDIR\n",
72-
"pdfs_file = os.path.join(RAILDIR, \"tests/data/test_dc2_training_9816.hdf5\")"
72+
"pdfs_file = os.path.join(RAILDIR, \"rail/examples/testdata/test_dc2_training_9816.hdf5\")"
7373
]
7474
},
7575
{
@@ -209,7 +209,7 @@
209209
"name": "python",
210210
"nbconvert_exporter": "python",
211211
"pygments_lexer": "ipython3",
212-
"version": "3.9.12"
212+
"version": "3.9.7"
213213
}
214214
},
215215
"nbformat": 4,

examples/estimation/NZDir.ipynb

+5-5
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@
7878
"outputs": [],
7979
"source": [
8080
"from rail.core.utils import RAILDIR\n",
81-
"trainFile = os.path.join(RAILDIR, 'tests/data/test_dc2_training_9816.hdf5')\n",
82-
"testFile = os.path.join(RAILDIR, 'tests/data/test_dc2_validation_9816.hdf5')\n",
81+
"trainFile = os.path.join(RAILDIR, 'rail/examples/testdata/test_dc2_training_9816.hdf5')\n",
82+
"testFile = os.path.join(RAILDIR, 'rail/examples/testdata/test_dc2_validation_9816.hdf5')\n",
8383
"training_data = DS.read_file(\"training_data\", TableHandle, trainFile)"
8484
]
8585
},
@@ -464,9 +464,9 @@
464464
],
465465
"metadata": {
466466
"kernelspec": {
467-
"display_name": "Python 3 (ipykernel)",
467+
"display_name": "mvrail",
468468
"language": "python",
469-
"name": "python3"
469+
"name": "mvrail"
470470
},
471471
"language_info": {
472472
"codemirror_mode": {
@@ -478,7 +478,7 @@
478478
"name": "python",
479479
"nbconvert_exporter": "python",
480480
"pygments_lexer": "ipython3",
481-
"version": "3.9.12"
481+
"version": "3.9.13"
482482
}
483483
},
484484
"nbformat": 4,

examples/estimation/RAIL_estimation_demo.ipynb

+5-5
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@
161161
"outputs": [],
162162
"source": [
163163
"from rail.core.utils import RAILDIR\n",
164-
"trainFile = os.path.join(RAILDIR, 'tests/data/test_dc2_training_9816.hdf5')\n",
165-
"testFile = os.path.join(RAILDIR, 'tests/data/test_dc2_validation_9816.hdf5')\n",
164+
"trainFile = os.path.join(RAILDIR, 'rail/examples/testdata/test_dc2_training_9816.hdf5')\n",
165+
"testFile = os.path.join(RAILDIR, 'rail/examples/testdata/test_dc2_validation_9816.hdf5')\n",
166166
"training_data = DS.read_file(\"training_data\", TableHandle, trainFile)\n",
167167
"test_data = DS.read_file(\"test_data\", TableHandle, testFile)"
168168
]
@@ -506,9 +506,9 @@
506506
],
507507
"metadata": {
508508
"kernelspec": {
509-
"display_name": "Python 3 (ipykernel)",
509+
"display_name": "mvrail",
510510
"language": "python",
511-
"name": "python3"
511+
"name": "mvrail"
512512
},
513513
"language_info": {
514514
"codemirror_mode": {
@@ -520,7 +520,7 @@
520520
"name": "python",
521521
"nbconvert_exporter": "python",
522522
"pygments_lexer": "ipython3",
523-
"version": "3.9.12"
523+
"version": "3.9.13"
524524
}
525525
},
526526
"nbformat": 4,

examples/estimation/SimpleSOM_demo.ipynb

+3-3
Original file line numberDiff line numberDiff line change
@@ -683,9 +683,9 @@
683683
],
684684
"metadata": {
685685
"kernelspec": {
686-
"display_name": "Python 3 (ipykernel)",
686+
"display_name": "mvrail",
687687
"language": "python",
688-
"name": "python3"
688+
"name": "mvrail"
689689
},
690690
"language_info": {
691691
"codemirror_mode": {
@@ -697,7 +697,7 @@
697697
"name": "python",
698698
"nbconvert_exporter": "python",
699699
"pygments_lexer": "ipython3",
700-
"version": "3.9.7"
700+
"version": "3.9.13"
701701
}
702702
},
703703
"nbformat": 4,

examples/estimation/test_sampled_summarizers.ipynb

+67-483
Large diffs are not rendered by default.

examples/evaluation/demo.ipynb

+5-5
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,11 @@
8585
"### Photo-z Results\n",
8686
"#### Run FZBoost\n",
8787
"\n",
88-
"Go to dir `<your_path>/RAIL/examples/estimation/` and run the notebook `RAIL_estimation_demo.ipynb`, this will produce a file `output_fzboost.fits`\n",
88+
"Go to dir `<your_path>/RAIL/examples/estimation/` (i.e. \"../estimation\" relative to the directory you are running this notebook) and run the notebook `RAIL_estimation_demo.ipynb`, this will produce a file `output_fzboost.fits`\n",
8989
"\n",
9090
"writen at the location:<br> \n",
9191
"`<your_path>/RAIL/examples/estimation/output_fzboost.fits`. \n",
92-
"This will read in the FZBoost PDF results as a qp Ensemble.\n"
92+
"This will run FZBoost and write out the PDF results as a qp Ensemble that we will then use in this example notebook.\n"
9393
]
9494
},
9595
{
@@ -106,8 +106,8 @@
106106
"outputs": [],
107107
"source": [
108108
"from rail.core.utils import RAILDIR\n",
109-
"pdfs_file = os.path.join(RAILDIR, \"examples/estimation/output_fzboost.hdf5\")\n",
110-
"ztrue_file = os.path.join(RAILDIR, \"tests/data/test_dc2_validation_9816.hdf5\")"
109+
"pdfs_file = \"../estimation/output_fzboost.hdf5\"\n",
110+
"ztrue_file = os.path.join(RAILDIR, 'rail/examples/testdata/test_dc2_validation_9816.hdf5')"
111111
]
112112
},
113113
{
@@ -597,7 +597,7 @@
597597
"name": "python",
598598
"nbconvert_exporter": "python",
599599
"pygments_lexer": "ipython3",
600-
"version": "3.9.12"
600+
"version": "3.9.7"
601601
}
602602
},
603603
"nbformat": 4,

examples/goldenspike/goldenspike.ipynb

+2-2
Original file line numberDiff line numberDiff line change
@@ -765,9 +765,9 @@
765765
],
766766
"metadata": {
767767
"kernelspec": {
768-
"display_name": "testcreation",
768+
"display_name": "mvrail",
769769
"language": "python",
770-
"name": "testcreation"
770+
"name": "mvrail"
771771
},
772772
"language_info": {
773773
"codemirror_mode": {

pyproject.toml

+142
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
[project]
2+
name = "pz-rail"
3+
description = "Redshift Assessment Infrastructure Layers"
4+
readme = "README.rst"
5+
requires-python = ">=3.8"
6+
license = { file = "LICENSE" }
7+
authors = [
8+
{ name = "The LSST DESC PZ WG", email = "[email protected]" }
9+
]
10+
classifiers = [
11+
"Development Status :: 4 - Beta",
12+
"License :: OSI Approved :: MIT License",
13+
"Intended Audience :: Developers",
14+
"Intended Audience :: Science/Research",
15+
"Programming Language :: Python",
16+
"Programming Language :: Python :: 3",
17+
"Programming Language :: Python :: 3.10",
18+
"Natural Language :: English",
19+
"Operating System :: POSIX"
20+
]
21+
dynamic = ["version"]
22+
dependencies = [
23+
"h5py",
24+
"numpy",
25+
"pandas>=1.1",
26+
"tables-io>=0.7.5",
27+
"ceci>=1.10.1",
28+
"pyyaml",
29+
"minisom",
30+
"scipy>=1.9.0",
31+
"pz-hyperbolic-temp",
32+
"qp-prob",
33+
"sklearn",
34+
"pzflow",
35+
]
36+
37+
[project.optional-dependencies]
38+
dev = [
39+
"coverage",
40+
"pylint",
41+
"pytest",
42+
"pytest-cov",
43+
"yamllint",
44+
]
45+
46+
[build-system]
47+
requires = ["setuptools>=61", "wheel", "setuptools_scm[toml]>=6.2"]
48+
build-backend = "setuptools.build_meta"
49+
50+
[tool.setuptools_scm]
51+
write_to = "src/rail/core/_version.py"
52+
53+
[tool.setuptools.package-data]
54+
"rail.examples.estimation.data.AB" = ["*.txt"]
55+
"rail.examples.estimation.data.FILTER" = ["*.res"]
56+
"rail.examples.estimation.data.SED" = ["*.sed", "*.list"]
57+
"rail.examples.estimation" = ["*.pkl"]
58+
"rail.examples.creation.configs" = ["*.yaml"]
59+
"rail.examples.creation.data" = ["*.pkl", "*.hdf5"]
60+
"rail.examples.creation.success_rate_data" = ["*.txt"]
61+
"rail.examples.goldenspike" = ["*.yaml"]
62+
"rail.examples.goldenspike.data" = ["*.pkl", "*.pq"]
63+
"rail.examples.testdata" = ["*.ipynb", "*.fits", "*.hdf5", "*.pq", "*.md"]
64+
65+
[tool.coverage.run]
66+
source = ["src/rail"]
67+
branch = false
68+
69+
[tool.coverage.report]
70+
show_missing = true
71+
exclude_lines = [
72+
"pragma: no cover",
73+
"def __repr__",
74+
"if self.debug:",
75+
"if settings.DEBUG",
76+
"raise AssertionError",
77+
"raise NotImplementedError",
78+
"if 0:",
79+
"if __name__ == .__main__.:",
80+
"if TYPE_CHECKING:"
81+
]
82+
83+
[tool.black]
84+
line-length = 110
85+
target-version = ["py310"]
86+
87+
[tool.pydocstyle]
88+
convention = "numpy"
89+
add_select = [
90+
"D212" # Multi-line docstring summary should start at the first line
91+
]
92+
add-ignore = [
93+
"D105", # Missing docstring in magic method
94+
"D102", # Missing docstring in public method (needed for docstring inheritance)
95+
"D100", # Missing docstring in public module
96+
# Below are required to allow multi-line summaries.
97+
"D200", # One-line docstring should fit on one line with quotes
98+
"D205", # 1 blank line required between summary line and description
99+
"D400", # First line should end with a period
100+
# Properties shouldn't be written in imperative mode. This will be fixed
101+
# post 6.1.1, see https://github.com/PyCQA/pydocstyle/pull/546
102+
"D401",
103+
]
104+
105+
[tool.pylint]
106+
disable = [
107+
"abstract-method",
108+
"invalid-name",
109+
"too-many-statements",
110+
"missing-module-docstring",
111+
"missing-class-docstring",
112+
"missing-function-docstring",
113+
"too-few-public-methods",
114+
"duplicate-code"
115+
]
116+
max-line-length = 110
117+
max-locals = 50
118+
max-branches = 25
119+
max-public-methods = 50
120+
121+
[tool.isort]
122+
profile = "black"
123+
line_length = 110
124+
125+
[tool.pytest.ini_options]
126+
addopts = [
127+
"--cov=rail",
128+
"--cov-report=html"
129+
]
130+
flake8-ignore = "E203"
131+
132+
[tool.mypy]
133+
disallow_untyped_defs = true
134+
disallow_incomplete_defs = true
135+
ignore_missing_imports = true
136+
namespace_packages = true
137+
plugins = "sqlalchemy.ext.mypy.plugin"
138+
show_error_codes = true
139+
strict_equality = true
140+
warn_redundant_casts = true
141+
warn_unreachable = true
142+
warn_unused_ignores = true

0 commit comments

Comments
 (0)