nabu.preproc.double_flatfield module

class nabu.preproc.double_flatfield.DoubleFlatField(shape, result_url=None, sub_region=None, detector_corrector=None, input_is_mlog=True, output_is_mlog=False, average_is_on_log=False, sigma_filter=None, filter_mode='reflect')[source]

Bases: object

Init double flat field by summing a series of urls and considering the same subregion of them.

Parameters:
  • shape (tuple) – Expected shape of radios chunk to process

  • result_url (url, optional) – where the double-flatfield is stored after being computed, and possibly read (instead of re-computed) before processing the images.

  • sub_region (tuple, optional) – If provided, this must be a tuple in the form (start_x, end_x, start_y, end_y). Each image will be cropped to this region. This is used to specify a chunk of files. Each of the parameters can be None, in this case the default start and end are taken in each dimension.

  • input_is_mlog (boolean, default True) – the input is considred as minus logarithm of normalised radios

  • output_is_mlog (boolean, default True) – the output is considred as minus logarithm of normalised radios

  • average_is_on_log (boolean, False) – the minus logarithm of the data is averaged the clipping value that is applied prior to the logarithm

  • sigma_filter (optional) – if given a high pass filter is applied by signal -gaussian_filter(signal,sigma,filter_mode)

  • filter_mode (optional, default 'reflect') – the padding scheme applied a the borders ( same as scipy.ndimage.filtrs.gaussian_filter)

compute_double_flatfield(radios, recompute=False)[source]

Read the radios and generate the “double flat field” by averaging and possibly other processing.

Parameters:
  • radios (array) – Input radios chunk.

  • recompute (bool, optional) – Whether to recompute the double flatfield if already computed.

get_double_flatfield(radios=None, compute=False)[source]

Get the double flat field or a subregion of it.

Parameters:
  • radios (array, optional) – Input radios chunk

  • compute (bool, optional) – Whether to compute the double flatfield anyway even if a dump file exists.

apply_double_flatfield(radios)[source]

Apply the “double flatfield” filter on a chunk of radios. The processing is done in-place !