Skip to content

Commit

Permalink
adding source detection (#132)
Browse files Browse the repository at this point in the history
 adding source detection

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
cshanahan1 and pre-commit-ci[bot] committed Mar 24, 2023
1 parent caaad94 commit 36b556e
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/roman_datamodels/maker_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,20 @@ def mk_photometry():
return phot


def mk_source_detection():
"""
Create a dummy Source Detection instance with valid values for attributes
required by the schema. Utilized by the model maker utilities below
Returns
-------
roman_datamodels.stnode.Photometry
"""
sd = stnode.SourceDetection()
sd["tweakreg_catalog_name"] = "filename_tweakreg_catalog.asdf"
return sd


def mk_coordinates():
"""
Create a dummy Coordinates instance with valid values for attributes
Expand Down Expand Up @@ -318,6 +332,7 @@ def mk_cal_step():
calstep["jump"] = "INCOMPLETE"
calstep["linearity"] = "INCOMPLETE"
calstep["photom"] = "INCOMPLETE"
calstep["source_detection"] = "INCOMPLETE"
calstep["ramp_fit"] = "INCOMPLETE"
calstep["saturation"] = "INCOMPLETE"

Expand Down
24 changes: 24 additions & 0 deletions src/roman_datamodels/testing/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"create_pointing",
"create_program",
"create_ref_meta",
"create_source_detection",
"create_target",
"create_velocity_aberration",
"create_visit",
Expand Down Expand Up @@ -96,6 +97,7 @@ def create_cal_step(**kwargs):
"jump": random_utils.generate_choice("N/A", "COMPLETE", "SKIPPED", "INCOMPLETE"),
"linearity": random_utils.generate_choice("N/A", "COMPLETE", "SKIPPED", "INCOMPLETE"),
"photom": random_utils.generate_choice("N/A", "COMPLETE", "SKIPPED", "INCOMPLETE"),
"source_detection": random_utils.generate_choice("N/A", "COMPLETE", "SKIPPED", "INCOMPLETE"),
"ramp_fit": random_utils.generate_choice("N/A", "COMPLETE", "SKIPPED", "INCOMPLETE"),
"saturation": random_utils.generate_choice("N/A", "COMPLETE", "SKIPPED", "INCOMPLETE"),
}
Expand Down Expand Up @@ -966,6 +968,28 @@ def create_ramp_fit_output(**kwargs):
return stnode.RampFitOutput(raw)


def create_source_detection(**kwargs):
"""
Create a dummy SourceDetection instance with valid values for attributes
required by the schema.
Parameters
----------
**kwargs
Additional or overridden attributes.
Returns
-------
roman_datamodels.stnode.Photometry
"""
raw = {
"tweakreg_catalog_name": "filename_catalog.asdf",
}
raw.update(kwargs)

return stnode.SourceDetection(raw)


def create_associations(**kwargs):
"""
Create a dummy Association table instance (or file) with table and valid values for attributes
Expand Down

0 comments on commit 36b556e

Please sign in to comment.