Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metadata contents for SEA action: add CUI marking and minor updates #92

Merged
merged 11 commits into from
Oct 20, 2023
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ default_language_version:
python: python3.8
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: check-ast
types: [file, python]
Expand All @@ -18,7 +18,7 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/asottile/pyupgrade
rev: v3.10.1
rev: v3.15.0
hooks:
- id: pyupgrade
args: ["--py38-plus"]
Expand All @@ -30,12 +30,12 @@ repos:
types: [file, python]
args: ["--profile", "black", "--filter-files", "--gitignore"]
- repo: https://github.com/psf/black
rev: 23.7.0
rev: 23.10.0
hooks:
- id: black
types: [file, python]
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.35.0
rev: v0.37.0
hooks:
- id: markdownlint
types: [file, markdown]
Expand Down
2 changes: 1 addition & 1 deletion scos_actions/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "6.3.3"
__version__ = "6.4.0"
23 changes: 4 additions & 19 deletions scos_actions/actions/acquire_sea_data_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ def __call__(self, schedule_entry, task_id):
[],
)
result_tic = perf_counter()
for i, channel_data_process in enumerate(dp_procs):
for channel_data_process in dp_procs:
# Retrieve object references for channel data
channel_data_refs = ray.get(channel_data_process)
channel_data = []
Expand Down Expand Up @@ -796,6 +796,7 @@ def capture_diagnostics(self, action_start_tic: float, cpu_speeds: list) -> None
"python_version": sys.version.split()[0],
"scos_sensor_version": SCOS_SENSOR_GIT_TAG,
"scos_actions_version": SCOS_ACTIONS_VERSION,
"scos_tekrsa_version": self.sigan.plugin_version,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SHouldn't this be added to SignalAnalyzerInterface?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes- good point. I added it as a property and abstract method, and updated the mock sigan interface, in f5b1609.

I will make a corresponding update to scos-tekrsa momentarily.

"preselector_api_version": PRESELECTOR_API_VERSION,
}

Expand All @@ -822,22 +823,6 @@ def create_global_sensor_metadata(self):
ntia_sensor.Sensor(
sensor_spec=ntia_core.HardwareSpec(
id=self.sensor_definition["sensor_spec"]["id"],
version=self.sensor_definition["sensor_spec"]["version"],
),
preselector=ntia_sensor.Preselector(
preselector_spec=ntia_core.HardwareSpec(
id=self.sensor_definition["preselector"]["preselector_spec"][
"id"
]
)
),
signal_analyzer=ntia_sensor.SignalAnalyzer(
sigan_spec=ntia_core.HardwareSpec(
id=self.sensor_definition["signal_analyzer"]["sigan_spec"]["id"]
)
),
computer_spec=ntia_sensor.HardwareSpec(
id=self.sensor_definition["computer_spec"]["id"]
),
sensor_sha512=SENSOR_DEFINITION_HASH,
)
Expand Down Expand Up @@ -1059,8 +1044,8 @@ def get_sigmf_builder(
sigmf_builder.set_num_channels(len(iter_params))
sigmf_builder.set_task(task_id)

# Mark data as UNCLASSIFIED
sigmf_builder.set_classification("UNCLASSIFIED")
# Mark data as CUI (basic)
sigmf_builder.set_classification("CUI")

self.sigmf_builder = sigmf_builder

Expand Down
6 changes: 6 additions & 0 deletions scos_actions/hardware/mocks/mock_sigan.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import numpy as np

from scos_actions import __version__ as SCOS_ACTIONS_VERSION
from scos_actions.hardware.sigan_iface import SignalAnalyzerInterface
from scos_actions.utils import get_datetime_str_now

Expand Down Expand Up @@ -36,6 +37,7 @@ def __init__(self, randomize_values=False):
self._overload = False
self._capture_time = None
self._is_available = True
self._plugin_version = SCOS_ACTIONS_VERSION

# Simulate returning less than the requested number of samples from
# self.recv_num_samps
Expand All @@ -50,6 +52,10 @@ def __init__(self, randomize_values=False):
def is_available(self):
return self._is_available

@property
def plugin_version(self):
return self._plugin_version

@property
def sample_rate(self):
return self._sample_rate
Expand Down
6 changes: 6 additions & 0 deletions scos_actions/hardware/sigan_iface.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ def is_available(self) -> bool:
"""Returns True if sigan is initialized and ready for measurements."""
pass

@property
@abstractmethod
def plugin_version(self) -> str:
"""Returns the version of the SCOS plugin defining this interface."""
pass

@abstractmethod
def acquire_time_domain_samples(
self,
Expand Down
2 changes: 1 addition & 1 deletion scos_actions/metadata/sigmf_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
},
{
"name": "ntia-diagnostics",
"version": "v1.1.0",
"version": "v1.1.1",
"optional": True,
},
{
Expand Down
2 changes: 2 additions & 0 deletions scos_actions/metadata/structs/ntia_diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,15 @@ class Software(msgspec.Struct, **SIGMF_OBJECT_KWARGS):
:param python_version: The Python version, as returned by `sys.version()`.
:param scos_sensor_version: The SCOS Sensor version, as returned by `git describe --tags`.
:param scos_actions_version: Version of `scos_actions` plugin.
:param scos_tekrs_version: Version of `scos_tekrsa` plugin.
:param preselector_api_version: Version of the NTIA `preselector` package.
"""

system_platform: Optional[str] = None
python_version: Optional[str] = None
scos_sensor_version: Optional[str] = None
scos_actions_version: Optional[str] = None
scos_tekrsa_version: Optional[str] = None
preselector_api_version: Optional[str] = None


Expand Down
14 changes: 0 additions & 14 deletions scos_actions/metadata/structs/ntia_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,6 @@ class SignalAnalyzer(msgspec.Struct, **SIGMF_OBJECT_KWARGS):
max_power: Optional[float] = None
a2d_bits: Optional[int] = None

def __post_init__(self):
super().__post_init__()
# Define SigMF key names
self.obj_keys.update(
{
"sigan_spec": "sigan_spec",
"frequency_low": "frequency_low",
"frequency_high": "frequency_high",
"noise_figure": "noise_figure",
"max_power": "max_power",
"a2d_bits": "a2d_bits",
}
)


class CalSource(
msgspec.Struct, rename={"cal_source_type": "type"}, **SIGMF_OBJECT_KWARGS
Expand Down