Normalized FlatField

The FlatField class is responsible for storing the flatfield correction factors. It provides methods to read and create normalized flatfields.

Note

The method read_module_parameters_from_file expects a text file in the format below. Each line denotes the DG parameters for each module.

module 0 center  643.320033188550 +- 0.0000 conversion 0.657661167459868E-04 +- 0.0000 offset  0.00000000000000     +- 0.0000
module 1 center  633.044070300816 +- 0.0000 conversion 0.657618957538105E-04 +- 0.0000 offset  5.00486981153634     +- 0.0000

If youre file format deviates from the above format implement your custom file reader inheriting from the class SimpleFileInterface (SimpleFileInterface) and pass it to the function.

Note

The method read_bad_channels_from_file expects a text file using the format below. Each line denotes the index of a bad channel. Consecutive bad channels can be stored on one line e.g. channels with 20-42 are bad channels.

1
2
20-42
100
1002-1004

If youre file format deviates from the above format implement your custom file reader inheriting from the class SimpleFileInterface (SimpleFileInterface) and pass it to the function.

class FlatField

Public Functions

FlatField(std::shared_ptr<MythenDetector> mythen_detector_)

Constructor for FlatField class.

Parameters:

mythen_detector_ – ptr to MythenDetector storing all mythen specific parameters

void set_scale_factor(const double scale_factor_)

set scale factor to scale incident intensity to reasonable values e.g. can be set to incident intensity of first acquisition

double get_scale_factor() const

get scale factor

void set_soft_window(const std::pair<double, double> soft_window_)

set soft window bounds [degrees] to exclude strips with lower exposure.

std::pair<double, double> get_soft_window() const

get soft window bounds [degrees]

void add_flatfield(const NDView<uint32_t, 1> photon_counts, const uint32_t incident_intensity, const double detector_angle)

adds flatfield from single acquisition to the accumulated flatfield

Parameters:
  • photon_counts – photon counts for each strip

  • incident_intensity – incident intensity for normalization

  • detector_angle – position of detector [degrees]

void normalize_flatfield()

normalizes the accumulated flatfield

void read_normalized_flatfield_from_file(const std::string &filename, const std::shared_ptr<SimpleFileInterface> file_reader = std::make_shared<CustomFlatFieldFile>())

read normalized flatfield and std from file

Parameters:
  • filename – name of file

  • file_reader – custom file_reader to read flatfield file default: ascii file with

void read_bad_channels_from_file(const std::filesystem::path &filename, const std::shared_ptr<SimpleFileInterface> file_reader = std::make_shared<CustomBadChannelsFile>())

reads bad channels from file

Parameters:
  • filename – bad channels filename

  • file_reader – file_reader to read bad channels file (default: CustomBadChannelsFile: following format line by line either single strip index or block of strip indices seperated by ‘-’ e.g. 0-10)

void set_bad_channels(const NDArray<bool, 1> &bad_channels_)
NDArray<bool, 1> get_bad_channels() const
void set_normalized_flatfield(const NDArray<double, 2> &flat_field_)

set flatfield from NDArray

void set_normalized_flatfield(NDArray<double, 2> &&flat_field_)
NDArray<double, 2> get_normalized_flatfield() const
NDView<const double, 2> get_normalized_flatfield_view() const

Private Members

double scale_factor = {1.0}

scale_factor is used to scale incident intensity to ~ one

std::shared_ptr<MythenDetector> mythen_detector

detector specifications of Mythen detector

NDArray<double, 2> flat_field

normalized flatfield stored as 2D array of shape (num_strips, 2) where the two values are normalized flatfield value and standard deviation value sof -1.0 denote strips which are not covered by any flatfield acquisition or are marked as bad.

NDArray<bool, 1> bad_channels = {}

boolean array of size of total number of strips/channels in detector, stores ‘TRUE’ if strip is a bad channel otherwise ‘FALSE’

std::pair<double, double> soft_window = {3.0, 34.0}

soft window bounds [degrees] to exclude strips with lower exposure.