Skip to content

Commit

Permalink
Merge pull request #102 from NTIA/usrp_debug
Browse files Browse the repository at this point in the history
Fix Recursion error and convert numpy.bool_ types in metadata
  • Loading branch information
jhazentia committed Dec 7, 2023
2 parents 879ea65 + 32d0f9d commit d441aa9
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion scos_actions/__init__.py
@@ -1 +1 @@
__version__ = "7.0.0"
__version__ = "7.0.1"
1 change: 1 addition & 0 deletions scos_actions/actions/acquire_single_freq_fft.py
Expand Up @@ -188,6 +188,7 @@ def execute(self, schedule_entry: dict, task_id: int) -> dict:

# Build capture metadata
sigan_settings = self.get_sigan_settings(measurement_result)
logger.debug(f"sigan settings:{sigan_settings}")
measurement_result["capture_segment"] = self.create_capture_segment(
sample_start=0,
start_time=measurement_result["capture_time"],
Expand Down
1 change: 1 addition & 0 deletions scos_actions/actions/acquire_single_freq_tdomain_iq.py
Expand Up @@ -96,6 +96,7 @@ def execute(self, schedule_entry: dict, task_id: int) -> dict:
]
measurement_result["classification"] = self.classification
sigan_settings = self.get_sigan_settings(measurement_result)
logger.debug(f"sigan settings:{sigan_settings}")
measurement_result["capture_segment"] = self.create_capture_segment(
sample_start=0,
start_time=measurement_result["capture_time"],
Expand Down
2 changes: 2 additions & 0 deletions scos_actions/actions/interfaces/measurement_action.py
Expand Up @@ -112,6 +112,8 @@ def create_metadata(
except KeyError:
logger.warning(warning_str.format("calibration_datetime"))
try:
cap = measurement_result["capture_segment"]
logger.debug(f"Adding capture:{cap}")
self.sigmf_builder.add_capture(measurement_result["capture_segment"])
except KeyError:
logger.warning(warning_str.format("capture_segment"))
Expand Down
7 changes: 6 additions & 1 deletion scos_actions/metadata/utils.py
Expand Up @@ -33,8 +33,13 @@ def construct_geojson_point(


def _enc_hook(obj: Any) -> Any:
if isinstance(obj, np.float64):
#While isinstance is recommended, it was causing a
#Recurrsion error and I don't think we have to worry
#about subytpes here.
if type(obj) == np.float64:
return float(obj)
elif type(obj) == np.bool_:
return bool(obj)
else:
return obj

Expand Down

0 comments on commit d441aa9

Please sign in to comment.