Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
8431465
changed np.in1d to np.isin and np.trapz to np.trapezoid to handle dep…
jscora Feb 18, 2026
47ae36f
removed creator test using pzflow
jscora Feb 18, 2026
f57b331
added line to run create_interactive_structure to smoke tests
jscora Feb 18, 2026
5c64b5b
also added a run of create_interactive_structure to the testing and c…
jscora Feb 18, 2026
f8b205c
add slack reporting step to smoke tests action
jscora Feb 18, 2026
3d44c1a
testing adding an algos section to pyproject.toml and installing for …
jscora Feb 19, 2026
2042a77
fixed bracket error
jscora Feb 19, 2026
985371d
testing workflow
jscora Feb 19, 2026
15a24e8
debugging tests workflow
jscora Feb 19, 2026
be0b083
Update location stub files are created in
taiwithers Feb 19, 2026
a619ef9
Merge branch 'sidrat-staging' of github.com:sidratresearch/rail_base …
jscora Feb 19, 2026
aa33ee7
testing smoke test errors
jscora Feb 19, 2026
7e41a99
testing out non-dynamic version
jscora Feb 19, 2026
30264bc
debugging testing and coverage
jscora Feb 19, 2026
7e024a8
debugging testing and coverage
jscora Feb 19, 2026
afc28c8
debugging testing and coverage removed version
jscora Feb 19, 2026
9d2a290
removing dsps for now
jscora Feb 19, 2026
ed088b9
added more algos
jscora Feb 19, 2026
87b7f16
added git diff
jscora Feb 19, 2026
4bf787b
removed bpz and make git diff always run
jscora Feb 19, 2026
4ed07a8
change how filenames are dealt with in rail interative docstrings
jscora Feb 19, 2026
426d6a3
Change how paths are written to interactive docstrings
taiwithers Feb 20, 2026
21d0cfb
Merge branch 'sidrat-staging' of github.com:sidratresearch/rail_base …
jscora Feb 20, 2026
7366ab1
testing fixes for dsps and yaw interactive
jscora Feb 25, 2026
54fc2c8
fix mpi build
jscora Feb 25, 2026
19e9a49
made new workflow for running create_rail_interactive_structure.py
jscora Feb 25, 2026
0a30fe0
fixing create_interactive_structure tests by removing delight .pyi files
jscora Feb 26, 2026
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
94 changes: 94 additions & 0 deletions .github/workflows/run-create-interactive-structure.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# This workflow will install Python dependencies, the supported rail packages, and run the create_interactive_structure.py script
# If it fails with exit code = 2, that means that there have been updates to any of the stages
# this usually means that you just need to create a new branch, run create_interactive_structure.py and do a PR with rail_base to update the .pyi
# stub files
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Running create_interactive_structure script

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v3
with:
fetch-tags: true
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: System deps (MPI + build)
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
build-essential libbz2-dev \
openmpi-bin libopenmpi-dev
- name: Install dependencies
run: |
# sudo apt-get update
# python -m pip install --upgrade pip
python -m pip install --upgrade pip setuptools wheel
python -m pip install "numpy<2" cython
python -m pip install --upgrade --no-binary=mpi4py mpi4py
python -m pip install --no-build-isolation somoclu
python -m pip install --upgrade pip
pip install wheel numpy
pip install .
pip install .[dev]
pip install .[algos]
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi

# runs the create interactive structure test to see if the interactive structure needs to be changed
# returns a 1 if something went wrong with the script, or a 2 if the files need to be changed
- name: Run create_interactive_structure.py
run: |
python create_interactive_structure.py
- name: Send status to Slack app (RAIL CI Reporter)
if: ${{ failure() && github.event_name != 'workflow_dispatch' }}
id: slack
uses: slackapi/slack-github-action@v1.24.0
with:
# For posting a rich message using Block Kit
payload: |
{
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "${{ github.repository }} create_interactive_structure workflow"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "GitHub Action build result: *${{ job.status }}* :${{ job.status }}:"
}
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
39 changes: 39 additions & 0 deletions .github/workflows/smoke-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,42 @@ jobs:
- name: Run unit tests with pytest
run: |
python -m pytest tests

- name: Send status to Slack app (RAIL CI Reporter)
if: ${{ failure() && github.event_name != 'workflow_dispatch' }}
id: slack
uses: slackapi/slack-github-action@v1.24.0
with:
# For posting a rich message using Block Kit
payload: |
{
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "${{ github.repository }}"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "GitHub Action build result: *${{ job.status }}* :${{ job.status }}:"
}
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
8 changes: 7 additions & 1 deletion .github/workflows/testing-and-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
name: Unit test and code coverage

on:
schedule:
- cron: 45 7 * * 1
push:
branches: [ main ]
pull_request:
Expand All @@ -12,12 +14,15 @@ on:
jobs:
build:

runs-on: ubuntu-latest
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v3
with:
fetch-tags: true
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
Expand All @@ -26,6 +31,7 @@ jobs:
run: |
sudo apt-get update
python -m pip install --upgrade pip
pip install wheel numpy
pip install .
pip install .[dev]
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
Expand Down
11 changes: 8 additions & 3 deletions create_interactive_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,14 @@ def write_modules() -> None:

def write_stubs() -> None:
for module in interactive_modules:
module = "rail.interactive." + module
importlib.import_module(module)
_initialize_interactive_module(module, write_stubs=True)
stub_directory = InteractiveModule(
subfolder=module.replace(".", "/")
).path.parent
full_module = "rail.interactive." + module
importlib.import_module(full_module)
_initialize_interactive_module(
full_module, write_stubs=True, stub_directory=stub_directory
)


def store_pyi(delete: bool) -> dict[Path, str | None]:
Expand Down
39 changes: 29 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,25 @@ dev = [
"isort", # as above
]

algos = [
"pz-rail-astro-tools",
"pz-rail-bpz",
"pz-rail-cmnn",
"pz-rail-dnf",
"pz-rail-dsps",
"pz-rail-flexzboost",
"pz-rail-fsps",
"pz-rail-gpz-v1",
"pz-rail-pzflow",
"pz-rail-sklearn",
"pz-rail-som",
"pz-rail-yaw",
"pz-rail-lephare",
"pz-rail-tpz",
"pz-rail-delight",
"pz-rail-pipelines",
]

[project.scripts]
rail = "rail.cli.rail.commands:cli"

Expand All @@ -56,7 +75,7 @@ write_to = "src/rail/core/_version.py"

[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = ["--cov=rail", "--cov-report=html"]
addopts = ["--cov=rail", "--cov-report=html"]

[tool.pylint]
disable = [
Expand All @@ -82,16 +101,16 @@ max-branches = 25
max-public-methods = 50

[tool.mypy]
disallow_untyped_defs = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
ignore_missing_imports = true
local_partial_types = true
no_implicit_reexport = true
show_error_codes = true
strict_equality = true
warn_redundant_casts = true
warn_unreachable = true
warn_unused_ignores = true
ignore_missing_imports = true
local_partial_types = true
no_implicit_reexport = true
show_error_codes = true
strict_equality = true
warn_redundant_casts = true
warn_unreachable = true
warn_unused_ignores = true


[tool.coverage.run]
Expand Down
2 changes: 1 addition & 1 deletion src/rail/evaluation/metrics/cdeloss.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def evaluate(self) -> stat_and_pval:
"""

# Calculate first term E[\int f*(z | X)^2 dz]
term1 = np.mean(np.trapz(self._pdfs**2, x=self._xvals))
term1 = np.mean(np.trapezoid(self._pdfs**2, x=self._xvals))
# z bin closest to ztrue
nns = [np.argmin(np.abs(self._xvals - z)) for z in self._ztrue]
# Calculate second term E[f*(Z | X)]
Expand Down
2 changes: 1 addition & 1 deletion src/rail/evaluation/metrics/tomography.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def run(self) -> None:
p_j = kde_j(eval_grid)

# Compute overlap as the integral of the minimum of both distributions
overlap = np.trapz(np.minimum(p_i, p_j), eval_grid)
overlap = np.trapezoid(np.minimum(p_i, p_j), eval_grid)
overlap_matrix[i, j] = overlap
overlap_matrix[j, i] = overlap # Symmetric matrix

Expand Down
6 changes: 2 additions & 4 deletions src/rail/interactive/creation/degraders/grid_selection.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,10 @@ def grid_selection(**kwargs) -> Any:
Default: 100.0
ratio_file : str, optional
path to ratio file
Default: rail_astro_tools/src/rail/examples_data/creation_data/data/hsc_ratios_a
nd_specz.hdf5
Default: rail/examples_data/creation_data/data/hsc_ratios_and_specz.hdf5
settings_file : str, optional
path to pickled parameters file
Default:
rail_astro_tools/src/rail/examples_data/creation_data/data/HSC_grid_settings.pkl
Default: rail/examples_data/creation_data/data/HSC_grid_settings.pkl
random_seed : int, optional
random seed for reproducibility
Default: 12345
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ def obs_condition(**kwargs) -> Any:
Default: 128
mask : str, optional
mask for the input maps in HEALPIX format.
Default: rail_astro_tools/src/rail/examples_data/creation_data/data/survey_condi
tions/DC2-mask-neg-nside-128.fits
Default: rail/examples_data/creation_data/data/survey_conditions/DC2-mask-neg-
nside-128.fits
weight : str, optional
weight for assigning pixels to galaxies in HEALPIX format.
Default: rail_astro_tools/src/rail/examples_data/creation_data/data/survey_condi
tions/DC2-dr6-galcounts-i20-i25.3-nside-128.fits
Default: rail/examples_data/creation_data/data/survey_conditions/DC2-dr6-
galcounts-i20-i25.3-nside-128.fits
tot_nVis_flag : bool, optional
flag indicating whether nVisYr is the total or average per year if supplied.
Default: True
Expand Down
Loading
Loading