usnistgov / mass

Microcalorimeter pulse-analysis software
MIT License
6 stars 0 forks source link

Fix invert_data to work with new memmapped LJH files #290

Closed joefowler closed 3 months ago

joefowler commented 3 months ago

Alter the LJHFile classes in core/files.py so that they have two read-only properties:

  1. alldata returns either the raw memmapped pulse data, or a bitwise-inverted copy of it, depending on self.invert_data
  2. data[key] returns a copy of all (if key is :) or part of the data (for any other value of key, such as slices, etc), and the copy will be inverted if self.invert_data evaluates True.

The reason to have the indexed data[key] interface is to allow copying and inverting only a small amount of data, if key refers to a small slice, such as one pulse record.

This read-only interface is passed up to the MicrocalDataset that owns the file, so the same properties .alldata and .data[key] apply to it, too.

Fixes #286.