Skip to content

Commit

Permalink
Merge pull request #250 from LSSTDESC/issue/238/reorganize
Browse files Browse the repository at this point in the history
Issue/238/reorganize
  • Loading branch information
sschmidt23 authored Sep 12, 2022
2 parents 3bb255c + 69b4c8b commit a704fce
Show file tree
Hide file tree
Showing 106 changed files with 699 additions and 759 deletions.
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def run_apidoc(_):
from sphinx.ext.apidoc import main as apidoc_main
cur_dir = os.path.normpath(os.path.dirname(__file__))
output_path = os.path.join(cur_dir, 'api')
modules = os.path.normpath(os.path.join(cur_dir, "../rail"))
modules = os.path.normpath(os.path.join(cur_dir, "../src/rail"))
paramlist = ['--separate', '--implicit-namespaces', '--no-toc', '-f', '-M', '-o', output_path, modules]
apidoc_main(paramlist)

Expand Down
6 changes: 3 additions & 3 deletions examples/core/FileIO_DataStore.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
"outputs": [],
"source": [
"from rail.core.utils import RAILDIR\n",
"trainFile = os.path.join(RAILDIR, 'tests/data/test_dc2_training_9816.hdf5')\n",
"testFile = os.path.join(RAILDIR, 'tests/data/test_dc2_validation_9816.hdf5')\n",
"trainFile = os.path.join(RAILDIR, 'rail/examples/testdata/test_dc2_training_9816.hdf5')\n",
"testFile = os.path.join(RAILDIR, 'rail/examples/testdata/test_dc2_validation_9816.hdf5')\n",
"\n",
"traindata_io = tables_io.read(trainFile)[\"photometry\"]"
]
Expand Down Expand Up @@ -386,7 +386,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.12"
"version": "3.9.7"
}
},
"nbformat": 4,
Expand Down
4 changes: 2 additions & 2 deletions examples/core/Pipe_Example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"outputs": [],
"source": [
"from rail.core.utils import RAILDIR\n",
"flow_file = os.path.join(RAILDIR, 'examples/goldenspike/data/pretrained_flow.pkl')\n",
"flow_file = os.path.join(RAILDIR, 'rail/examples/goldenspike/data/pretrained_flow.pkl')\n",
"bands = ['u','g','r','i','z','y']\n",
"band_dict = {band:f'mag_{band}_lsst' for band in bands}\n",
"rename_dict = {f'mag_{band}_lsst_err':f'mag_err_{band}_lsst' for band in bands}\n",
Expand Down Expand Up @@ -317,7 +317,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.12"
"version": "3.9.7"
}
},
"nbformat": 4,
Expand Down
4 changes: 2 additions & 2 deletions examples/core/hyperbolic_magnitude_test.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"outputs": [],
"source": [
"from rail.core.utils import RAILDIR\n",
"testFile = os.path.join(RAILDIR, 'tests', 'data', 'test_dc2_training_9816.pq')\n",
"testFile = os.path.join(RAILDIR, 'rail', 'examples', 'testdata', 'test_dc2_training_9816.pq')\n",
"test_mags = DS.read_file(\"test_data\", TableHandle, testFile)"
]
},
Expand Down Expand Up @@ -228,7 +228,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.12"
"version": "3.9.7"
}
},
"nbformat": 4,
Expand Down
4 changes: 2 additions & 2 deletions examples/core/iterator_test.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"outputs": [],
"source": [
"from rail.core.utils import RAILDIR\n",
"pdfs_file = os.path.join(RAILDIR, \"tests/data/test_dc2_training_9816.hdf5\")"
"pdfs_file = os.path.join(RAILDIR, \"rail/examples/testdata/test_dc2_training_9816.hdf5\")"
]
},
{
Expand Down Expand Up @@ -209,7 +209,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.12"
"version": "3.9.7"
}
},
"nbformat": 4,
Expand Down
10 changes: 5 additions & 5 deletions examples/estimation/NZDir.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@
"outputs": [],
"source": [
"from rail.core.utils import RAILDIR\n",
"trainFile = os.path.join(RAILDIR, 'tests/data/test_dc2_training_9816.hdf5')\n",
"testFile = os.path.join(RAILDIR, 'tests/data/test_dc2_validation_9816.hdf5')\n",
"trainFile = os.path.join(RAILDIR, 'rail/examples/testdata/test_dc2_training_9816.hdf5')\n",
"testFile = os.path.join(RAILDIR, 'rail/examples/testdata/test_dc2_validation_9816.hdf5')\n",
"training_data = DS.read_file(\"training_data\", TableHandle, trainFile)"
]
},
Expand Down Expand Up @@ -464,9 +464,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "mvrail",
"language": "python",
"name": "python3"
"name": "mvrail"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -478,7 +478,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.12"
"version": "3.9.13"
}
},
"nbformat": 4,
Expand Down
10 changes: 5 additions & 5 deletions examples/estimation/RAIL_estimation_demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@
"outputs": [],
"source": [
"from rail.core.utils import RAILDIR\n",
"trainFile = os.path.join(RAILDIR, 'tests/data/test_dc2_training_9816.hdf5')\n",
"testFile = os.path.join(RAILDIR, 'tests/data/test_dc2_validation_9816.hdf5')\n",
"trainFile = os.path.join(RAILDIR, 'rail/examples/testdata/test_dc2_training_9816.hdf5')\n",
"testFile = os.path.join(RAILDIR, 'rail/examples/testdata/test_dc2_validation_9816.hdf5')\n",
"training_data = DS.read_file(\"training_data\", TableHandle, trainFile)\n",
"test_data = DS.read_file(\"test_data\", TableHandle, testFile)"
]
Expand Down Expand Up @@ -506,9 +506,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "mvrail",
"language": "python",
"name": "python3"
"name": "mvrail"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -520,7 +520,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.12"
"version": "3.9.13"
}
},
"nbformat": 4,
Expand Down
6 changes: 3 additions & 3 deletions examples/estimation/SimpleSOM_demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -683,9 +683,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "mvrail",
"language": "python",
"name": "python3"
"name": "mvrail"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -697,7 +697,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.7"
"version": "3.9.13"
}
},
"nbformat": 4,
Expand Down
550 changes: 67 additions & 483 deletions examples/estimation/test_sampled_summarizers.ipynb

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions examples/evaluation/demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@
"### Photo-z Results\n",
"#### Run FZBoost\n",
"\n",
"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",
"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",
"\n",
"writen at the location:<br> \n",
"`<your_path>/RAIL/examples/estimation/output_fzboost.fits`. \n",
"This will read in the FZBoost PDF results as a qp Ensemble.\n"
"This will run FZBoost and write out the PDF results as a qp Ensemble that we will then use in this example notebook.\n"
]
},
{
Expand All @@ -106,8 +106,8 @@
"outputs": [],
"source": [
"from rail.core.utils import RAILDIR\n",
"pdfs_file = os.path.join(RAILDIR, \"examples/estimation/output_fzboost.hdf5\")\n",
"ztrue_file = os.path.join(RAILDIR, \"tests/data/test_dc2_validation_9816.hdf5\")"
"pdfs_file = \"../estimation/output_fzboost.hdf5\"\n",
"ztrue_file = os.path.join(RAILDIR, 'rail/examples/testdata/test_dc2_validation_9816.hdf5')"
]
},
{
Expand Down Expand Up @@ -597,7 +597,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.12"
"version": "3.9.7"
}
},
"nbformat": 4,
Expand Down
4 changes: 2 additions & 2 deletions examples/goldenspike/goldenspike.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -765,9 +765,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "testcreation",
"display_name": "mvrail",
"language": "python",
"name": "testcreation"
"name": "mvrail"
},
"language_info": {
"codemirror_mode": {
Expand Down
142 changes: 142 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
[project]
name = "pz-rail"
description = "Redshift Assessment Infrastructure Layers"
readme = "README.rst"
requires-python = ">=3.8"
license = { file = "LICENSE" }
authors = [
{ name = "The LSST DESC PZ WG", email = "aimalz@nyu.edu" }
]
classifiers = [
"Development Status :: 4 - Beta",
"License :: OSI Approved :: MIT License",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Natural Language :: English",
"Operating System :: POSIX"
]
dynamic = ["version"]
dependencies = [
"h5py",
"numpy",
"pandas>=1.1",
"tables-io>=0.7.5",
"ceci>=1.10.1",
"pyyaml",
"minisom",
"scipy>=1.9.0",
"pz-hyperbolic-temp",
"qp-prob",
"sklearn",
"pzflow",
]

[project.optional-dependencies]
dev = [
"coverage",
"pylint",
"pytest",
"pytest-cov",
"yamllint",
]

[build-system]
requires = ["setuptools>=61", "wheel", "setuptools_scm[toml]>=6.2"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
write_to = "src/rail/core/_version.py"

[tool.setuptools.package-data]
"rail.examples.estimation.data.AB" = ["*.txt"]
"rail.examples.estimation.data.FILTER" = ["*.res"]
"rail.examples.estimation.data.SED" = ["*.sed", "*.list"]
"rail.examples.estimation" = ["*.pkl"]
"rail.examples.creation.configs" = ["*.yaml"]
"rail.examples.creation.data" = ["*.pkl", "*.hdf5"]
"rail.examples.creation.success_rate_data" = ["*.txt"]
"rail.examples.goldenspike" = ["*.yaml"]
"rail.examples.goldenspike.data" = ["*.pkl", "*.pq"]
"rail.examples.testdata" = ["*.ipynb", "*.fits", "*.hdf5", "*.pq", "*.md"]

[tool.coverage.run]
source = ["src/rail"]
branch = false

[tool.coverage.report]
show_missing = true
exclude_lines = [
"pragma: no cover",
"def __repr__",
"if self.debug:",
"if settings.DEBUG",
"raise AssertionError",
"raise NotImplementedError",
"if 0:",
"if __name__ == .__main__.:",
"if TYPE_CHECKING:"
]

[tool.black]
line-length = 110
target-version = ["py310"]

[tool.pydocstyle]
convention = "numpy"
add_select = [
"D212" # Multi-line docstring summary should start at the first line
]
add-ignore = [
"D105", # Missing docstring in magic method
"D102", # Missing docstring in public method (needed for docstring inheritance)
"D100", # Missing docstring in public module
# Below are required to allow multi-line summaries.
"D200", # One-line docstring should fit on one line with quotes
"D205", # 1 blank line required between summary line and description
"D400", # First line should end with a period
# Properties shouldn't be written in imperative mode. This will be fixed
# post 6.1.1, see https://github.com/PyCQA/pydocstyle/pull/546
"D401",
]

[tool.pylint]
disable = [
"abstract-method",
"invalid-name",
"too-many-statements",
"missing-module-docstring",
"missing-class-docstring",
"missing-function-docstring",
"too-few-public-methods",
"duplicate-code"
]
max-line-length = 110
max-locals = 50
max-branches = 25
max-public-methods = 50

[tool.isort]
profile = "black"
line_length = 110

[tool.pytest.ini_options]
addopts = [
"--cov=rail",
"--cov-report=html"
]
flake8-ignore = "E203"

[tool.mypy]
disallow_untyped_defs = true
disallow_incomplete_defs = true
ignore_missing_imports = true
namespace_packages = true
plugins = "sqlalchemy.ext.mypy.plugin"
show_error_codes = true
strict_equality = true
warn_redundant_casts = true
warn_unreachable = true
warn_unused_ignores = true
Loading

0 comments on commit a704fce

Please sign in to comment.