Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
ec96482
clean up column names
eacharles Mar 24, 2026
f51ee64
simplify roman names
eacharles Mar 24, 2026
16c5158
remove spurious column
eacharles Mar 24, 2026
a5ea702
cleaning up columns
eacharles Mar 24, 2026
f8dc8d9
remove spurious column
eacharles Mar 24, 2026
2d62bdc
added path_overrides to flavor
eacharles Mar 24, 2026
d30dbd1
fix flavor path interpolants
eacharles Mar 24, 2026
06afbe6
added sim-version to reduce options
eacharles Mar 24, 2026
777a4c1
fix sim-verison option
eacharles Mar 24, 2026
cdc8761
fix up truth_to_observed_convert_commands to include models_to_run_se…
eacharles Mar 24, 2026
36f0757
added object_id to reducers
eacharles Mar 24, 2026
a773105
handle models_to_run_select in _parse_pipeline_kwargs
eacharles Mar 24, 2026
8a8c09f
added convert-ouput/no-convert-output
eacharles Mar 24, 2026
e8e961d
fix typos
eacharles Mar 24, 2026
7cf5acb
ran black
eacharles Mar 24, 2026
e1e441a
bug fix
eacharles Mar 24, 2026
7b761ca
remove duplicates from drop_columns for flagship
eacharles Mar 24, 2026
930fa7b
Added merge stuff
eacharles Mar 24, 2026
fbb9393
added merger
eacharles Mar 24, 2026
f18615b
updates
eacharles Mar 25, 2026
b229cc1
fix
eacharles Mar 25, 2026
6b1403a
fix
eacharles Mar 25, 2026
d4429ef
updates for merger
eacharles Mar 25, 2026
643e80a
updates for merger
eacharles Mar 25, 2026
261c518
updates
eacharles Mar 25, 2026
13aa7c0
tweak merge cli
eacharles Mar 25, 2026
04561a0
fix type
eacharles Mar 25, 2026
e6bd188
fix docstring
eacharles Mar 25, 2026
f631ae8
fix type
eacharles Mar 25, 2026
7fe94ee
added name to RailMerge
eacharles Mar 25, 2026
f211e8f
fix Class type
eacharles Mar 25, 2026
3962b29
fix base class
eacharles Mar 25, 2026
2fdf369
SpecSelectionMerger
eacharles Mar 25, 2026
05f7c32
fix import
eacharles Mar 25, 2026
2962d9f
fix func
eacharles Mar 25, 2026
ea1d76f
added tables_io import
eacharles Mar 25, 2026
59a81b1
fix bug
eacharles Mar 25, 2026
13e4e14
fix bug
eacharles Mar 25, 2026
e4d62fe
added printout of merged file
eacharles Mar 26, 2026
e607516
updated to using new version of catalog_tag
eacharles Mar 27, 2026
09a3164
impoving include mechanism
eacharles Mar 30, 2026
1f6b3ad
fix var names
eacharles Mar 30, 2026
7464fa0
fix catalog
eacharles Mar 30, 2026
c4115c2
simplified reducer
eacharles Apr 1, 2026
8ae6ec3
Added healpix_cuts to selection
eacharles Apr 1, 2026
ef75776
fix import
eacharles Apr 1, 2026
2bf19af
fix typp
eacharles Apr 1, 2026
89e13d4
fix import
eacharles Apr 1, 2026
93aba34
rename shifted cols
eacharles Apr 2, 2026
a47386e
rename shifted cols
eacharles Apr 2, 2026
8ec1122
rename shifted cols
eacharles Apr 2, 2026
adf2829
rename shifted cols
eacharles Apr 2, 2026
d7ee628
rename shifted cols
eacharles Apr 2, 2026
bff1e5a
rename shifted cols
eacharles Apr 2, 2026
bdc61e1
added roman bands
eacharles Apr 2, 2026
66d9846
added roman
eacharles Apr 2, 2026
3af3099
fix cardinal rotation
eacharles Apr 2, 2026
a60e837
linting
eacharles Apr 13, 2026
54eca0d
fix merger
eacharles Apr 13, 2026
a3a595f
fix merger
eacharles Apr 13, 2026
419eac1
fix merger
eacharles Apr 13, 2026
b72ca31
added cone cut
eacharles May 4, 2026
8ce4710
added label to subsample
eacharles May 5, 2026
857062b
added label to subsample
eacharles May 5, 2026
7414c4e
refactor subsample loop
eacharles May 22, 2026
caaf055
merged
eacharles May 22, 2026
028636a
handling big merges
eacharles May 22, 2026
f82c063
handling big merges
eacharles May 22, 2026
d2ad63d
handling big merges
eacharles May 22, 2026
ec966f6
handling big merges
eacharles May 22, 2026
0357010
handling big merges
eacharles May 22, 2026
9995c55
handling big merges
eacharles May 22, 2026
ab6e412
remove breakpoint
eacharles May 22, 2026
a10241b
WIP
eacharles May 23, 2026
bea29d6
added cut functionality to subsampler and modified reducer to share f…
eacharles May 26, 2026
b37b539
added cut functionality to subsampler and modified reducer to share f…
eacharles May 26, 2026
52860b3
ensure tables are unique before merge
eacharles May 26, 2026
276bdd2
minor fixes
eacharles May 26, 2026
74d86d6
fix merger
eacharles May 28, 2026
4750e85
fix merger
eacharles May 29, 2026
7e3ac6d
more updates
eacharles Jun 19, 2026
b64283e
added estimate-many to cli
eacharles Jul 8, 2026
ecf54ad
added estimate-many to cli
eacharles Jul 8, 2026
4fc0c71
added estimate-many to cli
eacharles Jul 8, 2026
48b8520
tweaks for pipeline running against catalog
eacharles Jul 9, 2026
e5b2d4e
tweaks for pipeline running against catalog
eacharles Jul 9, 2026
07a3948
tweaks for pipeline running against catalog
eacharles Jul 9, 2026
ed0b6a9
working on estimate-many
eacharles Jul 9, 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
1 change: 0 additions & 1 deletion src/rail/cli/rail_project/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
run_group,
)


__all__ = [
"project_cli",
"inspect_command",
Expand Down
81 changes: 81 additions & 0 deletions src/rail/cli/rail_project/project_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,46 @@ def split_command(
return ok


@project_cli.command(name="merge")
@project_options.config_file()
@project_options.run_mode()
@project_options.catalog_template()
@project_options.output_catalog_template()
@project_options.merge_name()
@project_options.merger_class_name()
@project_options.selection()
@project_options.flavor()
def merge_command(
config_file: str, run_mode: project_options.RunMode, **kwargs: Any
) -> int:
"""Merged files from a particular catalog

This will:
create a catalog of input files from the catalog_template,
flavor, selection and basename parameters,
be merging varous input files
"""

if run_mode == project_options.RunMode.slurm:
raise NotImplementedError("subsample_command not set up to run under slurm")

project = RailProject.load_config(config_file)
flavors = project.get_flavor_args(kwargs.pop("flavor"))
selections = project.get_selection_args(kwargs.pop("selection"))
iter_kwargs = project.generate_kwargs_iterable(flavor=flavors, selection=selections)

dry_run = run_mode == project_options.RunMode.dry_run

ok = 0
for kw in iter_kwargs:
_output_path = project.merge_data(
dry_run=dry_run,
**kw,
**kwargs,
)
return ok


@project_cli.command(name="subsample")
@project_options.config_file()
@project_options.run_mode()
Expand All @@ -141,6 +181,8 @@ def split_command(
@project_options.selection()
@project_options.flavor()
@project_options.basename()
@project_options.label()
@project_options.cone_cut()
def subsample_command(
config_file: str, run_mode: project_options.RunMode, **kwargs: Any
) -> int:
Expand All @@ -158,6 +200,12 @@ def subsample_command(
if run_mode == project_options.RunMode.slurm:
raise NotImplementedError("subsample_command not set up to run under slurm")

cone_cut_str = kwargs.pop('cone_cut')
if cone_cut_str:
tokens = cone_cut_str.replace('[', '').replace(']', '').split(',')
cone_cut = [float(tokens[0]), float(tokens[1]), float(tokens[2])]
kwargs['cone_cut'] = cone_cut

project = RailProject.load_config(config_file)
flavors = project.get_flavor_args(kwargs.pop("flavor"))
selections = project.get_selection_args(kwargs.pop("selection"))
Expand Down Expand Up @@ -195,6 +243,7 @@ def subsample_command(
@project_options.reducer_class_name()
@project_options.input_selection()
@project_options.selection()
@project_options.sim_version()
def reduce_command(
config_file: str, run_mode: project_options.RunMode, **kwargs: Any
) -> int:
Expand Down Expand Up @@ -233,6 +282,7 @@ def run_group() -> None:
@project_options.selection()
@project_options.flavor()
@project_options.run_mode()
@project_options.convert_output()
@project_options.site()
def photmetric_errors_pipeline(config_file: str, **kwargs: Any) -> int:
"""Run the photometric errors analysis pipeline"""
Expand All @@ -257,6 +307,7 @@ def photmetric_errors_pipeline(config_file: str, **kwargs: Any) -> int:
@project_options.selection()
@project_options.flavor()
@project_options.run_mode()
@project_options.convert_output()
@project_options.site()
def prepare_pipeline(config_file: str, **kwargs: Any) -> int:
"""Run the truth-to-observed data pipeline"""
Expand All @@ -281,6 +332,7 @@ def prepare_pipeline(config_file: str, **kwargs: Any) -> int:
@project_options.selection()
@project_options.flavor()
@project_options.run_mode()
@project_options.convert_output()
@project_options.site()
def truth_to_observed_pipeline(config_file: str, **kwargs: Any) -> int:
"""Run the truth-to-observed data pipeline"""
Expand All @@ -305,6 +357,7 @@ def truth_to_observed_pipeline(config_file: str, **kwargs: Any) -> int:
@project_options.selection()
@project_options.flavor()
@project_options.run_mode()
@project_options.convert_output()
@project_options.site()
def blending_pipeline(config_file: str, **kwargs: Any) -> int:
"""Run the blending analysis pipeline"""
Expand All @@ -329,6 +382,7 @@ def blending_pipeline(config_file: str, **kwargs: Any) -> int:
@project_options.selection()
@project_options.flavor()
@project_options.run_mode()
@project_options.convert_output()
@project_options.site()
def spectroscopic_selection_pipeline(config_file: str, **kwargs: Any) -> int:
"""Run the spectroscopic selection data pipeline"""
Expand Down Expand Up @@ -395,6 +449,33 @@ def estimate_single(config_file: str, **kwargs: Any) -> int:
)
return ok

@run_group.command(name="estimate-many")
@project_options.config_file()
@project_options.selection()
@project_options.flavor()
@project_options.basename()
@project_options.run_mode()
@project_options.site()
def estimate_many(config_file: str, **kwargs: Any) -> int:
"""Run the spectroscopic selection data pipeline"""
project = RailProject.load_config(config_file)
flavors = project.get_flavor_args(kwargs.pop("flavor"))
selections = project.get_selection_args(kwargs.pop("selection"))
the_basename = kwargs.pop("basename")
iter_kwargs = project.generate_kwargs_iterable(flavor=flavors, selection=selections)
ok = 0
pipeline_name = "estimate"

for kw in iter_kwargs:
kw.update(basename=the_basename)
ok |= project.run_pipeline_catalog(
pipeline_name,
**kw,
**kwargs,
)
return ok



@run_group.command(name="evaluate")
@project_options.config_file()
Expand Down
41 changes: 41 additions & 0 deletions src/rail/cli/rail_project/project_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
"RunMode",
"args",
"basename",
"cone_cut",
"config_path",
"convert_output",
"catalog_template",
"file_template",
"force",
Expand All @@ -18,6 +20,8 @@
"input_tag",
"label",
"maglim",
"merge_name",
"merger_class_name",
"model_dir",
"model_name",
"model_path",
Expand All @@ -27,6 +31,7 @@
"reducer_class_name",
"run_mode",
"selection",
"sim_version",
"site",
"splitter_class_name",
"subsampler_class_name",
Expand Down Expand Up @@ -61,12 +66,24 @@
)


cone_cut = PartialOption(
"--cone-cut",
help="[RA, DEC, SIZE] in degrees for a cone selection",
type=str,
)


config_path = PartialOption(
"--config_path",
help="Path to configuration file",
type=click.Path(),
)

convert_output = PartialOption(
"--convert-output/--no-convert-output",
help="Convert outputfiles",
default=True,
)

catalog_template = PartialOption(
"--catalog-template",
Expand Down Expand Up @@ -99,6 +116,8 @@
label = PartialOption(
"--label",
help="File label (e.g., 'test' or 'train')",
required=False,
default=None,
type=str,
)

Expand Down Expand Up @@ -189,6 +208,20 @@
)


merge_name = PartialOption(
"--merge-name",
help="Configuration used to merge",
type=str,
)


merger_class_name = PartialOption(
"--merger-class-name",
help="Class for the merger",
type=str,
)


model_dir = PartialOption(
"--model-dir",
help="Path to directory with model files",
Expand Down Expand Up @@ -238,13 +271,21 @@
help="Mode to run script",
)

sim_version = PartialOption(
"--sim-version",
type=str,
help="Optional override to simulation version",
)


size = PartialOption(
"--size",
type=int,
default=100_000,
help="Number of objects in file",
)


test_file_template = PartialOption(
"--test-file-template",
type=str,
Expand Down
22 changes: 13 additions & 9 deletions src/rail/plotting/data_extraction_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import numpy as np
import qp
import tables_io
from rail.utils.catalog_utils import CatalogConfigBase
from rail.utils import catalog_utils

from rail.projects import RailProject, path_funcs

Expand Down Expand Up @@ -322,9 +322,11 @@ def get_pz_point_estimate_data(
z_estimate_data = extract_z_point(z_estimate_path)
flavor_info = project.get_flavor(flavor)
catalog_tag = flavor_info["catalog_tag"]
CatalogConfigBase.apply(catalog_tag)
catalog_class = CatalogConfigBase.active_class()
ref_band = catalog_class.band_template.format(band=catalog_class.ref_band)
catalog_utils.apply(catalog_tag)
active_catalog = catalog_utils.get_active_tag()
ref_band = active_catalog.config.mag_column_template.format(
band=active_catalog.config.ref_band
)
mag_data = extract_mag(z_true_path, colname=ref_band)
pz_data = make_z_true_z_point_dict(z_true_data, z_estimate_data, mag_data)
return pz_data
Expand Down Expand Up @@ -360,18 +362,20 @@ def get_ztrue_and_magntidues(
"""
flavor_info = project.get_flavor(flavor)
catalog_tag = flavor_info["catalog_tag"]
CatalogConfigBase.apply(catalog_tag)
catalog_class = CatalogConfigBase.active_class()
catalog_utils.apply(catalog_tag)
active_catalog = catalog_utils.get_active_tag()

z_true_path = path_funcs.get_z_true_path(project, selection, flavor, tag)
z_true_data = extract_z_true(z_true_path, catalog_class.redshift_col)
z_true_data = extract_z_true(z_true_path, active_catalog.config.redshift_col)
mag_data = extract_magnitudes(
z_true_path, catalog_class.band_template, catalog_class.bandlist
z_true_path,
active_catalog.config.mag_column_template,
active_catalog.config.band_list,
)
out_data = dict(
truth=z_true_data,
magnitudes=mag_data,
bands=catalog_class.bandlist,
bands=active_catalog.config.band_list,
)
return out_data

Expand Down
3 changes: 3 additions & 0 deletions src/rail/plotting/dataset_holder.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from ceci.config import StageParameter
from rail.core.configurable import Configurable
from rail.utils import catalog_utils

from rail.projects import RailProject
from rail.projects.dynamic_class import DynamicClass
Expand Down Expand Up @@ -288,4 +289,6 @@ def resolve(self) -> RailProject:
"""Read the associated yaml file and create a RailProject"""
if self._project is None:
self._project = RailProject.load_config(self.config.yaml_file)
for catalog_lib in self._project.config.CatalogLib:
catalog_utils.load_yaml(catalog_lib)
return self._project
1 change: 0 additions & 1 deletion src/rail/projects/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@
from . import library, name_utils
from .project import RailFlavor, RailProject


__all__ = ["library", "name_utils", "RailFlavor", "RailProject"]
3 changes: 3 additions & 0 deletions src/rail/projects/algorithm_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
RailClassificationAlgorithmHolder,
RailErrorModelAlgorithmHolder,
RailPZAlgorithmHolder,
RailMergerAlgorithmHolder,
RailReducerAlgorithmHolder,
RailSpecSelectionAlgorithmHolder,
RailSplitterAlgorithmHolder,
Expand All @@ -23,6 +24,7 @@
"Classifiers",
"Summarizers",
"ErrorModels",
"Mergers",
"Splitters",
"Subsamplers",
"Reducers",
Expand Down Expand Up @@ -65,6 +67,7 @@ class RailAlgorithmFactory(RailFactoryMixin):
RailClassificationAlgorithmHolder,
RailSummarizerAlgorithmHolder,
RailErrorModelAlgorithmHolder,
RailMergerAlgorithmHolder,
RailSplitterAlgorithmHolder,
RailSubsamplerAlgorithmHolder,
RailReducerAlgorithmHolder,
Expand Down
Loading
Loading