Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Nov 11, 2024
1 parent 1622037 commit f7addf1
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 32 deletions.
51 changes: 28 additions & 23 deletions romancal/associations/skycell_asn.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,38 +51,43 @@ def skycell_asn(self):
("nx", int(pm.PATCH_TABLE[item]["nx"])),
("ny", int(pm.PATCH_TABLE[item]["ny"])),
("orient", float(pm.PATCH_TABLE[item]["orientat"])),
("orientat_projection_center", float(pm.PATCH_TABLE[item]["orientat_projection_center"])),
(
"orientat_projection_center",
float(pm.PATCH_TABLE[item]["orientat_projection_center"]),
),
]
)
parsed_visit_id = parse_visitID(member_list[0][1:20])
program_id = parsed_visit_id['Program']
program_id = parsed_visit_id["Program"]
root_asn_name = self.parsed.output_file_root
product_type = self.parsed.product_type
product_release = self.parsed.release_product
suffix = "coadd"
sep = "_"
instrument = 'wfi'
if product_type == 'visit':
pr_name = ('v' +
parsed_visit_id['Execution'] +
parsed_visit_id['Pass'] +
parsed_visit_id['Segment'] +
parsed_visit_id['Observation'])
elif product_type == 'daily':
pr_name = ('d' +
parsed_visit_id['Execution'] +
parsed_visit_id['Pass'] +
parsed_visit_id['Segment'])
elif product_type == 'pass':
pr_name = ('p' +
parsed_visit_id['Execution'] +
parsed_visit_id['Pass'])
elif product_type == 'full':
pr_name = 'full'
elif product_type == 'user':
pr_name = 'user'
instrument = "wfi"
if product_type == "visit":
pr_name = (
"v"
+ parsed_visit_id["Execution"]
+ parsed_visit_id["Pass"]
+ parsed_visit_id["Segment"]
+ parsed_visit_id["Observation"]
)
elif product_type == "daily":
pr_name = (
"d"
+ parsed_visit_id["Execution"]
+ parsed_visit_id["Pass"]
+ parsed_visit_id["Segment"]
)
elif product_type == "pass":
pr_name = "p" + parsed_visit_id["Execution"] + parsed_visit_id["Pass"]
elif product_type == "full":
pr_name = "full"
elif product_type == "user":
pr_name = "user"
else:
pr_name = 'unknown'
pr_name = "unknown"

asn_file_name = (
root_asn_name
Expand Down
21 changes: 12 additions & 9 deletions romancal/lib/basic_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,9 @@ def recarray_to_ndarray(x, to_dtype="<f8"):
astype = [(name, to_dtype) for name in names]
return np.asarray(x.astype(astype).view(to_dtype).reshape((-1, len(names))))


def parse_visitID(visit_id):
""" Utility to parse the visit_id into its components
"""Utility to parse the visit_id into its components
Input:
visit_id as a string
Expand All @@ -136,13 +137,15 @@ def parse_visitID(visit_id):
visit number
"""

visit_id_parts = dict([
("Program", visit_id[0:5]),
("Execution", visit_id[5:7]),
("Pass", visit_id[7:10]),
("Segment", visit_id[10:13]),
("Observation", visit_id[13:16]),
("Visit", visit_id[16:20]),
])
visit_id_parts = dict(
[
("Program", visit_id[0:5]),
("Execution", visit_id[5:7]),
("Pass", visit_id[7:10]),
("Segment", visit_id[10:13]),
("Observation", visit_id[13:16]),
("Visit", visit_id[16:20]),
]
)

return visit_id_parts

0 comments on commit f7addf1

Please sign in to comment.