Skip to content

Commit

Permalink
feat(hfbcat): add HFBCatalog class
Browse files Browse the repository at this point in the history
  • Loading branch information
rikvl committed Mar 16, 2023
1 parent 055de1a commit d6a0666
Showing 1 changed file with 83 additions and 0 deletions.
83 changes: 83 additions & 0 deletions ch_util/hfbcat.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
"""
Catalog of HFB test targets
"""

import os

from .fluxcat import FluxCatalog

# Define the source collection that should be loaded when this module is imported.
HFB_COLLECTION = os.path.join(
os.path.dirname(__file__), "catalogs", "hfb_target_list.json"
)


class HFBCatalog(FluxCatalog):
"""
Class for cataloguing HFB targets.
Attributes
----------
fields : list
List of attributes that are read-from and written-to the
JSON catalog files.
"""

fields = [
"ra",
"dec",
"alternate_names",
"freq_abs",
]

def __init__(
self,
name,
ra=None,
dec=None,
alternate_names=[],
freq_abs=[],
overwrite=0,
):
"""
Instantiate an HFBCatalog object for an HFB target.
Parameters
----------
name : string
Name of the source.
ra : float
Right Ascension in degrees.
dec : float
Declination in degrees.
alternate_names : list of strings
Alternate names for the source.
freq_abs : list of floats
Frequencies at which (the peaks of) absorption features are found.
overwrite : int between 0 and 2
Action to take in the event that this source is already in the catalog:
- 0 - Return the existing entry.
- 1 - Add the measurements to the existing entry.
- 2 - Overwrite the existing entry.
Default is 0.
BUG: Currently, `freq_abs` is always overwritten.
"""

super().__init__(
name,
ra=ra,
dec=dec,
alternate_names=alternate_names,
overwrite=overwrite,
)

self.freq_abs = freq_abs


# Load the HFB target list
HFBCatalog.load(HFB_COLLECTION)

0 comments on commit d6a0666

Please sign in to comment.