Skip to content

Tekscope with multiple devices #66

Open
@ARFritsch

Description

@ARFritsch

Blacs complains when try to save the data from the scope if multiple scopes are connected.
Line 57 (transition_to_buffer) in labscript-devices/labscript_devices/TekScope/blacs_workers.py creates a group in the .h5 file to save the scope data. However, when the group is already created by the first connected scope, the second scope gets an error because the group already exists.
`

        with h5py.File(self.h5file, 'r+') as hdf_file:
            grp = hdf_file.create_group('/data/traces')
            print('Saving traces...')
            dset = grp.create_dataset(self.device_name, data=data)
            dset.attrs.update(wfmp[ch]) 

I could fix this by checking if the group exists before creating it.
`

        with h5py.File(self.h5file, 'r+') as hdf_file:
            check_grp = '/data/traces' in hdf_file
            if check_grp == False:
                 grp = hdf_file.create_group('/data/traces')
                 dset = grp.create_dataset(self.device_name, data=data)
            else:
                 dset = hdf_file.create_dataset('/data/traces/' + self.device_name, data=data)
            print('Saving traces...')
            dset.attrs.update(wfmp[ch]) `

I tested it with two scopes connected and is working.

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