Skip to content

Asig metadata #15

@thomas-hermann

Description

@thomas-hermann

For Arecorder.record(), it would be useful to store the time stamps when recordings were made. One way would be to change recordings.append((timestamp, asig)), but that would make access and interpretation less intuitive. So that lead me to the idea of Asig.metadata:

I propose to add an attribute Asig.metadata, which could be a dict with fields such as

  • timestamp,
  • author,
  • recording_device,
  • history (which could be a list itself and store those things currently appended to label)
  • etc. (ideas?)

By the way, Asig.label would be a perfect item in the meta data dict!

Before such a far-reaching change, I'd like to hear your feedback and ideas on this issue.

Note that we already have a context variable named '_' (yes, funny name, but short and nice, e.g. to access results of a1.find_events().plot() via a1._['events'] and self._['plot'].
This is convenient for returning auxilliary data without breaking the logic of returning self always.

Hand in hand with that, I feel that the currently often used strategy to return a new Asig with new data

return Asig(newsig, self.sr, self.label, self.cn,...)

is suboptimal as it often fails to copy '_' and would, if metadata should be implemented, become even more complex. So probably a static method Asig._copy() for devs, which generally duplicates self w/o copying sig would help, so instead we could simply write

return Asig._copy(self, newsig, attr_to_overwrite=new_value,...)

Looking forward to hear your thoughts on both issues.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions