SiffReader API

class siffpy.core.siffreader.SiffReader(filename: str | Path | None = None, open: bool = True, backend: str = 'corrosiff')

Centralized Pythonic interface to the SiffReader module implemented in C.

Designed to streamline several types of operations one might perform with a single file, so it operates by opening a file and then taking arguments that relate to that specific file, e.g. frame numbers or slice numbers, as opposed to accepting numpy arrays of frames.

close() None

Closes opened file

property dt_frame: float

Returns the average time between frames in seconds. Only as accurate as ScanImage – does not use timestamps if the ScanImage RoiManager metadata is available.

Might take a long time… suboptimally implemented since it reads the frame metadata for every frame, then parses out the timestamps…

property dt_volume: float

Returns the average time between volumes in seconds. Only as accurate as ScanImage – does not use timestamps if the ScanImage RoiManager metadata is available.

epoch_time_to_frame_index(epoch_time: int, correct_flyback: bool = False) int

Returns the index of the frame containing the epoch time provided. Note: by default frames are numbered by _frame triggers_, meaning they include flyback frames in their indexing!

epoch_time_to_volume_index(epoch_time: int) int

Returns the index of the volume containing the epoch time provided.

epoch_to_frame_time(epoch_time: int) float

Converts epoch time to frame time for this experiment (returned in seconds)

fit_flimparams_to_timepoints(timepoint_start: int = 0, timepoint_end: int | None = None, color_channel: int = 0, mask: ndarray[Any, dtype[bool]] | None = None, initial_guess: FLIMParams | None = None, num_lasers: int = 1, num_exps: int = 2) FLIMParams

Fits a FLIMParams object to the timepoints requested. If a mask is provided, fits only photons within the masked region. Stores the FLIMParams object in the SiffReader object but also returns a reference to the same object.

# Arguments

  • timepoint_startint

    Start of the timepoints to fit to.

  • timepoint_endint

    End of the timepoints to fit to. None means the last timepoint.

  • color_channelint

    Color channel to fit to. Default is 0. 0-indexed!

  • maskOptional[np.ndarray[bool]]

    Mask for the frames acquired. If None, fits to all frames.

  • initial_guessOptional[FLIMParams]

    Initial guess for the FLIMParams object. If None, uses the default FLIMParams object produced by default_flimparams().

  • num_lasersint

    If initial_guess is None, the number of lasers (i.e. IRFs) to use in the initial guess.

  • num_expsint

    If initial_guess is None, the number of exponentials to use in the initial guess.

# Returns

  • FLIMParams

    A reference to the FLIMParams object fit to the data, also stored in self.flim_params.

# Examples

```python

from siffpy import SiffReader reader = SiffReader(‘example.siff’)

# Fit the FLIMParams object to the first 1000 timepoints # in the first color channel

fp = reader.fit_flimparams_to_timepoints(

timepoint_end = 1000, color_channel = 0,

)

print(reader.flim_params)

# Do the same with a mask in the upper left quadrant

mask = np.zeros(reader.im_params.shape).astype(bool) mask[:mask.shape[0]//2, mask.shape[1]//2:] = True

fp_two = reader.fit_flimparams_to_timepoints(

timepoint_end = 1000, color_channel = 0, mask = mask,

)

assert ( fp != fp_two ) ```

property flim_params: Tuple[FLIMParams] | None

Returns the FLIMParams objects if they exist

Returns None if no FLIMParams objects have been loaded

frame_time_to_epoch_time(frame_time: float) int

Converts frame time to epoch time for this experiment (returned in nanoseconds)

get_appended_text(frames: List[int] | None = None) List[EventStamp]

Returns the appended text for each frame in frames.

# Arguments

  • frames : Optional[List[int]]

    If not provided, retrieves appended text for ALL frames.

# Returns

  • List[EventStamp]
    List of EventStamp objects, which are dataclasses with the following fields:

    frame_number : int text : str timestamp : Optional[float] = None (in Experiment time)

get_frames(frames: List[int] | None = None, registration_dict: Dict | None = None, full: bool = False) ndarray[Any, dtype[uint32]]

Returns the frames requested in frames keyword, or if None returns all frames.

Wraps self.siffio.get_frames

# Arguments

  • frames (optional)List[int]

    Indices of input frames requested

  • registration_dict (optional)dict

    Registration dictionary, if used

  • full (optional)bool

    If True, includes an arrival time axis. Be aware, this will multiply the size of the array by ~600x!

# Returns

  • np.ndarray

    Size of array is either (n_frames, y, x) if full is False, or (n_frames, y, x, tau) if full is True.

# Examples

```python from siffpy import SiffReader reader = SiffReader(‘example.siff’)

# Get the 2004th frame frame = reader.get_frames(frames = [2004]) print(frame)

>> array([[[1, 0, 0, …, 0, 1, 0], [0, 0, 0, …, 0, 0, 0], [0, 0, 0, …, 0, 0, 1], …, [0, 0, 0, …, 2, 0, 0], [0, 0, 1, …, 2, 0, 1], [0, 0, 0, …, 1, 0, 0]]], dtype=uint16)

# Get the first 500 frames frames = reader.get_frames(frames = list(range(500)))

print(frames.shape)

>> (500, 256, 128) ```

get_frames_flim(params: FLIMParams | None = None, frames: List[int] | None = None, registration_dict: Dict | None = None, confidence_metric: str = 'chi_sq', method: str | FlimMethod = FlimMethod.EMPIRICAL, units: FlimUnits | Literal['picoseconds', 'nanoseconds', 'countbins', 'unknown', 'unitless'] = 'nanoseconds') FlimTrace

Returns a FlimTrace object of dimensions n_frames by y_size by x_size corresponding to the frames requested. Units of the FlimTrace are ‘countbins’.

get_histogram(frames: List[int] | None = None, framewise: bool = False) ndarray

Get just the arrival times of photons in the list frames.

Note: uses FRAME numbers, not timepoints. So you will mix color channels if you’re not careful.

# Arguments

  • frames : Optional[List[int]]

    Frames to get arrival times of. If NONE, collects from all frames.

  • framewise : bool

    If True, returns the arrival times for each frame separately rather than pooling them all together.

# Returns

  • histogram : np.ndarray

    1 dimensional histogram of arrival times unless framewise is True, in which case it is a 2d array with shape (n_frames, n_bins)

# Examples

```python from siffpy import SiffReader reader = SiffReader(‘example.siff’)

# Get the histogram of the first 1000 frames hist = reader.get_histogram(frames = list(range(1000)))

print(hist.shape, hist)

#629 arrival time bins >> (629,) [ 333 359 396 388 382 393 366 319 377 391 387 363 357 364 353 330 369 323 323 337 329 332 350 317 328 341 354 343 353 334 332 320 325 321 296 277 308 329 311 314 310 286 291 294 270 307 308 336 301 282 298 285 302 271 287 296 304 283 309 306 280 278 318 372 496 732 1271 2379 4467 7922 13910 22052 32696 43632 56088 66859 77358 86290 93036 98215 101721 104092 105528 104871 104957 104276 101273 99992 97437 95649 … … ] ```

get_histogram_masked(mask: ndarray[Any, dtype[bool]], frames: List[int] | None = None, registration_dict: Dict | None = None) ndarray

Get the arrival time histogram of photons within a mask for each frame.

# Arguments

  • masknp.ndarray[bool]

    Mask to sum over. If 2d, applies the same mask to every frame. Otherwise, applies the 3d mask slices to each z slice (not implemented yet)

  • framesList[int]

    List of frames to sum over

  • registration_dictdict

    Registration dictionary, if there is not a stored one or if you want to use a custom one.

# Returns

  • np.ndarray

    Arrival time histogram of the masked region (shape is (n_frames, n_bins))

# Examples

```python from siffpy import SiffReader reader = SiffReader(‘example.siff’)

# Create a mask mask = np.zeros(reader.im_params.shape).astype(bool) mask[:mask.shape[0]//2, mask.shape[1]//2:] = True

# Get the histogram of the first 1000 frames hist = reader.get_histogram_masked(mask = mask, frames = list(range(1000)))

print(hist.shape, hist)

>>> (1000, 629) [[  0   0   0 ...   0   0   0]
```
get_time(frames: List[int] | None = None, reference_time: str = 'experiment') Timeseries

Gets the recorded time (in seconds) of the frame(s) numbered in list frames

# Arguments

  • frames (optional, list):

    If not provided, retrieves time value of ALL frames.

  • reference (optional, str):

    Referenced to start of the experiment, or referenced to epoch time.

    Possible values:

    experiment - referenced to experiment epoch - referenced to epoch

# Returns

  • time (Timeseries, an np.ndarray subclass):

    Ordered like the list in frames (or in order from 0 to end if frames is None). Time into acquisition of frames (in seconds) if experiment time, otherwise time into acquisition of frames (in nanoseconds) if epoch time.

# See also

  • SiffReader.t_axis to get volume-wise timepoints without having to

compute them yourself.

  • SiffReader.epoch_to_frame_time and SiffReader.frame_time_to_epoch_time

to convert between epoch time and frame time.

# Examples

```python from siffpy import SiffReader reader = SiffReader(‘example.siff’)

# Get the time of the first 10 frames reader.get_time(frames = list(range(10)), reference_time = ‘experiment’)

>> Timeseries([0.410458, 0.410458, 0.426717, 0.426717, 0.442989, 0.442989,

0.45926 , 0.45926 , 0.475532, 0.475532])

reader.get_time(frames = list(range(10)), reference_time = ‘epoch’)

>> Timeseries([1716838380266797800, 1716838380266797800, 1716838380266797920,

1716838380266797920, 1716838380266798040, 1716838380266798040, 1716838380266798160, 1716838380266798160, 1716838380266798280, 1716838380266798280], dtype=uint64)

```

histograms(color_channel: int | list | None = None, frame_endpoints: Sequence[int | None] = (None, None)) ndarray

Returns a numpy array with arrival time histograms for all elements of the keyword argument ‘color_channel’, which may be of type int or of type list (or any iterable). Each is stored on the major axis, so the returned array will be of dimensions: len(color_channel) x number_of_arrival_time_bins. You can define bounds in terms of numbers of frames (FOR THE COLOR CHANNEL, NOT TOTAL IMAGING FRAMES) with the other keyword argument frame_endpoints

#Arguments

  • color_channelint or list (default None)

    0 indexed list of color channels you want returned. If None is provided, returns for all color channels.

  • frame_endpointstuple(int,int) (default (None, None))

    Start and end bounds on the frames from which to collect the histograms.

# Returns

  • np.ndarray

    Array of histograms of shape (n_colors, n_bins)

# Examples

TODO

load_registration_info(path: str | Path) None

Loads the registration information from a file and sets it as the registration info for the SiffReader.

classmethod load_time_axis(filename: str | Path) ndarray

Loads the time axis of all frames as nanoseconds from a numpy array

# See also

  • SiffReader.save_time_axis to save the time axis.

open(filename: str | Path | None = None, load_time_axis: bool = False) None

Opens a .siff or .tiff file with path “filename”. If no value provided for filename, prompts with a file dialog.

# Arguments

  • filename (optional):

    (PathLike) path to a .siff or .tiff file.

  • load_time_axis (optional, bool):

    Whether or not to load the time axis of the data on opening. Takes longer, but then you never have to call it again.

# Example

```python from siffpy import SiffReader reader = SiffReader()

reader.open(‘example.siff’) ```

pool_frames(framelist: List[List[int]], flim: bool | None = False, registration: Dict | None = None, ret_type: type = typing.List, masks: List[ndarray] | None = None) List[ndarray]

Wraps self.siffio.pool_frames

NOT IMPLEMENTED TODO: Docstring.

register(registration_method='siffpy', save_path: str | Path | None = None, alignment_color_channel: int = 0, **kwargs) Dict

Performs image registration dependent on the registration method called

Arguments

registration_method (optional)string

String version of the RegistrationInfo class to use. Defaults to “siffpy”.

alignment_color_channelint

Color channel to use for alignment (0-indexed). Defaults to 0, the green channel, if present.

save_path (optional)PathLike

Whether or not to save the dict. Name will be as TODO

Other kwargs are passed to the registration method! If nowarn is included as a kwarg, it will suppress the zplane alignment warning.

save_time_axis() None

Saves the time axis of all frames as nanoseconds in a numpy array

# See also

  • SiffReader.load_time_axis to load the time axis back in.

sec_to_frames(seconds: float, base: str = 'volume') int

Converts a time in seconds to the number of frames that time represents.

Can be based on the volume or individual frames.

# Arguments

  • secondsfloat
    • Time in seconds to convert

  • basestr
    • Base to convert to. Can be ‘volume’ or ‘frame’. Defaults to ‘volume’.

# Returns

  • framesint
    • Number of frames that time represents.

# Example

```python from siffpy import SiffReader siffreader = SiffReader(‘example.siff’)

print(siffreader.dt_volume)

>> 0.1

print(siffreader.sec_to_frames(1.0, base = ‘volume’))

>> 10 ```

property series_shape: Sequence[int]

Alias for (-1, *self_im_params.volume), the way you should reshape most image data returned as flattened frames.

sum_mask(mask: ndarray[Any, dtype[bool]] | List[ndarray[Any, dtype[bool]]], timepoint_start: int = 0, timepoint_end: int | None = None, z_index: int | None = None, color_channel: int = 1, registration_dict: Dict | None = None, return_framewise: bool = False) ndarray[Any, dtype[uint32]]

Computes the sum photon counts within a numpy mask over timesteps. Takes _timepoints_ as arguments, not frames. Returns a 1D array of summed photon counts over the entire _timepoint_ over the mask. If mask is 2d, applies the same mask to every frame. Otherwise, applies the 3d mask slices to each z slice.

Internally calls self._sum_mask_frames(*, **) after computing the frames to sum over.

Note: if you want to sum over multiple masks, consider SiffReader.sum_masks instead. If you pass in a list of masks, this will call SiffReader.sum_masks instead.

# Arguments

  • mask : Union[np.ndarray[bool], List[np.ndarray[bool]]]

    Mask to sum over. Must be either the same shape as individual frames (in which case z_index is used) or have a 0th axis with length equal to the number of z slices. If a list is provided, or if the mask has dimension > 3, the function will sum over each mask in the list (presuming the slowest dimension is the mask index).

  • timepoint_start : int

    Starting timepoint for the sum. Default is 0.

  • timepoint_end : int

    Ending timepoint for the sum. Default is None, which means the last timepoint.

  • z_index : List[int]

    List of z-slices to sum over. Default is None, which means all z-slices.

  • color_channel : int

    Color channel to sum over. Default is 1, which means the FIRST color channel.

  • registration_dict : dict

    Registration dictionary, if there is not a stored one or if you want to use a different one.

  • return_framewise : bool

    If True, does not sum across timepoints.

# Returns

  • np.ndarray

    Summed photon counts as an array of shape (n_timepoints,) (unless return_framewise is True, in which case it is (n_frames,)).

# See also

  • SiffReader._sum_mask_frames to specify

exactly which frames to sum over, rather than using timepoints.

  • SiffReader.sum_masks to sum over multiple masks

in one pass of reading the file (should be far more efficient than iterating).

# Examples

A very simple example of summing over all the pixels:

```python from siffpy import SiffReader

reader = SiffReader(‘my_file_path.siff’)

# The simplest mask of all – 1 everywhere, on all timepoints. summed = reader.sum_mask(

mask = np.ones(reader.im_params.shape).astype(bool),

)

print(summed.shape, reader.im_params.array_shape) print(summed, summed.dtype)

>> (47375,) (47375, 1, 2, 256, 256) >> [13026 13157 13138 … 13288 13419 13430] uint64 ```

An example of summing over only a quadrant of the image, and only the first 100 timepoints:

```python from siffpy import SiffReader

reader = SiffReader(‘my_file_path.siff’)

mask = np.ones(reader.im_params.shape).astype(bool) mask[:mask.shape[0]//2, mask.shape[1]//2:] = False

summed = reader.sum_mask(

mask = mask, timepoint_end = 15

)

print(summed.shape, summed)

>> (15,) [9520 9845 9924 9593 9696 9977 10064 10169 9517 9727 9909 9827 9941 9867 9997] ```

sum_mask_flim(mask: ndarray[Any, dtype[bool]] | List[ndarray[Any, dtype[bool]]], params: FLIMParams | None = None, timepoint_start: int = 0, timepoint_end: int | None = None, z_index: int | None = None, color_channel: int = 1, registration_dict: dict | None = None, return_framewise: bool = False, flim_method: str | FlimMethod = FlimMethod.EMPIRICAL, units: FlimUnits | Literal['picoseconds', 'nanoseconds', 'countbins', 'unknown', 'unitless'] = 'nanoseconds') FlimTrace

Computes the empirical lifetime within an ROI over timesteps.

params determines the color channels used.

If params is a list, returns a list of numpy arrays, each corresponding to the provided FLIMParams element.

If params is a single FLIMParams object, returns a numpy array.

# Arguments

  • maskUnion[np.ndarray[bool], List[np.ndarray[bool]]]

    A mask that defines the boundaries of the region being considered. May be 2d (in which case it is applied to all z-planes) or higher dimensional (in which case it must have the same number of z-planes as the image data frames requested). If a list is provided, the function will call SiffReader.sum_masks_flim instead.

  • paramsFLIMParams object or list of FLIMParams

    The FLIMParams objects fit to the FLIM data of this .siff file. If the FLIMParams objects do not all have a color_channel attribute, then the optional argument color_list must be provided and be a list of ints corresponding to the * 1-indexed * color channel numbers for each FLIMParams, unless there is only one color channel in the data.

  • timepoint_startint (optional) (default is 0)

    The TIMEPOINT (not frame) at which to start the analysis. Defaults to 0.

  • timepoint_endint (optional) (default is None)

    The TIMEPOINT (not frame) at which the analysis ends. If the argument is None, defaults to the final timepoint of the .siff file.

  • color_channelint

    Color channel to sum over. Default is 1, which means the FIRST color channel.

  • registration_dictdict

    Registration dictionary for frames.

  • return_framewisebool

    If True, does not sum across timepoints, and returns a flat array corresponding to the frames.

  • flim_methodUnion[str, FlimMethod]

    The method to use for the FLIM analysis. Default is ‘empirical’. Options are any of the FlimMethod enum values (siffpy.siffmath.flim.FlimMethod).

  • unitsFlimUnitsLike

    The units to return the FLIM data in. Default is ‘nanoseconds’.

# Returns

  • FlimTrace

    FlimTrace object with the summed FLIM data over the ROI. Shape (n_timepoints,) or (n_frames,) if return_framewise is True.

# Examples

TODO

# See also

  • SiffReader.sum_masks_flim to sum over multiple masks efficiently

during one read of the file.

sum_masks(masks: ndarray[Any, dtype[bool]] | List[ndarray[Any, dtype[bool]]], timepoint_start: int = 0, timepoint_end: int | None = None, z_index: int | None = None, color_channel: int = 1, registration_dict: dict | None = None, return_framewise: bool = False) ndarray[Any, dtype[uint32]]

Computes the sum photon counts within a sequence of numpy masks over timesteps. The slowest dimension (i.e. masks.shape[0]) corresponds to iterating over the masks.

Takes _timepoints_ as arguments, not frames. Returns a 2D array of summed photon counts over the entire _timepoint_ over each mask. If mask is 2d, applies the same mask to every frame. Otherwise, applies the 3d mask slices to each z slice.

# Arguments

  • masks : Union[np.ndarray[bool], List[np.ndarray[bool]]]

    Mask to sum over. Must have ndim > 2. If it’s an array, the slowest axis is presumed to correspond to the mask dimension, not the z dimension. Each individual mask can be either 2d or 3d but they must all be the same shape. If 3d, the slowest axis of each mask is presumed to iterate in z (or, really, in frames). If a list is provided, it is presumed that each element of the list is its own mask (2d or 3d).

    In other words: * masks.ndim >= 3 * all(mask.shape == masks[0].shape for mask in masks) * all(mask.ndim >=2 for mask in masks)

  • timepoint_start : int

    Starting timepoint for the sum. Default is 0.

  • timepoint_end : int

    Ending timepoint for the sum. Default is None, which means the last timepoint, i.e. last valid full volume.

  • z_index : List[int]

    List of z-slices to sum over. Default is None, which means all z-slices.

  • color_channel : int

    Color channel to sum over. Default is 1, which means the FIRST color channel, (à la ScanImage).

  • registration_dict : dict

    Registration dictionary, if there is not a stored one or if you want to use a custom one.

  • return_framewise : bool

    If True, does not sum across timepoints, and returns a flat array by frames.

# Returns

  • np.ndarray

    Summed photon counts as an array of shape (n_masks, n_timepoints) (or (n_masks, n_frames) if return_framewise is True).

# Examples

A simple example summing over four masks that each correspond to four vertical stripes across the image in each plane:

```python

from siffpy import SiffReader

reader = SiffReader(‘my_file_path.siff’)

# Creates a 2d mask that is the top left quadrant of the image # across all z planes mask = np.zeros(reader.im_params.single_channel_volume).astype(bool)

# Set left stripe to True mask[…,:mask.shape[-1]//4] = True

masks = [

np.roll(mask, shift = i*mask.shape[-1]//4, axis = -1) for i in range(4)

]

summed = reader.sum_masks(

masks = masks, timepoint_end = 5

)

print(summed.shape, summed)

>> (4, 5) [[10971 13067 12082 12417 11928] [20523 23959 23162 21287 21274] [41392 42917 42119 35829 37106] [46590 35663 38401 45091 43896]] ```

Do the same, but get the individual frames rather than the timepoints:

```python from siffpy import SiffReader

reader = SiffReader(‘my_file_path.siff’)

# Creates a 2d mask that is the top left quadrant of the image # across all z planes mask = np.zeros(reader.im_params.single_channel_volume).astype(bool)

# Set left stripe to True mask[…,:mask.shape[-1]//4] = True

masks = [

np.roll(mask, shift = i*mask.shape[-1]//4, axis = -1) for i in range(4)

]

summed = reader.sum_masks(

masks = masks, timepoint_end = 5, return_framewise = True,

)

print(reader.im_params.single_channel_volume)

>> (6, 256, 128)

print(summed.shape, summed)

>> (4, 30) [[ 2457 2566 2381 1643 1044 880 3114 3226 2123 2072 1575 957 3311 2720 2651 1669 986 745 3342 3483 2190 1241 1267 894 2789 3909 1676 1557 1104 893] [ 2843 3921 5026 3940 2911 1882 4629 4425 5019 4149 3763 1974 5085 4295 5381 3726 2812 1863 3539 4227 4867 3449 3241 1964 3621 4206 4865 3622 2878 2082] [ 8847 8163 7758 6443 5930 4251 10788 7225 7864 7013 5858 4169 11538 7390 8070 6171 5420 3530 6450 6830 7088 5290 5754 4417 6845 6449 7621 5945 5521 4725] [10566 12338 10143 5502 4527 3514 7080 10351 8439 3745 2540 3508 5239 10090 7603 5392 5029 5048 11962 10080 9269 6597 3633 3550 11859 10209 9324 5158 4348 2998]] ```

# See also

  • SiffReader.sum_mask to sum over a single mask

sum_masks_flim(masks: ndarray[Any, dtype[bool]] | List[ndarray[Any, dtype[bool]]], params: FLIMParams | None = None, timepoint_start: int = 0, timepoint_end: int | None = None, z_index: int | None = None, color_channel: int = 1, registration_dict: dict | None = None, return_framewise: bool = False, flim_method: str | FlimMethod = FlimMethod.EMPIRICAL, units: FlimUnits | Literal['picoseconds', 'nanoseconds', 'countbins', 'unknown', 'unitless'] = 'nanoseconds') FlimTrace

Computes the empirical lifetime within a set of ROIs over timesteps.

# Arguments

  • masksUnion[np.ndarray[bool], List[np.ndarray[bool]]]

    A mask that defines the boundaries of the region being considered.

  • paramsFLIMParams object for the color channel to get a

    tau_offset parameter.

  • timepoint_startint (optional) (default is 0)

    The TIMEPOINT (not frame) at which to start the analysis. Defaults to 0.

  • timepoint_endint (optional) (default is None)

    The TIMEPOINT (not frame) at which the analysis ends. If the argument is None, defaults to the final timepoint of the .siff file.

  • z_indexint or list of ints (optional) (default is None)

    The z-slice or slices to sum over. If None, sums over all z-slices.

  • color_channelint

    Color channel to sum over. Default is 1, which means the FIRST color channel.

  • registration_dictdict

    Registration dictionary for frames. If None, uses the stored registration_dict (if one exists).

  • return_framewisebool

    If True, returns a flat array of all frames, rather than summing across timepoints.

  • flim_methodUnion[str, FlimMethod]

    The method to use for the FLIM analysis. Default is ‘empirical’. Options are any of the FlimMethod enum values (siffpy.siffmath.flim.FlimMethod).

  • unitsFlimUnitsLike

    The units to return the FLIM data in. Default is ‘nanoseconds’.

# Returns

  • FlimTrace

    TODO :DOCUMENT

# Example

TODO ```python

from siffpy import SiffReader reader = SiffReader(‘example.siff’)

```

t_axis(timepoint_start: int = 0, timepoint_end: int | None = None, reference_z: int = 0, reference_time: str = 'experiment') ndarray

Returns the time-stamps of frames. By default, returns the time stamps of all frames relative to acquisition start.

# Arguments

  • timepoint_start (optional, int):

    Index of time point to start at. Note this is in units of TIMEPOINTS so this goes by step sizes of num_slices * num_colors! If no argument is given, this is treated as 0

  • timepoint_end (optional, int):

    Index of time point to end at. Note Note this is in units of TIMEPOINTS so this goes by step sizes of num_slices * num_colors! If no argument is given, this is the end of the file.

  • reference_z (optional, int):

    Picks the timepoint of a single slice in a z stack and only returns that corresponding value. Means nothing if imaging is a single plane. If no argument is given, assumes the first slice

  • reference_time (optional, str):

    Referenced to start of the experiment, or referenced to epoch time.

    Possible values:

    experiment - referenced to experiment epoch - referenced to epoch

# Returns

  • timepoints (1-d ndarray):

    Time point of the requested frames, relative to beginning of the image acquisition. Size will be:

    (timepoint_end - timepoint_start)*num_slices

    unless reference_z is used.

# See also

  • SiffReader.get_time to get the time of individual frames

# Examples

```python from siffpy import SiffReader reader = SiffReader(‘example.siff’)

# The data corresponds to a volume acquisition print( reader.im_params.array_shape ) >> (6736, 6, 2, 256, 128)

# Get the time of the first frame of the first 10 volumes print( reader.t_axis(timepoint_end = 10) ) >> Timeseries([0.401724, 0.515611, 0.629499, 0.743387, 0.857274, 0.971162,

1.085049, 1.198924, 1.312812, 1.426699])

# Get the time of the 3rd frame of the first 10 volumes print( reader.t_axis(timepoint_end = 10, reference_z = 2) ) >> Timeseries([0.434267, 0.548154, 0.662042, 0.77593 , 0.889817, 1.003692,

1.11758 , 1.231467, 1.345355, 1.459242])

# Get the time in epoch time of the first 10 volumes print( reader.t_axis(timepoint_end = 10, reference_time = ‘epoch’) ) >> Timeseries([1716839309449385700, 1716839309530065982, 1716839309610746972,

1716839309691427962, 1716839309772108244, 1716839309852789234, 1716839309933469516, 1716839310014141297, 1716839310094822287, 1716839310175502568], dtype=uint64)

```

property time_zero: int

Returns the time zero of the experiment in epoch time