#include <cstdint>
#include <string>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <vector>
#include <cstdio>
#include <map>
#include <array>
#include <memory>
#include <stdlib.h>
#include <numeric>
#include <cinttypes>
#include <fstream>
#include <boost/bimap.hpp>
#include "Histogram.h"
#include "TTTRHeader.h"
#include "TTTRMask.h"
#include "TTTRRecordReader.h"
#include "TTTRRecordTypes.h"
#include "info.h"
Go to the source code of this file.
|
void | selection_by_count_rate (int **output, int *n_output, unsigned long long *time, int n_time, double time_window, int n_ph_max, double macro_time_calibration=1.0, bool invert=false, bool make_mask=false) |
| A count rate (cr) filter that returns an array containing a list of indices where the cr was smaller than a specified cr.
|
|
void | ranges_by_time_window (int **output, int *n_output, unsigned long long *input, int n_input, double minimum_window_length, double maximum_window_length=-1, int minimum_number_of_photons_in_time_window=-1, int maximum_number_of_photons_in_time_window=-1, double macro_time_calibration=1.0, bool invert=false) |
| Returns time windows (tw), i.e., the start and stop indices for a minimum tw size and a minimum number of photons in a tw.
|
|
void | compute_intensity_trace (int **output, int *n_output, unsigned long long *input, int n_input, double time_window_length, double macro_time_resolution=1.0) |
| Computes the intensity trace for a sequence of time events.
|
|
template<typename T > |
void | get_array (size_t n_valid_events, T *array, T **out, int *n_out) |
| Extracts a subarray of valid events from the input array.
|
|
◆ _CRT_SECURE_NO_DEPRECATE
#define _CRT_SECURE_NO_DEPRECATE |
◆ TTTRLIB_TTTR_H
◆ compute_intensity_trace()
void compute_intensity_trace |
( |
int ** | output, |
|
|
int * | n_output, |
|
|
unsigned long long * | input, |
|
|
int | n_input, |
|
|
double | time_window_length, |
|
|
double | macro_time_resolution = 1.0 ) |
Computes the intensity trace for a sequence of time events.
The intensity trace is calculated by partitioning the time events into time windows with a minimum specified length and counting the number of photons in each window.
- Parameters
-
output | Pointer to an array storing the number of photons in each time window. |
n_output | Pointer to the variable storing the number of time windows. |
input | Array of time points representing the time events. |
n_input | Number of time points in the input array. |
time_window_length | Size of the time window in units of the macro time resolution. |
macro_time_resolution | The resolution of the macro time clock (default is 1.0). |
The function calculates the intensity trace by dividing the time events into non-overlapping time windows of the specified length. The output array holds the count of photons in each time window, and n_output is updated accordingly. The input array contains the time points of events, and n_input is the total number of events. The time_window_length parameter defines the size of the time windows, and macro_time_resolution specifies the resolution of the macro time clock (default is 1.0). The calculated intensity trace is stored in the output array, and the total number of time windows is updated in n_output.
◆ get_array()
template<typename T >
void get_array |
( |
size_t | n_valid_events, |
|
|
T * | array, |
|
|
T ** | out, |
|
|
int * | n_out ) |
|
inline |
Extracts a subarray of valid events from the input array.
This function takes an array of type T, representing events, and extracts a subarray containing the first n_valid_events
elements. The size of the output array is updated in n_out
. Memory is allocated for the output array, and the caller is responsible for freeing this memory when it is no longer needed.
- Template Parameters
-
T | The data type of the array elements. |
- Parameters
-
| n_valid_events | Number of valid events to extract. |
| array | Pointer to the input array containing events of type T. |
[out] | out | Pointer to the output array holding the extracted subarray. |
[out] | n_out | Pointer to the variable storing the size of the output array. |
The function allocates memory for the output array and copies the first n_valid_events
elements from the input array. The size of the output array is updated in n_out
. It is the responsibility of the caller to free the allocated memory using free(*out)
when the output array is no longer needed.
- Parameters
-
[in] | n_valid_events | Number of valid events to extract. |
[in] | array | Pointer to the input array containing events of type T. |
[out] | out | Pointer to the output array holding the extracted subarray. |
[out] | n_out | Pointer to the variable storing the size of the output array. |
◆ ranges_by_time_window()
void ranges_by_time_window |
( |
int ** | output, |
|
|
int * | n_output, |
|
|
unsigned long long * | input, |
|
|
int | n_input, |
|
|
double | minimum_window_length, |
|
|
double | maximum_window_length = -1, |
|
|
int | minimum_number_of_photons_in_time_window = -1, |
|
|
int | maximum_number_of_photons_in_time_window = -1, |
|
|
double | macro_time_calibration = 1.0, |
|
|
bool | invert = false ) |
Returns time windows (tw), i.e., the start and stop indices for a minimum tw size and a minimum number of photons in a tw.
- Parameters
-
output | [out] Array containing the interleaved start and stop indices of the time windows in the TTTR object. |
n_output | [out] Length of the output array. |
input | [in] Array containing the macro times. |
n_input | [in] Number of macro times. |
minimum_window_length | [in] Minimum length of a time window (mandatory). |
maximum_window_length | [in] Maximum length of a time window (optional). |
minimum_number_of_photons_in_time_window | [in] Minimum number of photons a selected time window must contain (optional). |
maximum_number_of_photons_in_time_window | [in] Maximum number of photons a selected time window can contain (optional). |
macro_time_calibration | [in] Calibration factor for macro times (default is 1.0). |
invert | [in] If set to true, the selection criteria are inverted. |
◆ selection_by_count_rate()
void selection_by_count_rate |
( |
int ** | output, |
|
|
int * | n_output, |
|
|
unsigned long long * | time, |
|
|
int | n_time, |
|
|
double | time_window, |
|
|
int | n_ph_max, |
|
|
double | macro_time_calibration = 1.0, |
|
|
bool | invert = false, |
|
|
bool | make_mask = false ) |
A count rate (cr) filter that returns an array containing a list of indices where the cr was smaller than a specified cr.
The filter is applied to a series of consecutive time events. The time events are sliced into time windows tw) which have at least a duration as specified by time_window. The tttr indices of the time windows are written to the output parameter output. Moreover, for every tw the number of photons is determined. If in a tw the number of photons exceeds n_ph_max and invert is false (default) the tw is not written to output. If If in a tw the number of photons is less then n_ph_max and invert is true the tw is not written to output.
- Parameters
-
output | output array |
n_output | number of elements in output array |
time | array of times |
n_time | number of times |
time_window | length of the time window |
n_ph_max | maximum number of photons in a time window |
macro_time_calibration | |
invert | if invert is true (default false) only indices where the number |
make_mask | if true (default false) returns array filled with -1 or idx of length n_time of photons exceeds n_ph_max are selected |