feat: parse cpsd type from header
All checks were successful
gitea-physics/kalpa/pipeline/head This commit looks good

This commit is contained in:
Deepak Mallubhotla 2025-02-23 02:18:29 -06:00
parent 8e122bad15
commit 9bda1a48c6
Signed by: deepak
GPG Key ID: BEBAEBF28083E022
3 changed files with 40 additions and 2 deletions

View File

@ -153,7 +153,9 @@ def _parse_bin_header(field: str) -> typing.Optional[ParsedBinHeader]:
dot_name=match_groups["dot_name"], dot_name=match_groups["dot_name"],
summary_stat=match_groups["summary_stat"], summary_stat=match_groups["summary_stat"],
) )
elif (pair_match := re.match(PAIR_MEASUREMENT_BINNED_HEADER_REGEX, field)) is not None: elif (
pair_match := re.match(PAIR_MEASUREMENT_BINNED_HEADER_REGEX, field)
) is not None:
groups = pair_match.groupdict() groups = pair_match.groupdict()
return ParsedBinHeader( return ParsedBinHeader(
original_field=field, original_field=field,

View File

@ -307,5 +307,37 @@
'summary_stat': 'mean', 'summary_stat': 'mean',
}), }),
None, None,
dict({
'cpsd_type': 'correlation',
'dot_name': 'dot1',
'dot_name2': 'dot2',
'measurement_type': 'V',
'original_field': 'CPSD_correlation_V_dot1_dot2_mean',
'summary_stat': 'mean',
}),
dict({
'cpsd_type': 'correlation',
'dot_name': 'dot1',
'dot_name2': 'dot2',
'measurement_type': 'V',
'original_field': 'CPSD_correlation_V_dot1_dot2_stdev',
'summary_stat': 'stdev',
}),
dict({
'cpsd_type': 'phase',
'dot_name': 'dot1',
'dot_name2': 'dot2',
'measurement_type': 'V',
'original_field': 'CPSD_phase_V_dot1_dot2_mean',
'summary_stat': 'mean',
}),
dict({
'cpsd_type': 'phase',
'dot_name': 'dot1',
'dot_name2': 'dot2',
'measurement_type': 'V',
'original_field': 'CPSD_phase_V_dot1_dot2_stdev',
'summary_stat': 'stdev',
}),
]) ])
# --- # ---

View File

@ -40,6 +40,10 @@ def test_parse_headers(snapshot):
"APSD_V_triangle2_stdev", "APSD_V_triangle2_stdev",
"APSD_V_uprise1_mean", "APSD_V_uprise1_mean",
"This is not a valid header", "This is not a valid header",
"CPSD_correlation_V_dot1_dot2_mean",
"CPSD_correlation_V_dot1_dot2_stdev",
"CPSD_phase_V_dot1_dot2_mean",
"CPSD_phase_V_dot1_dot2_stdev",
] ]
# force logger to be used for now # force logger to be used for now