Skip to content

Commit

Permalink
keep track of active catalog tag
Browse files Browse the repository at this point in the history
  • Loading branch information
eacharles committed Jun 26, 2024
1 parent 2545049 commit fdcf8f7
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/rail/utils/catalog_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,26 @@ class CatalogConfigBase:
band_err_template = ''
ref_band = ''
redshift_col = ''

_active_tag = None
_active_class = None

def __init_subclass__(cls, **kwargs):
cls.sub_classes[cls.tag] = cls

@classmethod
def active_tag(cls):
return cls._active_tag

@classmethod
def active_class(cls):
return cls._active_class

@classmethod
def apply(cls, tag):
sub_cls = cls.sub_classes[tag]
sub_cls._apply()
cls._active_tag = None
cls._active_class = cls.sub_classes[tag]
cls._active_class._apply()

@classmethod
def _apply(cls):
Expand All @@ -34,6 +46,10 @@ def _apply(cls):
def _apply_hook(cls):
return

@classmethod
def band_name_dict(cls):
return {band: cls.band_template.format(band=band) for band in cls.bandlist}

@classmethod
def _build_maglim_dict(cls):
maglim_dict = {}
Expand Down

0 comments on commit fdcf8f7

Please sign in to comment.