Skip to content

Commit

Permalink
Merge pull request #2777 from din14970/fix_blo_lazy
Browse files Browse the repository at this point in the history
Fix blo writing for lazy datasets + other improvements
  • Loading branch information
ericpre committed Jun 29, 2021
2 parents bd1c12b + 931e4f8 commit 7fed9b2
Show file tree
Hide file tree
Showing 5 changed files with 638 additions and 278 deletions.
25 changes: 25 additions & 0 deletions doc/user_guide/io.rst
Expand Up @@ -797,6 +797,31 @@ loading the file using a different mode. However, note that lazy loading
does not support in-place writing (i.e lazy loading and the "r+" mode
are incompatible).

Extra saving arguments
^^^^^^^^^^^^^^^^^^^^^^

- ``intensity_scaling`` : in case the dataset that needs to be saved does not
have the `np.uint8` data type, casting to this datatype without intensity
rescaling results in overflow errors (default behavior). This option allows
you to perform linear intensity scaling of the images prior to saving the
data. The options are:

- `'dtype'`: the limits of the datatype of the dataset, e.g. 0-65535 for
`np.uint16`, are mapped onto 0-255 respectively. Does not work for `float`
data types.
- `'minmax'`: the minimum and maximum in the dataset are mapped to 0-255.
- `'crop'`: everything below 0 and above 255 is set to 0 and 255 respectively
- 2-tuple of `floats` or `ints`: the intensities between these values are
scaled between 0-255, everything below is 0 and everything above is 255.
- ``navigator_signal``: the BLO file also stores a virtual bright field (VBF) image which
behaves like a navigation signal in the ASTAR software. By default this is
set to `'navigator'`, which results in the default :py:attr:`navigator` signal to be used.
If this signal was not calculated before (e.g. by calling :py:meth:`~.signal.BaseSignal.plot`), it is
calculated when :py:meth:`~.signal.BaseSignal.save` is called, which can be time consuming.
Alternatively, setting the argument to `None` will result in a correctly sized
zero array to be used. Finally, a custom ``Signal2D`` object can be passed,
but the shape must match the navigation dimensions.

.. _dens-format:

DENS heater log
Expand Down

0 comments on commit 7fed9b2

Please sign in to comment.