Skip to content

overrride global info when creating new file, not replace #76

@Teque5

Description

@Teque5

To create the absolute minimum valid SigMF file we may do something like this:

data = np.zeros(10, dtype=np.complex64)
data.tofile('some.sigmf-data')
meta = SigMFFile(data_file='some.sigmf-data', global_info={'core:sample_rate':1000, 'core:datatype':'cf32_le'})

As is this overrides the default global_info and yeilds:

>>> meta
SigMFFile({
    "global": {
        "core:datatype": "cf32_le",
        "core:sample_rate": 1000,
        "core:sha512": "b6b4c190ccd537f7b879658fb3ab39a81347e1ecb68246dab95648560587b8437ecb02b7825f46a9141059ae61887ec7b011c1314cbcc5741c9fae953eaa02ec"
    },
    "captures": [],
    "annotations": []
})

but it should contain the default specification version & num_channels like:

>>> meta
SigMFFile({
    "global": {
        "core:datatype": "cf32_le",
        "core:num_channels": 1,
        "core:sample_rate": 1000,
        "core:sha512": "b6b4c190ccd537f7b879658fb3ab39a81347e1ecb68246dab95648560587b8437ecb02b7825f46a9141059ae61887ec7b011c1314cbcc5741c9fae953eaa02ec",
        "core:version": "1.2.0"
    },
    "captures": [],
    "annotations": []
})

I should have done this while fixing #67.

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