Skip to content

Dumping NSB pixel rate crashes due to paremeter_version being None #2016

@orelgueta

Description

@orelgueta

With the current main or camera-efficiency-summary branch, running simtools-validate-camera-efficiency --config check_camera_validation_summary.yml where check_camera_validation_summary.yml is

model_version: 6.0.2
output_path: simtools-output/check_camera_validation_summary/
site: South
telescope: SSTS-01
zenith: 0

I get the following error:

Traceback (most recent call last):
  File "/workdir/env/bin/simtools-validate-camera-efficiency", line 7, in <module>
    sys.exit(main())
             ^^^^^^
  File "/workdir/external/simtools/src/simtools/applications/validate_camera_efficiency.py", line 121, in main
    ce.dump_nsb_pixel_rate()
  File "/workdir/external/simtools/src/simtools/camera/camera_efficiency.py", line 555, in dump_nsb_pixel_rate
    writer.ModelDataWriter.dump_model_parameter(
  File "/workdir/external/simtools/src/simtools/data_model/model_data_writer.py", line 158, in dump_model_parameter
    _json_dict = writer.get_validated_parameter_dict(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workdir/external/simtools/src/simtools/data_model/model_data_writer.py", line 270, in get_validated_parameter_dict
    return self.validate_and_transform(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workdir/external/simtools/src/simtools/data_model/model_data_writer.py", line 410, in validate_and_transform
    return _validator.validate_and_transform(is_model_parameter)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workdir/external/simtools/src/simtools/data_model/validate_data.py", line 84, in validate_and_transform
    return self._validate_data_dict(is_model_parameter, lists_as_strings)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workdir/external/simtools/src/simtools/data_model/validate_data.py", line 255, in _validate_data_dict
    raise ValueError(f"Invalid version string '{version_string}'")
ValueError: Invalid version string 'None'

I narrowed it down to the parameter_version being None once we get into the self.data_dict in validate_data.py. I am not sure why, I see it has a version in the DB. I implemented a small workaround in my local code just to get it running, which is to add the following at line 254 in validate_data.py

if version_string is None:
    version_string

I don't think it is a real solution though and I am more interested to know why @GernotMaier does not see this issue, while I do. I use a local DB, but I pulled the latest main, so it shouldn't be different from the repo version.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions