# API - navarp.utils

## fermilevel

This module is part of the Python NavARP library. It defines the functions for extracting the Fermi level energy.

navarp.utils.fermilevel.align_fermi_index(efermis, energies, data)

  Align each detector image to the fermi level.

  Parameters:

    - energies (ndarray) – Energy axis of the analyzer data;

    - scans (ndarray) – Scan axis of the data acquisition;

    - data0 (ndarray) – The matrix composed by the detector images, the matrix must be ordered as data[scans, angles, energies];

  Returns:

    - energies_algn (ndarray): Unified energy axis for data;

    - data_algn (ndarray): Each detector image aligned to the same fermi level.

  Return type:

    (tuple)

navarp.utils.fermilevel.align_to_same_eb(efermis, energies, data)

  Align each detector image to the same binding energy axis from efermis.

  Parameters:

    - efermis (float) – The fermi level values for each detector image;

    - energies (ndarray) – Energy axis of the analyzer data;

    - data (ndarray) – The matrix composed by the detector images, the matrix must be ordered as data[scans, angles, energies];

  Returns:

    - e_bins (ndarray): Unified binding energy axis;

    - energies_algn (ndarray): Each kinetic energy axis aligned to e_bins;

    - data_algn (ndarray): Each detector image are aligned to e_bins.

  Return type:

    (tuple)

navarp.utils.fermilevel.fermi_fun(ekin, efermi, sigma, amp, slope, intercet)

navarp.utils.fermilevel.fit_efermi(energies, data_sum, energy_range=None)

  Find fermi level using logaritmic derivative and then fit

  Parameters:

    - energies (ndarray) – Energy axis of the analyzer data;

    - data_sum (ndarray) – The integrated 1-Dim data to fit;

    - energy_range (ndarray) – Energy range where to find fermi level [min, max];

  Returns:

    Optimal values for the parameters so that the sum of

      the squared residuals of fermi_fun - integrated data is minimized.

  Return type:

    pout (ndarray)

## isocut

This module is part of the Python NavARP library. It defines the functions for the extraction of the iso-value map (maps_sum) and lines (lines_sum).

navarp.utils.isocut.lines_sum(value, delta, array, matrix, axis=None, return_counts=False)

  Sum of lines over a given axis in range value-delta:value+delta

  Parameters:

    - value (float) – The center of the interval;

    - delta (float) – The range is value-delta:value+delta;

    - array (ndarray) – The 1D-array where to find the indexes;

    - matrix (ndarray) – The 2D-matrix to be integrated along the range;

    - axis (None or int, optional) – Matrix axis along which sum is performed;

    - return_counts (bool, optional) – If True, also return the number of integrated elements.

  Returns:

    - isocut_sum (ndarray): 1D-array integrated between value-delta:value+delta;

    - num_ind (int, optional): number of integrated elements.

  Return type:

    (tuple)

navarp.utils.isocut.maps_sum(value, delta, array, matrix, axis=None, return_counts=False)

  Sum of matrix over a given axis in range value-delta:value+delta

  Parameters:

    - value (float) – The center of the interval;

    - delta (float) – The range is value-delta:value+delta;

    - array (ndarray) – The 1D-array where to find the indexes;

    - matrix (ndarray) – The 3D-matrix to be integrated along the range;

    - axis (None or int, optional) – Matrix axis along which sum is performed;

    - return_counts (bool, optional) – If True, also return the number of intergrated elements.

  Returns:

    - isocut_sum (ndarray): 2D-matrix integrated between value-delta:value+delta;

    - num_ind (int, optional): number of integrated elements.

  Return type:

    (tuple)

## isomclass

This module is part of the Python NavARP library. It defines the isomap class which are extracted from a NavEntry.

class navarp.utils.isomclass.IsoAngle(entry, angle, dangle=0, norm_mode='no', sigma=None, order=2, curvature=None, kbins=None)

  Bases: `object`

  Sum of entry.data over the angle axis in [angle-dangle, angle+dangle].

  Parameters:

    - entry (NavEntry class) – The class for the data explored by NavARP;

    - angle (float) – Angular value on the;

    - dangle (float) – Delta angular value;

    - norm_mode (string, optional, default='no') – if ‘no’, no normalization; if ‘each’, every Slice is normalized by the integral intensity of each Slice over their 90% of axis range; if “all”, the overall z values are normalize to its min and max;

    - sigma (array, optional, default=None) – Standard deviation for Gaussian kernel. The standard deviations of the Gaussian filter are given for each axis as a sequence, or as a single number, in which case it is equal for all axes;

    - order (integer, optional, default=2) – The order of the filter along each axis is given as a sequence of integers, or as a single number. An order of 0 corresponds to convolution with a Gaussian kernel. A positive order corresponds to convolution with that derivative of a Gaussian. For example, an order of 2 corresponds to convolution with that second derivative of a Gaussian;

    - curvature (integer, optional, default=None) – if not None the data are the curvature of the signal.

  angle

    Angular value on the;

    Type:

      float

  dangle

    Delta angular value;

    Type:

      float

  data

    The matrix composed by the detector images;

    Type:

      ndarray

  data_init

    The matrix composed by the detector images without any normalization;

    Type:

      ndarray

  ebins

    Binding energy axis;

    Type:

      ndarray

  efermi

    Fermi level kinetic energy (or energies);

    Type:

      ndarray

  ekins

    Kinetic energy axis of the analyzer;

    Type:

      ndarray

  hv

    Photon energy without any reshape, it is present only in the case of hv scan;

    Type:

      ndarray

  scan_type

    Acquisition method;

    Type:

      str

  scans

    Scan axis of the acquisition method.

    Type:

      ndarray

  dataprocessing(norm_mode='no', sigma=None, order=2, curvature=None)

    Use data post-processing procedure.

    Parameters:

      - norm_mode (string, optional, default='no') – if ‘no’, no normalization; if ‘each’, every Slice is normalized by the integral intensity of each Slice over their 90% of axis range; if ‘all’, the overall z values are normalize to its min and max;

      - sigma (array, optional, default=None) – Standard deviation for Gaussian kernel. The standard deviations of the Gaussian filter are given for each axis as a sequence, or as a single number, in which case it is equal for all axes;

      - order (integer, optional, default=2) – The order of the filter along each axis is given as a sequence of integers, or as a single number. An order of 0 corresponds to convolution with a Gaussian kernel. A positive order corresponds to convolution with that derivative of a Gaussian. For example, an order of 2 corresponds to convolution with that second derivative of a Gaussian;

      - curvature (integer, optional, default=None) – if not None the data are the curvature of the signal.

  show(xname='auto', yname='auto', cmap='magma_r', ax=None, z_range=None, style=None, print_out=False, cmapscale='linear')

    Plot the isomap.

    Parameters:

      - xname (string, optional, auto/phi/hv) – Select the x variable;

      - yname (string, optional, auto/eef/ekin) – Select the y variable;

      - cmap (string, optional) – Colormap;

      - ax (matplotlib.axes, optional) – Axes, if None it is created inside the function;

      - z_range (array, optional, [min, max]) – Extreme values for z scale;

      - style (string, optional) – See navplt.give_style function;

      - print_out (boolean, optional) – If True, print the axes dimension with them adaptations;

      - cmapscale (string, optional, linear/log/power) – Select the scale mode.

    Returns:

      The returned value is the object matplotlib.collections.QuadMesh

        from ax.pcolormesh.

class navarp.utils.isomclass.IsoEnergy(entry, ebin, debin=0, norm_mode='no', sigma=None, order=2, curvature=None, kbins=None)

  Bases: `object`

  Sum of entry.data over the ebin axis within [ebin-debin, ebin+debin].

  Parameters:

    - entry (NavEntry class) – The class for the data explored by NavARP;

    - ebin (float) – Binding energy value;

    - debin (float) – Delta binding energy value;

    - norm_mode (string, optional, default='no') – if ‘no’, no normalization; if ‘each’, every Slice is normalized by the integral intensity of each Slice over their 90% of axis range; if “all”, the overall z values are normalize to its min and max;

    - sigma (array, optional, default=None) – Standard deviation for Gaussian kernel. The standard deviations of the Gaussian filter are given for each axis as a sequence, or as a single number, in which case it is equal for all axes;

    - order (integer, optional, default=2) – The order of the filter along each axis is given as a sequence of integers, or as a single number. An order of 0 corresponds to convolution with a Gaussian kernel. A positive order corresponds to convolution with that derivative of a Gaussian. For example, an order of 2 corresponds to convolution with that second derivative of a Gaussian;

    - curvature (integer, optional, default=None) – if not None the data are the curvature of the signal;

    - kbins (array, optional, default=None) – if not None the data are interpolated on a uniform k-array binned with the kbins number.

  angles

    Angular axis of the analyzer;

    Type:

      ndarray

  data

    The matrix composed by the detector images;

    Type:

      ndarray

  data_init

    The matrix composed by the detector images without any normalization;

    Type:

      ndarray

  debin

    Delta binding energy value;

    Type:

      float

  ebin

    Binding energy value;

    Type:

      ndarray

  hv

    Photon energy without any reshape, it is present only in the case of hv scan;

    Type:

      ndarray

  ks

    k vector along the direction consistent with the scan axis;

    Type:

      ndarray

  kx

    k vector along the slit;

    Type:

      ndarray

  scan_type

    Acquisition method;

    Type:

      str

  scans

    Scan axis of the acquisition method.

    Type:

      ndarray

  dataprocessing(norm_mode='no', sigma=None, order=2, curvature=None, kbins=None)

    Apply data post-processing procedure.

    Parameters:

      - norm_mode (string, optional, default='no') – if ‘no’, no normalization; if ‘each’, every Slice is normalized by the integral intensity of each Slice over their 90% of axis range; if ‘all’, the overall z values are normalize to its min and max;

      - sigma (array, optional, default=None) – Standard deviation for Gaussian kernel. The standard deviations of the Gaussian filter are given for each axis as a sequence, or as a single number, in which case it is equal for all axes;

      - order (integer, optional, default=2) – The order of the filter along each axis is given as a sequence of integers, or as a single number. An order of 0 corresponds to convolution with a Gaussian kernel. A positive order corresponds to convolution with that derivative of a Gaussian. For example, an order of 2 corresponds to convolution with that second derivative of a Gaussian;

      - curvature (float, optional, default=None) – if not None the data are the curvature of the signal, only in 1-dimension, meaning only for sigma with one value;

      - kbins (array, optional, default=None) – if not None, the data are interpolated on a uniform k-array binned following the [kxbins, kybins] numbers; kbins must be an array of two integer [kxbins, kybins] not equal; if from the input kxbins == kybins then kybins = kybins + 1 to make it different from kxbins (this is necessary due to how the code recognize the element order and placement in the data matrix).

  export_as_hdf5(file_path, xname='auto', yname='auto', title='NavARP_isoenergy')

    Save the isomap as hdf5 format.

    Parameters:

      - xname (string, optional, auto/tht/kx) – Select the x variable;

      - yname (string, optional, auto/eef/ekin) – Select the y variable;

      - title (string, optiona) – data title.

  export_as_itx(file_path, xname='auto', yname='auto', wave_name='NavARP_isoenergy')

    Save the isomap as Igor Pro Text file.

    Parameters:

      - xname (string, optional, auto/tht/kx) – Select the x variable;

      - yname (string, optional, auto/eef/ekin) – Select the y variable;

      - wave_name (string, optiona) – name of the wave.

  export_as_nxs(file_path, xname='auto', yname='auto', title='NavARP_isoenergy')

    Save the isomap as NXdata nexus class.

    Parameters:

      - xname (string, optional, auto/tht/kx) – Select the x variable;

      - yname (string, optional, auto/eef/ekin) – Select the y variable;

      - title (string, optiona) – data title.

  get_axs_and_data(xname='auto', yname='auto')

    Return the data and relative axes.

    Parameters:

      - xname (string, optional, auto/tht/kx) – Select the x variable;

      - yname (string, optional, auto/eef/ekin) – Select the y variable.

    Returns:

      xax, yax, data, xname, yname

  show(xname='auto', yname='auto', cmap='magma_r', ax=None, z_range=None, style=None, print_out=False, cmapscale='linear', rotate=None)

    Plot the isomap.

    Parameters:

      - xname (string, optional, auto/tht/kx) – Select the x variable;

      - yname (string, optional, auto/phi/hv/ky/kz) – Select the y variable;

      - cmap (string, optional) – Colormap;

      - ax (matplotlib.axes, optional) – Axes, if None it is created inside the function;

      - z_range (array, optional, [min, max]) – Extreme values for z scale;

      - style (string, optional) – See navplt.give_style function;

      - print_out (boolean, optional) – If True, print the axes dimension with them adaptations;

      - cmapscale (string, optional, linear/log/power) – Select the scale mode;

      - rotate (float, optional) – angle in degrees for a counter clockwise rotation of the shown isoenergy.

    Returns:

      The returned value is the object matplotlib.collections.QuadMesh

        from ax.pcolormesh.

class navarp.utils.isomclass.IsoK(entry, kx_pts, ky_pts, klabels=None, ebins_interp=None, kbins=None, mask_once=True, norm_mode='no', sigma=None, order=2, curvature=None)

  Bases: `object`

  Interpolate the entry.data along specified k-points.

  Parameters:

    - entry (NavEntry class) – the class for the data explored by NavARP;

    - kx_pts (ndarray) – kx coordinate of the points defining the path;

    - ky_pts (ndarray) – ky coordinate of the points defining the path;

    - klabels (list of string, optional) – list of the labels for each point in the kspace;

    - ebins_interp (ndarray, optional) – The binding energies vector to sample the entry.data at, if None then it is entry.ebins;

    - kbins (int, optional) – defines the number of equal-width bins in the given path, if None then it is calculated from kx;

    - mask_once (boolean, optional) – If True, the region (mask), where the interpolation function is going to be defined (the smaller the faster is the interpolation procedure), is generated once and used in all the ebins_interp range;

    - norm_mode (string, optional, default='no') – if ‘no’, no normalization; if ‘each’, every Slice is normalized by the integral intensity of each Slice over their 90% of axis range; if “all”, the overall z values are normalize to its min and max;

    - sigma (array, optional, default=None) – Standard deviation for Gaussian kernel. The standard deviations of the Gaussian filter are given for each axis as a sequence, or as a single number, in which case it is equal for all axes;

    - order (integer, optional, default=2) – The order of the filter along each axis is given as a sequence of integers, or as a single number. An order of 0 corresponds to convolution with a Gaussian kernel. A positive order corresponds to convolution with that derivative of a Gaussian. For example, an order of 2 corresponds to convolution with that second derivative of a Gaussian;

    - curvature (float, optional, default=None) – if not None the data are the curvature of the signal, only in 1-dimension, meaning only for sigma with one value.

  data_init

    The matrix composed by interpolated values along the path without any normalization;

    Type:

      ndarray

  data

    The matrix composed by interpolated values along the path with the normalization;

    Type:

      ndarray

  ebins

    Binding energy axis;

    Type:

      ndarray

  efermi

    Fermi level kinetic energy (or energies);

    Type:

      ndarray

  ekins

    Kinetic energy axis of the analyzer (defined only if scan is not on the photon energy);

    Type:

      ndarray

  hv

    Photon energy without any reshape, it is present only in the case of hv scan;

    Type:

      ndarray

  krho

    the distance vector from the first point;

    Type:

      ndarray

  kxy_interp

    the (kx, ky) points along the path;

    Type:

      ndarray

  kx_pts

    kx coordinate of the points defining the path;

    Type:

      ndarray

  ky_pts

    ky coordinate of the points defining the path;

    Type:

      ndarray

  klabels

    Array of the labels for each k_ptys_xy;

    Type:

      list of string

  k_pts_bin

    the index values defining the segments along the path;

    Type:

      ndarray of int

  scan_type

    Acquisition method.

    Type:

      str

  dataprocessing(norm_mode='no', sigma=None, order=2, curvature=None)

    Use data post-processing procedure.

    Parameters:

      - norm_mode (string, optional, default='no') – if ‘no’, no normalization; if ‘each’, every Slice is normalized by the integral intensity of each Slice over their 90% of axis range; if ‘all’, the overall z values are normalize to its min and max;

      - sigma (array, optional, default=None) – Standard deviation for Gaussian kernel. The standard deviations of the Gaussian filter are given for each axis as a sequence, or as a single number, in which case it is equal for all axes;

      - order (integer, optional, default=2) – The order of the filter along each axis is given as a sequence of integers, or as a single number. An order of 0 corresponds to convolution with a Gaussian kernel. A positive order corresponds to convolution with that derivative of a Gaussian. For example, an order of 2 corresponds to convolution with that second derivative of a Gaussian;

      - curvature (integer, optional, default=None) – if not None the data are the curvature of the signal.

  export_as_itx(file_path, yname='auto', wave_name='NavARP_isok')

    Save the isomap as Igor Pro Text file.

    Parameters:

      - xname (string, optional, auto/tht/kx) – Select the x variable;

      - yname (string, optional, auto/eef/ekin) – Select the y variable;

      - wave_name (string, optiona) – name of the wave.

  export_as_nxs(file_path, yname='auto', title='NavARP_isok')

    Save the isomap as NXdata nexus class.

    Parameters:

      - yname (string, optional, auto/eef/ekin) – Select the y variable;

      - title (string, optiona) – data title.

  get_yax(yname='auto')

    Return the selected y axis.

    Parameters:

      yname (string, optional, auto/eef/ekin) – Select the y variable.

    Returns:

      yax, yname

  path_show(ax=None, lc='k', textcolor='r', textsize=14, xytext=(8, 5))

    Plot the path.

    Parameters:

      - ax (matplotlib.axes, optional) – Axes, if None it is created inside the function;

      - lc (string, optional) – line color;

      - textcolor (string, optional) – text color of the labels;

      - textsize (string, optional) – text size of the labels;

      - xytext (array, optional) – relative text position of the labels.

  show(yname='auto', cmap='magma_r', ax=None, z_range=None, style=None, print_out=False, cmapscale='linear', vln=True, lc='k', ls='-', lw=1)

    Plot the isomap.

    Parameters:

      - yname (string, optional, auto/eef/ekin) – Select the y variable;

      - cmap (string, optional) – Colormap;

      - ax (matplotlib.axes, optional) – Axes, if None it is created inside the function;

      - z_range (array, optional, [min, max]) – Extreme values for z scale;

      - style (string, optional) – See navplt.give_style function;

      - print_out (boolean, optional) – If True, print the axes dimension with them adaptations;

      - cmapscale (string, optional, linear/log/power) – Select the scale mode.

    Returns:

      The returned value is the object matplotlib.collections.QuadMesh

        from ax.pcolormesh.

class navarp.utils.isomclass.IsoScan(entry, scan, dscan=0, norm_mode='no', sigma=None, order=2, curvature=None, kbins=None)

  Bases: `object`

  Sum of entry.data over the scan axis within [scan-dscan, scan+dscan].

  Parameters:

    - entry (NavEntry class) – The class for the data explored by NavARP;

    - scan (float) – scan value;

    - dscan (float) – delta scan value;

    - norm_mode (string, optional, default='no') – if ‘no’, no normalization; if ‘each’, every Slice is normalized by the integral intensity of each Slice over their 90% of axis range; if “all”, the overall z values are normalize to its min and max;

    - sigma (array, optional, default=None) – Standard deviation for Gaussian kernel. The standard deviations of the Gaussian filter are given for each axis as a sequence, or as a single number, in which case it is equal for all axes;

    - order (integer, optional, default=2) – The order of the filter along each axis is given as a sequence of integers, or as a single number. An order of 0 corresponds to convolution with a Gaussian kernel. A positive order corresponds to convolution with that derivative of a Gaussian. For example, an order of 2 corresponds to convolution with that second derivative of a Gaussian;

    - curvature (integer, optional, default=None) – if not None the data are the curvature of the signal;

    - kbins (integer, optional, default=None) – if not None the data are interpolated on a uniform k-array binned with the kbins number.

  angles

    Angular axis of the analyzer;

    Type:

      ndarray

  data

    The matrix composed by the detector images;

    Type:

      ndarray

  data_init

    The matrix composed by the detector images without any normalization;

    Type:

      ndarray

  dscan

    delta scan value;

    Type:

      float

  ebins

    Binding energy axis;

    Type:

      ndarray

  efermi

    Fermi level kinetic energy (or energies);

    Type:

      ndarray

  ekins

    Kinetic energy axis of the analyzer;

    Type:

      ndarray

  hv

    Photon energy without any reshape, it is present only in the case of hv scan;

    Type:

      ndarray

  scans

    scan value;

    Type:

      float

  kx

    k vector along the slit.

    Type:

      ndarray

  dataprocessing(norm_mode='no', sigma=None, order=2, curvature=None, kbins=None)

    Apply data post-processing procedure.

    Parameters:

      - norm_mode (string, optional, default='no') – if ‘no’, no normalization; if ‘each’, every Slice is normalized by the integral intensity of each Slice over their 90% of axis range; if ‘all’, the overall z values are normalize to its min and max;

      - sigma (array, optional, default=None) – Standard deviation for Gaussian kernel. The standard deviations of the Gaussian filter are given for each axis as a sequence, or as a single number, in which case it is equal for all axes;

      - order (integer, optional, default=2) – The order of the filter along each axis is given as a sequence of integers, or as a single number. An order of 0 corresponds to convolution with a Gaussian kernel. A positive order corresponds to convolution with that derivative of a Gaussian. For example, an order of 2 corresponds to convolution with that second derivative of a Gaussian;

      - curvature (float, optional, default=None) – if not None the data are the curvature of the signal, only in 1-dimension, meaning only for sigma with one value;

      - kbins (integer, optional, default=None) – if not None the data are interpolated on a uniform k-array binned with the kbins number.

  export_as_hdf5(file_path, xname='auto', yname='auto', title='NavARP_isoscan')

    Save the isomap as hdf5 format.

    Parameters:

      - xname (string, optional, auto/tht/kx) – Select the x variable;

      - yname (string, optional, auto/eef/ekin) – Select the y variable;

      - title (string, optiona) – data title.

  export_as_itx(file_path, xname='auto', yname='auto', wave_name='NavARP_isoscan')

    Save the isomap as Igor Pro Text file.

    Parameters:

      - xname (string, optional, auto/tht/kx) – Select the x variable;

      - yname (string, optional, auto/eef/ekin) – Select the y variable;

      - wave_name (string, optiona) – name of the wave.

  export_as_nxs(file_path, xname='auto', yname='auto', title='NavARP_isoscan')

    Save the isomap as NXdata nexus class.

    Parameters:

      - xname (string, optional, auto/tht/kx) – Select the x variable;

      - yname (string, optional, auto/eef/ekin) – Select the y variable;

      - title (string, optiona) – data title.

  get_axs_and_data(xname='auto', yname='auto')

    Return the data and relative axes.

    Parameters:

      - xname (string, optional, auto/tht/kx) – Select the x variable;

      - yname (string, optional, auto/eef/ekin) – Select the y variable.

    Returns:

      xax, yax, data, xname, yname

  show(xname='auto', yname='auto', cmap='magma_r', ax=None, z_range=None, style=None, print_out=False, cmapscale='linear')

    Plot the isomap.

    Parameters:

      - xname (string, optional, auto/tht/kx) – Select the x variable;

      - yname (string, optional, auto/eef/ekin) – Select the y variable;

      - cmap (string, optional) – Colormap;

      - ax (matplotlib.axes, optional) – Axes, if None it is created inside the function;

      - z_range (array, optional, [min, max]) – Extreme values for z scale;

      - style (string, optional) – See navplt.give_style function;

      - print_out (boolean, optional) – If True, print the axes dimension with them adaptations;

      - cmapscale (string, optional, linear/log/power) – Select the scale mode.

    Returns:

      The returned value is the object matplotlib.collections.QuadMesh

        from ax.pcolormesh.

navarp.utils.isomclass.postprocessing(data, sigma, order, curvature)

  Post-processing procedure on data.

## kinterp

This module is part of the Python NavARP library. It defines the functions for the interpolation the entry.data into uniform gridded k-space.

navarp.utils.kinterp.get_isoen(kxbins, kybins, kx, ky, isoen)

  Interpolate isoen on the generated uniform binned 2D-grid

  Parameters:

    - kxbins (int) – defines the number of equal-width bins in the given kx

    - kybins (int) – defines the number of equal-width bins in the given ky

    - kx (ndarray) – The kx vector where the isoen is defined;

    - ky (ndarray) – The ky vector where the isoen is defined;

    - isoen (ndarray) – The isoen map related to kx and ky.

  Returns:

    - kx_interp (ndarray): The kx vector where the isoen is sampled;

    - ky_interp (ndarray): The ky vector where the isoen is sampled;

    - isoen_interp (ndarray): The interpolated data at the uniform grid.

  Return type:

    (tuple)

navarp.utils.kinterp.get_isoen_from_kx_ky_interp(kx_interp, ky_interp, kx, ky, isoen)

  Interpolate isoen on the grid formed from kx_interp and ky_interp arrays

  Parameters:

    - kx_interp (ndarray) – The kx vector to sample the isoen at;

    - ky_interp (ndarray) – The ky vector to sample the isoen at;

    - kx (ndarray) – The kx vector where the isoen is defined;

    - ky (ndarray) – The ky vector where the isoen is defined;

    - isoen (ndarray) – The isoen map related to kx and ky.

  Returns:

    The interpolated data at the grid formed

      from kx_interp and ky_interp.

  Return type:

    isoen_interp (ndarray)

navarp.utils.kinterp.get_isoen_from_kxy_interp(kxy_interp, kx, ky, isoen, mask=array([], dtype=float64))

  Interpolate isoen defined in (kx, ky) into kxy_interp points

  Parameters:

    - kxy_interp (ndarray) – The (kx, ky) points to sample the isoen at;

    - kx (ndarray) – The kx vector where the isoen is defined;

    - ky (ndarray) – The ky vector where the isoen is defined;

    - isoen (ndarray) – The isoen map related to kx and ky;

    - mask (ndarray of booleans, optional) – It is the region where the interpolation function is going to be defined (the smaller the faster is the interpolation procedure).

  Returns:

    The interpolated data at kxy_interp points.

  Return type:

    isoen_interp (ndarray)

navarp.utils.kinterp.get_isok(entry, kx_pts, ky_pts, ebins_interp=None, kbins=None, mask_once=True)

  Interpolate entry.data along the k_pts_xy points path for ebins_interp

  Parameters:

    - entry (NavEntry class) – the class for the data explored by NavARP;

    - kx_pts (ndarray) – kx coordinate of the points defining the path;

    - ky_pts (ndarray) – ky coordinate of the points defining the path;

    - ebins_interp (ndarray) – The binding energies vector to sample the entry.data at;

    - kbins (int) – defines the number of equal-width bins in the given path;

    - mask_once (boolean, optional) – If True, the region (mask), where the interpolation function is going to be defined (the smaller the faster is the interpolation procedure), is generated once and used in all the ebins_interp range.

  Returns:

    - krho (ndarray): the distance vector from the first point;

    - kxy_interp (ndarray): the (kx, ky) points along the path;

    - ebins_interp (ndarray): The interpolated data along the path;

    - isok_interp (ndarray): The interpolated data along the path;

    - k_pts_bin (ndarray of int): the index values defining the segments along the path.

  Return type:

    (tuple)

navarp.utils.kinterp.get_isok_kxy_interp(k_pts_xy, kbins)

  Generate uniform binned 1D path passing througt the k_pts

  Parameters:

    - k_pts_xy (ndarray) – list of (kx, ky) points defining the path;

    - kbins (int) – defines the number of equal-width bins in the given path.

  Returns:

    - krho (ndarray): the distance vector from the first point;

    - kxy_all_interp (ndarray): the (kx, ky) points along the path;

    - k_pts_bin (ndarray of int): the index values defining the segments along the path.

  Return type:

    (tuple)

navarp.utils.kinterp.get_isok_mask(k_pts_xy, kx, ky)

  Generate the mask (boolean matrix) where to define the interp. function

  The mask is generated by defining a rectangle surrounding the each segment of the path. The points inside are inside the rectangles if the solution of the following linear system give the solution within 0 and 1:

  > ax = b with the condition of being 0<x<1

  The matrix “a” is composed by the two side of the rectangle (defined as the two points minus the origin) and b is point to be checked (minus the origin).

  Parameters:

    - k_pts_xy (ndarray) – list of (kx, ky) points defining the path:

    - kx (ndarray) – The kx vector where the isoen is defined;

    - ky (ndarray) – The ky vector where the isoen is defined.

  Returns:

    mask, it is the mask region where the

      interpolation function is going to be defined, the smaller the faster is the interpolation procedure.

  Return type:

    (ndarray of booleans)

navarp.utils.kinterp.get_isoscan(kx, energies, isoscan, kbins, kind='cubic', fill_value=nan, assume_sorted=True)

  Interpolate isoscan on the generated uniform binned k vector

  Parameters:

    - kx (ndarray) – The k vector where the isoscan is defined

    - energies (ndarray) – The energy vector where the isoscan is defined

    - isoscan (ndarray) – The isoscan map related to kx and energies

    - kbins (int) – defines the number of equal-width bins in the given vector

    - kind (str or int, optional) – Specifies the kind of interpolation as a string (‘linear’, ‘nearest’, ‘zero’, ‘slinear’, ‘quadratic’, ‘cubic’, ‘previous’, ‘next’, where ‘zero’, ‘slinear’, ‘quadratic’ and ‘cubic’ refer to a spline interpolation of zeroth, first, second or third order; ‘previous’ and ‘next’ simply return the previous or next value of the point) or as an integer specifying the order of the spline interpolator to use.

    - fill_value (array-like or “extrapolate”, optional) – if a ndarray (or float), this value will be used to fill in for requested points outside of the data range. If not provided, then the default is NaN. The array-like must broadcast properly to the dimensions of the non-interpolation axes. If a two-element tuple, then the first element is used as a fill value for x_new < x[0] and the second element is used for x_new > x[-1]. Anything that is not a 2-element tuple (e.g., list or ndarray, regardless of shape) is taken to be a single array-like argument meant to be used for both bounds as below, above = fill_value, fill_value. If “extrapolate”, then points outside the data range will be extrapolated.

    - assume_sorted (bool, optional) – If False, values of x can be in any order and they are sorted first. If True, x has to be an array of monotonically increasing values.

  Returns:

    - kx_interp (ndarray): The kx vector where the isoen is sampled;

    - isoen_interp (ndarray): The interpolated data at the uniform binned kx_interp vector.

  Return type:

    (tuple)

navarp.utils.kinterp.get_isoscan_from_kx_interp(kx_interp, kx, energies, isoscan, kind='nearest', fill_value=nan, assume_sorted=True)

  Interpolate isoscan on the k vector

  Parameters:

    - kx_interp (ndarray) – The k vector to sample the isoscan at

    - kx (ndarray) – The k vector where the isoscan is defined

    - energies (ndarray) – The energy vector where the isoscan is defined

    - isoscan (ndarray) – The isoscan map related to kx and energies

    - kind (str or int, optional) – Specifies the kind of interpolation as a string (‘linear’, ‘nearest’, ‘zero’, ‘slinear’, ‘quadratic’, ‘cubic’, ‘previous’, ‘next’, where ‘zero’, ‘slinear’, ‘quadratic’ and ‘cubic’ refer to a spline interpolation of zeroth, first, second or third order; ‘previous’ and ‘next’ simply return the previous or next value of the point) or as an integer specifying the order of the spline interpolator to use.

    - fill_value (array-like or “extrapolate”, optional) – if a ndarray (or float), this value will be used to fill in for requested points outside of the data range. If not provided, then the default is NaN. The array-like must broadcast properly to the dimensions of the non-interpolation axes. If a two-element tuple, then the first element is used as a fill value for x_new < x[0] and the second element is used for x_new > x[-1]. Anything that is not a 2-element tuple (e.g., list or ndarray, regardless of shape) is taken to be a single array-like argument meant to be used for both bounds as below, above = fill_value, fill_value. If “extrapolate”, then points outside the data range will be extrapolated.

    - assume_sorted (bool, optional) – If False, values of x can be in any order and they are sorted first. If True, x has to be an array of monotonically increasing values.

  Returns:

    The interpolated data at kx_interp and

      energies.

  Return type:

    isoen_interp (ndarray)

navarp.utils.kinterp.get_unique_isok_mask(ebins_interp, k_pts_xy, entry)

  Generate a unique mask (boolean matrix) for all the ebins_interp range

  Parameters:

    - ebins_interp (ndarray) – The binding energies vector to sample the entry.data at;

    - k_pts_xy (ndarray) – list of (kx, ky) points defining the path;

    - entry (NavEntry class) – the class for the data explored by NavARP.

  Returns:

    It is the region where the

      interpolation function is going to be defined (the smaller the faster is the interpolation procedure), for every energy.

  Return type:

    mask_final (ndarray of booleans)

## ktransf

This module is part of the Python NavARP library. It defines the functions for transforming the angular coordinates into the k-space.

navarp.utils.ktransf.asarray(variable)

  Transform variable as ndarray

  Parameters:

    variable (float, int, list, ndarray) – variable to transform

  Returns:

    variable transformed

  Return type:

    variable (ndarray)

navarp.utils.ktransf.get_hv_from_kxyz(e_bin_p, work_fun, inn_pot, k_along_slit_p, k_perp_slit_p, k_perp_sample_p, hv_p_init=30, p_hv=False, tht_ap=0, phi_ap=0, tht_an=None, phi_an=None)

  Calculates photon energy of a point from k-space coordinates

  Parameters:

    - e_bin_p (float) – Binding energy value of the point;

    - work_fun (float) – analyzer work function;

    - inn_pot (float) – Inner potential, corresponding to the energy of the bottom of the valence band referenced to vacuum level;

    - k_along_slit_p (float) – k vector value of the reference point, along the slit direction;

    - k_perp_slit_p (float) – k vector value of the reference point, perpendicular to the slit;

    - k_perp_sample_p (float) – k vector perpendicular to sample surface

    - hv_p_init (float) – Initial guess for the photon energy of the reference point;

    - p_hv (boolean, optional) – If True, add photon momentum;

    - tht_ap (float, optional) – angle between analyzer axis (a) and photons (p) along the plane of the slit (theta, so the name “tht_ap”), requested if p_hv==True;

    - phi_ap (float) – angle between analyzer axis (a) and photons (p) along the plane perpendicular to the slit (phi, so the name “phi_ap”);

    - tht_an (float) – angle between analyzer axis (a) and normal (n) to the surface along the plane of the slit (theta, so the name “tht_an”);

    - phi_an (float) – angle between analyzer axis (a) and normal (n) along the plane perpendicular to the slit (phi, so the name “phi_an”), this is the axis of the scan in the case of tilt rotation.

  Returns:

    Photon energy of the point;

  Return type:

    hv_p (float)

navarp.utils.ktransf.get_inn_pot_from_kxyz(e_kin_p, k_along_slit_p, k_perp_slit_p, k_perp_sample_p, inn_pot_init=10, p_hv=False, hv_p=None, tht_ap=0, phi_ap=0, tht_an=None, phi_an=None)

  Calculates photon energy of a point from k-space coordinates

  Parameters:

    - e_kin_p (float) – Kinetic energy value of the reference point;

    - inn_pot_init (float) – Initial guess for the inner potential, corresponding to the energy of the bottom of the valence band referenced to vacuum level;

    - k_along_slit_p (float) – k vector value of the reference point, along the slit direction;

    - k_perp_slit_p (float) – k vector value of the reference point, perpendicular to the slit;

    - k_perp_sample_p (float) – k vector perpendicular to sample surface

    - hv (ndarray) – Photon energies;

    - p_hv (boolean, optional) – If True, add photon momentum;

    - hv_p (float, optional) – Photon energy for the reference point, requested if p_hv==True;

    - tht_ap (float, optional) – angle between analyzer axis (a) and photons (p) along the plane of the slit (theta, so the name “tht_ap”), requested if p_hv==True;

    - phi_ap (float) – angle between analyzer axis (a) and photons (p) along the plane perpendicular to the slit (phi, so the name “phi_ap”);

    - tht_an (float) – angle between analyzer axis (a) and normal (n) to the surface along the plane of the slit (theta, so the name “tht_an”);

    - phi_an (float) – angle between analyzer axis (a) and normal (n) along the plane perpendicular to the slit (phi, so the name “phi_an”), this is the axis of the scan in the case of tilt rotation.

  Returns:

    Inner potential, corresponding to the energy of the

      bottom of the valence band referenced to vacuum level.

  Return type:

    inn_pot (float)

navarp.utils.ktransf.get_k_along_slit(e_kins, tht, tht_an, p_hv=False, hv=None, tht_ap=None)
  Calculates k vector along the slit, i.e. the intersection between the

    plane of analyzer axis and slit, and the plane of the sample surface.

  Parameters:

    - e_kins (ndarray) – Kinetic energies (usually it is the energy axis of the analyzer data);

    - tht (ndarray) – Angular axis of the analyzer data;

    - tht_an (float) – angle between analyzer axis (a) and normal (n) to the surface along the plane of the slit (theta, so the name “tht_an”);

    - p_hv (boolean, optional) – If True, add photon momentum;

    - hv (ndarray) – Photon energies;

    - tht_ap (float) – angle between analyzer axis (a) and photons (p) along the plane of the slit (theta, so the name “tht_ap”).

  Returns:

    k vector along the slit

  Return type:

    kx (ndarray)

navarp.utils.ktransf.get_k_isoen(entry, e_kin_val)

  Calculates k vectors of the iso-energy cut.

  Parameters:

    - entry (NavEntry class) – the class for the data explored by NavARP;

    - e_kin_val (float or ndarray) – Kinetic energy/ies of iso-energy cut.

navarp.utils.ktransf.get_k_perp_sample(e_kins, inn_pot, k_along_slit, k_perp_slit, p_hv=False, hv=None, tht_ap=None, phi_ap=None, tht_an=None, phi_an=None)

  Calculates k vector perpendicular to sample surface.

  Parameters:

    - e_kins (ndarray) – Kinetic energies (usually it is the energy axis of the analyzer data);

    - inn_pot (float) – Inner potential, corresponding to the energy of the bottom of the valence band referenced to vacuum level;

    - k_along_slit (ndarray) – k vector along the slit

    - k_perp_slit (ndarray) – k vector perpendicular to the slit

    - p_hv (boolean, optional) – If True, add photon momentum.

    - hv (ndarray) – Photon energies;

    - tht_ap (float) – angle between analyzer axis (a) and photons (p) along the plane of the slit (theta, so the name “tht_ap”);

    - phi_ap (float) – angle between analyzer axis (a) and photons (p) along the plane perpendicular to the slit (phi, so the name “phi_ap”);

    - tht_an (float) – angle between analyzer axis (a) and normal (n) to the surface along the plane of the slit (theta, so the name “tht_an”);

    - phi_an (float) – angle between analyzer axis (a) and normal (n) along the plane perpendicular to the slit (phi, so the name “phi_an”), this is the axis of the scan in the case of tilt rotation.

  Returns:

    k vector perpendicular to sample surface.

  Return type:

    kz (ndarray)

navarp.utils.ktransf.get_k_perp_slit(e_kins, tht, tht_an, phi, phi_an, p_hv=False, hv=None, tht_ap=None, phi_ap=None)
  Calculates k vector perpendicular to the slit, i.e. the intersection

    between plane of analyzer axis and the perpendicular to the slit, and the plane of the sample surface.

  Parameters:

    - e_kins (ndarray) – Kinetic energies (usually it is the energy axis of the analyzer data);

    - tht (ndarray) – Angular axis of the analyzer data;

    - tht_an (float) – angle between analyzer axis (a) and normal (n) to the surface along the plane of the slit (theta, so the name “tht_an”);

    - phi (ndarray) – angle perpendicular to the slit, this is the axis of the scan in the case of the deflector;

    - phi_an (float) – angle between analyzer axis (a) and normal (n) along the plane perpendicular to the slit (phi, so the name “phi_an”), this is the axis of the scan in the case of tilt rotation;

    - p_hv (boolean, optional) – If True, add photon momentum.

    - hv (ndarray) – Photon energies;

    - tht_ap (float) – angle between analyzer axis (a) and photons (p) along the plane of the slit (theta, so the name “tht_ap”);

    - phi_ap (float) – angle between analyzer axis (a) and photons (p) along the plane perpendicular to the slit (phi, so the name “phi_ap”);

  Returns:

    k vector perpendicular to the slit

  Return type:

    ky (ndarray)

navarp.utils.ktransf.get_p_hv_along_slit(hv, tht_ph)
  Calculates photon momentum along the slit,

    i.e. the intersection between the plane of analyzer axis and slit, and the plane of the sample surface.

  Parameters:

    - hv (ndarray) – Photon energy;

    - tht_ph (ndarray) – tht angle between surface normal and photons.

  Returns:

    Photon momentum in plane along theta.

  Return type:

    p_hv_along_slit (ndarray)

navarp.utils.ktransf.get_p_hv_perp_sample(hv, tht_ph, phi_ph)

  Calculates photon momentum perpendicular to the sample surface

  Parameters:

    - hv (ndarray) – Photon energy;

    - tht_ph (ndarray) – tht angle between surface normal and photons.

    - phi_ph (ndarray) – phi angle between surface normal and photons.

  Returns:

    Photon momentum in plane along theta.

  Return type:

    p_hv_perp_sample (ndarray)

navarp.utils.ktransf.get_p_hv_perp_slit(hv, tht_ph, phi_ph)
  Calculates photon momentum perpendicular to the slit,

    i.e. the intersection between plane of analyzer axis and the perpendicular to the slit, and the plane of the sample surface.

  Parameters:

    - hv (ndarray) – Photon energy;

    - tht_ph (ndarray) – tht angle between surface normal and photons.

    - phi_ph (ndarray) – phi angle between surface normal and photons.

  Returns:

    Photon momentum in plane along phi.

  Return type:

    p_hv_along_slit (ndarray)

navarp.utils.ktransf.get_phi_an(e_kin_p, tht_p, tht_an, phi_p, k_perp_slit_p, phi_an_init=0, p_hv=False, hv_p=None, tht_ap=None, phi_ap=None)
  Calculates angle between analyzer axis (a) and normal (n) along

    the plane perpendicular to the slit (phi, so the name “phi_an”), this is the axis of the scan in the case of tilt rotation;

  Parameters:

    - e_kin_p (float) – Kinetic energy value of the reference point;

    - tht_p (float) – Angular value of the reference point along the angular axis of the analyzer data;

    - tht_an (float) – angle between analyzer axis (a) and normal (n) to the surface along the plane of the slit (theta, so the name “tht_an”);

    - phi_p (float) – Angular value of the reference point along the angle perpendicular to the slit;

    - k_perp_slit_p (float) – k vector value of the reference point, perpendicular to the slit;

    - phi_an_init (float, optional) – Initial guess for the phi_an;

    - p_hv (boolean, optional) – If True, add photon momentum;

    - hv_p (float, optional) – Photon energy for the reference point, requested if p_hv==True;

    - tht_ap (float, optional) – angle between analyzer axis (a) and photons (p) along the plane of the slit (theta, so the name “tht_ap”), requested if p_hv==True;

    - phi_ap (float) – angle between analyzer axis (a) and photons (p) along the plane perpendicular to the slit (phi, so the name “phi_ap”);

  Returns:

    angle between analyzer axis (a) and normal (n) along

      the plane perpendicular to the slit (phi, so the name “phi_an”), this is the axis of the scan in the case of tilt rotation.

  Return type:

    phi_an (float)

navarp.utils.ktransf.get_surface_normal(entry, refs_p)

  Calculates tht_an, phi_an, scans_0 and phi.

  Parameters:

    - entry (NavEntry class) – the class for the data explored by NavARP;

    - refs_p (dict) – dictionary of the reference point in angle and k space.

  Returns:

    Photon energy of the point;

  Return type:

    hv_p (float)

navarp.utils.ktransf.get_tht_an(e_kin_p, tht_p, k_along_slit_p, tht_an_init=0, p_hv=False, hv_p=None, tht_ap=None)
  Calculates angle between analyzer axis (a) and normal (n) to the

    surface along the plane of the slit (theta, so the name “tht_an”).

  Parameters:

    - e_kin_p (float) – Kinetic energy value of the reference point;

    - tht_p (float) – Angular value of the reference point along the angular axis of the analyzer data;

    - k_along_slit_p (float) – k vector value of the reference point, along the slit direction;

    - tht_an_init (float, optional) – Initial guess for the tht_an;

    - p_hv (boolean, optional) – If True, add photon momentum;

    - hv_p (float, optional) – Photon energy for the reference point, requested if p_hv==True;

    - tht_ap (float, optional) – angle between analyzer axis (a) and photons (p) along the plane of the slit (theta, so the name “tht_ap”), requested if p_hv==True.

  Returns:

    angle between analyzer axis (a) and normal (n) to the

      surface along the plane of the slit (theta, so the name “tht_an”).

  Return type:

    tht_an (float)

## navfile

This module is part of the Python NavARP library. It defines the base class for the data used in NavARP.

class navarp.utils.navfile.NavAnalyzer(tht_ap=50, phi_ap=0, work_fun=4.5)

  Bases: `object`

  NavAnalyzer is the class for the analyzer and its geometry.

  NavAnalyzer is defined from the NavEntry, and it considers the experimental set-ups of Lorea/ALBA(ES), I05/Diamond(GB), SXARPES-ADRESS/PSI(CH) and Antares/Soleil(FR).

  tht_ap

    Angle between analyzer axis (a) and photons (p) along the plane of the slit (theta, so the name “tht_ap”);

    Type:

      float

  phi_ap

    Angle between analyzer axis (a) and photons (p) along the plane perpendicular to the slit (phi, so the name “phi_ap”);

    Type:

      float

  work_fun

    analyzer work function;

    Type:

      float

  scan_type

    Acquisition method.

    Type:

      str

  _set_def_lorea_alba

    Set defaul values for Lorea/ALBA(ES)

  _set_def_i05_diamond

    Set defaul values for I05/Diamond(GB)

  _set_def_sxarpes_psi

    Set defaul values for SXARPES-ADRESS/PSI(CH)

  _set_def_antares_soleil

    Set defaul values for Antares/Soleil(FR)

  get_attr()
  set_attr(tht_ap, phi_ap, work_fun)

class navarp.utils.navfile.NavEntry(scans, angles, energies, data, scan_type, hv, defl_angles=0, analyzer=<navarp.utils.navfile.NavAnalyzer object>, file_note='', file_path='')

  Bases: `object`

  NavEntry is the class for the data to be explored by NavARP.

  Parameters:

    - scans (ndarray) – scan axis of the acquisition method;

    - angles (ndarray) – Angular axis of the analyzer;

    - energies (ndarray) – Kinetic energy axis of the analyzer;

    - data (ndarray) – The matrix composed by the detector images;

    - scan_type (str) – Acquisition method;

    - hv (ndarray) – Photon energy;

    - defl_angles (ndarray, optional) – Deflector angular axis of the analyzer, if present;

    - analyzer (NavAnalyzer class, optional) – Analyzer and its geometry;

    - file_note (str, optional) – Description of experimental condition;

    - file_path (str, optional) – File path, as from input.

  analyzer

    analyzer and its geometry;

    Type:

      NavAnalyzer class

  angles

    Angular axis of the analyzer;

    Type:

      ndarray

  data

    The matrix composed by the detector images;

    Type:

      ndarray

  data_init

    The matrix composed by the detector images without any resphape, it is present only in the case of hv scan;

    Type:

      ndarray

  defl_angles

    Deflector angular axis of the analyzer, if present;

    Type:

      ndarray

  ebins

    Binding energy axis;

    Type:

      ndarray

  efermi

    Fermi level kinetic energy (or energies);

    Type:

      ndarray

  efermi_fit_input

    Input parameters of autoset_efermi;

    Type:

      ndarray

  efermi_fit_pars

    Output parameters of autoset_efermi, which are the optimal values for the parameters so that the sum of the squared residuals of fermi_fun - integrated data is minimized;

    Type:

      ndarray

  efermi_fwhm

    Fermi level full-width-half-maximum;

    Type:

      ndarray

  energies

    Kinetic energy axis of the analyzer;

    Type:

      ndarray

  energies_init

    Kinetic energy axis of the analyzer without any reshape, it is present only in the case of hv scan;

    Type:

      ndarray

  file_note

    Description of experimental condition;

    Type:

      str

  file_path

    File path, as from input;

    Type:

      str

  hv

    Photon energy without any reshape, it is present only in the case of hv scan;

    Type:

      ndarray

  hv_init

    Photon energy;

    Type:

      ndarray

  p_hv

    It True, the photon momentum is used in the k-transformation (ktransf);

    Type:

      Bolean

  phi_an

    Angle between analyzer axis (a) and normal (n) along the plane perpendicular to the slit (phi, so the name “phi_an”), this is the axis of the scan in the case of tilt rotation;

    Type:

      float

  scans

    Scan axis of the acquisition method;

    Type:

      ndarray

  scan_type

    Acquisition method;

    Type:

      str

  scans_0

    Offset in scans axis (inner potential in the case of hv scan);

    Type:

      float

  tht_an

    Angle between analyzer axis (a) and normal (n) to the surface along the plane of the slit (theta, so the name “tht_an”).

    Type:

      float

  autoset_efermi(energy_range=None, angle_range=None, scan_range=None, print_out=True)

    Find fermi level using logaritmic derivative and then fit.

    Parameters:

      - energy_range (ndarray) – Energy range where to find fermi level [min, max];

      - angle_range (ndarray) – Angle range where to find fermi level [min, max];

      - scan_range (ndarray) – Scan range where to find fermi level [min, max];

      - print_out (boolean, optional) – If True, print the obtained values.

  get_attr()
  init_ebins()

    Initialize fermi level (efermi) and binding energies (ebins).

  isoangle(angle, dangle=0, norm_mode='no', sigma=None, order=2, curvature=None)
  isoenergy(ebin, debin=0, norm_mode='no', sigma=None, order=2, curvature=None, kbins=None)
  isok(kx_pts, ky_pts, klabels=None, ebins_interp=None, kbins=None, mask_once=True, norm_mode='no', sigma=None, order=2, curvature=None)
  isoscan(scan, dscan=0, norm_mode='no', sigma=None, order=2, curvature=None, kbins=None)
  plt_efermi_fit(axfit=None, scan_i=0)

    Plot the fermi level fit result.

    Parameters:

      - axfit (matplotlib.axes, optional) – Axes, if None it is created inside the function;

      - scan_i (integer) – scans index, in the case of efermi fit for each image along the scan axis.

  set_efermi(efermi)

    Set the fermi level and then update the other attributes.

    Parameters:

      efermi (ndarray) – Fermi level kinetic energy (or energies);

  set_kspace(tht_p, k_along_slit_p, scan_p, ks_p, e_kin_p, inn_pot=14, p_hv=False, hv_p=None, k_perp_slit_for_kz=0, print_out=True)

    Set tht_an, phi_an, scans_0 and phi.

    Parameters:

      - tht_p (float) – Angular value of the reference point along the angular axis of the analyzer data;

      - k_along_slit_p (float) – k vector value of the reference point, along the slit direction;

      - scan_p (float) – Scan value of the reference point;

      - ks_p (float) – k vector value of the reference point in the direction consistent with the scan axis;

      - e_kin_p (float) – Kinetic energy value of the reference point;

      - inn_pot (float) – Inner potential, needed in hv scan;

      - p_hv (boolean, optional) – If True, add photon momentum;

      - hv_p (float, optional) – Photon energy for the reference point, requested if p_hv==True;

      - print_out (boolean, optional) – If True, print the obtained values.

  set_tht_an(tht_p, k_along_slit_p, e_kin_p, p_hv=False, hv_p=None, print_out=True)
    Set angle between analyzer axis (a) and normal (n) to the

      surface along the plane of the slit (theta, so the name “tht_an”).

    Note

    The photon momentum shifts the Gamma-point from (Kx, Ky) = (0, 0) In the following method the real tht_an value is calculated from a k-point and the photon momentum contribution can be taken into account by setting p_hv=True.

    Parameters:

      - tht_p (float) – Angular value of the reference point along the angular axis of the analyzer data;

      - k_along_slit_p (float) – k vector value of the reference point, along the slit direction;

      - e_kin_p (float) – Kinetic energy value of the reference point;

      - p_hv (boolean, optional) – If True, add photon momentum;

      - hv_p (float, optional) – Photon energy for the reference point, requested if p_hv==True;

      - print_out (boolean, optional) – If True, print the obtained values.

navarp.utils.navfile.decode_h5py(string)

  Get only the string in the case of np.ndarray or byte.

navarp.utils.navfile.load(file_path)

  Load the NavEntry from file_path.

  The function loads entry from:

    - NXarpes file from LOREA/ALBA(ES) and I05/Diamond(GB);

    - HDF5 file from SXARPES-ADRESS/PSI(CH);

    - NEXUS file from Antares/Soleil(FR) (only deflector scan);

    - folder with txt-files from Cassiopee/Soleil(FR);

    - krx or txt file from MBS A1Soft program;

    - sp2 or itx file from SpecsLab Prodigy program;

    - zip or txt file from Scienta-Omicron SES program;

    - pxt, ibw and itx file of Igor-pro as saved by Scienta-Omicron SES program;

    - txt file in itx format of Igor-pro considering the order (energy, angle, scan);

    - yaml file with dictionary to load files (txt, sp2 or pxt) in a folder or to only add metadata to a single file.

  The type of data is recognized from the file-extension:

    - .nxs is considered as NXarpes data if the first group is entry1 otherwise a NEXUS file from Antares/Soleil(FR) if second group is ANTARES

    - .h5 is considered for from SXARPES-ADRESS/PSI(CH);

    - .txt is considered as from Cassiopee/Soleil(FR) if ‘_ROI1_’ is in its name, otherwise the first line is read and if this line contains ‘Frames Per Step’ then it is from MBS A1Soft program, if it contains ‘[Info]’ then it is from Scienta-Omicron SES program;

    - .sp2 is considered as from Specs program;

    - .pxt and .ibw are considered as of Igor-pro as saved by Scienta-Omicron SES program;

    - .krx is considered as from MBS A1Soft program;

    - .yaml is considered as a dictionary with the complementary information for creating a valid NavEntry, here an example:

          file_path: '*.sp2'
          scans:
              start: 121.5
              step: 0.35
          scan_type: 'azimuth'

  Parameters:

    file_path (str) – File path of the file to open as NavEntry.

  Returns:

    the class for the data to be explored by NavARP.

  Return type:

    NavEntry (class)

navarp.utils.navfile.load_cassiopee(file_path)

  Load ARPES data from Cassiopee/Soleil(FR).

  Parameters:

    path – file path of a ROI-file in the folder.

  Returns:

    the class for the data to be explored by NavARP.

  Return type:

    NavEntry (class)

navarp.utils.navfile.load_igorpro_itx(file_path)

  Load ARPES data from itx file.

  Parameters:

    path – file path of the itx-file.

  Returns:

    the class for the data to be explored by NavARP.

  Return type:

    NavEntry (class)

navarp.utils.navfile.load_igorpro_pxt_ibw(file_path)

  Load Igor-pro pxt- or ibw-file as saved by Scienta-Omicro SES program.

  Parameters:

    path – file path of the pxt- or ibw-file.

  Returns:

    the class for the data to be explored by NavARP.

  Return type:

    NavEntry (class)

navarp.utils.navfile.load_known_txt(file_path)

  Load txt-file from MBS A1Soft or Scienta-Omicro SES program.

  Parameters:

    path – file path of the txt-file.

  Returns:

    the class for the data to be explored by NavARP.

  Return type:

    NavEntry (class)

navarp.utils.navfile.load_mbs_krx(file_path)

  Load krx-file from MBS A1Soft program.

  Parameters:

    path – file path of the krx-file.

  Returns:

    the class for the data to be explored by NavARP.

  Return type:

    NavEntry (class)

navarp.utils.navfile.load_navarp_yaml(file_path)

  Load files in a folder using yaml-file.

  Parameters:

    path – file path of the yaml-file.

  Returns:

    the class for the data to be explored by NavARP.

  Return type:

    NavEntry (class)

navarp.utils.navfile.load_nxarpes(h5f, file_path)

  Load NXARPES data from LOREA/ALBA(ES) and I05/Diamond(GB).

  Parameters:

    h5f – The HDF5 file-object from h5py.File.

  Returns:

    the class for the data to be explored by NavARP.

  Return type:

    NavEntry (class)

navarp.utils.navfile.load_nxarpes_generic(h5f, file_path)

  Load generic NXARPES as saved by save_nxarpes_generic.

  Parameters:

    h5f – The HDF5 file-object from h5py.File.

  Returns:

    the class for the data to be explored by NavARP.

  Return type:

    NavEntry (class)

navarp.utils.navfile.load_nxarpes_simulated(h5f, file_path)

  Load NXARPES example.

  Parameters:

    h5f – The HDF5 file-object from h5py.File.

  Returns:

    the class for the data to be explored by NavARP.

  Return type:

    NavEntry (class)

navarp.utils.navfile.load_nxsantares(h5f, file_path)

  Load NEXUS file from Antares/Soleil(FR).

  Parameters:

    h5f – The HDF5 file-object from h5py.File.

  Returns:

    the class for the data to be explored by NavARP.

  Return type:

    NavEntry (class)

navarp.utils.navfile.load_scienta_or_mbs_txt(file_path)

  Load txt-file from MBS A1Soft or Scienta-Omicro SES program.

  Parameters:

    path – file path of the txt-file.

  Returns:

    the class for the data to be explored by NavARP.

  Return type:

    NavEntry (class)

navarp.utils.navfile.load_scienta_ses_zip(file_path)

  Load zip-file from Scienta-Omicro SES program.

  Parameters:

    path – file path of the zip-file.

  Returns:

    the class for the data to be explored by NavARP.

  Return type:

    NavEntry (class)

navarp.utils.navfile.load_specs_sp2(file_path)

  Load sp2-file from Specs program.

  Parameters:

    path – file path of the sp2-file.

  Returns:

    the class for the data to be explored by NavARP.

  Return type:

    NavEntry (class)

navarp.utils.navfile.load_sxarpes_adress(h5f, file_path)

  Load data from SXARPES-ADRESS/PSI(CH).

  Parameters:

    - h5f – The HDF5 file-object from h5py.File.

    - h5f_matrix_path – The path location of the data (matrix).

  Returns:

    the class for the data to be explored by NavARP.

  Return type:

    NavEntry (class)

navarp.utils.navfile.save_nxarpes_generic(entry, file_path_nxs, instrument_name='unknow')

  Save NavEntry into file_path as generic NXARPES.

  Parameters:

    - entry (NavEntry class) – entry to be saved.

    - file_path_nxs (str) – File path for the nxs-file to be saved.

    - instrument_name (string, optional) – name of the instrument where the data are from (e.g.: beamline or laboratory name).

## navplt

This module is part of the Python NavARP library. It defines the functions for plotting the data using matplotlib.pyplot .

navarp.utils.navplt.extend_array(array, image, array_label)

navarp.utils.navplt.get_cmapscale(cmapscale='linear', vmin=None, vmax=None, clip=False)

  The function generate linear/log/power colormap scale.

  Parameters:

    - cmapscale (string, optional, linear/log/power) – Select the scale mode.

    - vmin (scalar, optional) – Colorscale min and max. If None, suitable min/max values are automatically chosen by the Normalize instance.

    - vmax (scalar, optional) – Colorscale min and max. If None, suitable min/max values are automatically chosen by the Normalize instance.

    - clip (boolean, optional) – if is True, masked values are set to 1; otherwise they remain masked.

  Returns:

    Normalize class from matplotlib.colors.Normalize

  Return type:

    norm

navarp.utils.navplt.give_style(ax, style)

  The function applies a style to the pcolormesh generated by pimage.

  Parameters:

    - ax (matplotlib.axes) – Axes where to impose the style.

    - style (string) – ‘xlabel_ylabel’, xlabel and ylabel in agreement with label dictionary (e.g. ‘tht_be’ or ‘kx_hv’ or ‘ky_kz’)

  Returns:

    None

navarp.utils.navplt.hist(z, ax=None, z_range=None, orientation='vertical')

  Plot an histogram of z divited into 256 bins.

  Parameters:

    - z (ndarray) – Intensity matrix

    - ax (matplotlib.axes, optional) – Axes, if None it is created inside the function

    - z_range (array, optional, [min, max]) – Extreme values for z scale

    - orientation (string, optional, vertical or horizontal) – Histogram axes orientation

  Returns:

    None

navarp.utils.navplt.norm(z, mode='all', axis=1)

  Normalize z values along the axis value between [0, 1].

  Parameters:

    - z (ndarray) – Intensity matrix

    - mode (string, optional, all or each) – Select the normalization mode if “each”, every Slice are normalize by by the integral intensity of each Slice over their 90% of aixs range if “all”, the overall z values are normalize to its min and max

    - axis (int, optional) – Axis along which a sum is performed in the case mode == “each”

  Returns:

    Intensity matrix normalized

  Return type:

    z_norm (ndarray)

navarp.utils.navplt.pimage(x, y, z, cmap='Greys', ax=None, z_range=None, style=None, print_out=False, cmapscale='linear')

  The function is adapting a more generic input format for pcolormesh.

  Parameters:

    - x (ndarray) – Array for the horizontal axis

    - y (ndarray) – Array for the vertical axis

    - z (ndarray) – Intensity matrix

    - cmap (string, optional) – colormap

    - ax (matplotlib.axes, optional) – Axes, if None it is created inside the function

    - z_range (array, optional, [min, max]) – Extreme values for z scale

    - style (string, optional) – See give_style function

    - print_out (boolean, optional) – If True, print the axes dimension with them adaptations

  Returns:

    The returned value is the object matplotlib.collections.QuadMesh from

      ax.pcolormesh

navarp.utils.navplt.pimage_depr(x, y, z, cmap='Greys', ax=None, z_range=None, style=None, print_out=False, cmapscale='linear')

  The function is adapting a more generic input format for pcolormesh.

  Parameters:

    - x (ndarray) – Array for the horizontal axis

    - y (ndarray) – Array for the vertical axis

    - z (ndarray) – Intensity matrix

    - cmap (string, optional) – colormap

    - ax (matplotlib.axes, optional) – Axes, if None it is created inside the function

    - z_range (array, optional, [min, max]) – Extreme values for z scale

    - style (string, optional) – See give_style function

    - print_out (boolean, optional) – If True, print the axes dimension with them adaptations

  Returns:

    The returned value is the object matplotlib.collections.QuadMesh from

      ax.pcolormesh

navarp.utils.navplt.set_cmapscale(quadmesh, cmapscale, vmin=None, vmax=None, clip=False)

  The function assign the cmapscale to the quadmesh.

  Parameters:

    - quadmesh – matplotlib.collections.QuadMesh from ax.pcolormesh

    - cmapscale (string, optional, linear/log/power) – Select the scale mode.

    - vmin (scalar, optional) – Colorscale min and max. If None, suitable min/max values are automatically chosen by the Normalize instance.

    - vmax (scalar, optional) – Colorscale min and max. If None, suitable min/max values are automatically chosen by the Normalize instance.

    - clip (boolean, optional) – if is True, masked values are set to 1; otherwise they remain masked.

  Returns:

    None