Skip to content

RegionTimeSeriesImporter cannot remember sample rate of TimeSeries EEG MAT data #765

@PC-DOS

Description

@PC-DOS

Describe the bug

When uploading EEG MAT data to a project, the sampling rate specified in "sampling rate (Hz)" field cannot be remembered, and fallbacks to 1.0s.

Steps to reproduce

  1. In project data structure viewer, open an upload window, and select "TimeSeries EEG MAT" tab
  2. Select a MAT-formatted data file, and set "sampling rate (Hz)" to 500
  3. Input other information
  4. Upload
  5. In project data structure viewer, click on the uploaded file
  6. The "DataTypeDetails" window says the Sample Period is 1.0 (s)
Image Image

Expected results

The "DataTypeDetails" window should say the Sample Period is 0.002 (s)

Actual results

The "DataTypeDetails" window says the Sample Period is 1.0 (s)

Additional information

After checking the source code, I found the launch() function, defined in RegionTimeSeriesImporter class, did not register the sampling_rate property of view_model to the ts object. While the start_time property is registered.

I modified the launch() function, added 1 new line like the following code:

            ts.start_time = view_model.start_time
            ts.sample_period_unit = 's'
            
            # Added by Picsell Dois
            # Fix a problem which prevents the uploader from remembering sampling rate
            ts.sample_period = 1.0 / view_model.sampling_rate
            # EndOf: Added by Picsell Dois

After relaunching TVB, the sample rate can be remembered properly:

Image Image

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