# pyFAI.gui.model package

## pyFAI.gui.model.AbstractModel module

class `pyFAI.gui.model.AbstractModel.``AbstractModel`(parent=None)

  Bases: `PyQt5.QtCore.QObject`

  `__init__`(parent=None)

    Initialize self. See help(type(self)) for accurate signature.

  `changed`
  `isLocked`()

    Returns True if the events are locked.

    Return type: | bool

  `isValid`()
  `lockContext`()

    Context manager to lock and unlock signals.

  `lockSignals`()

    Lock the change events

  `unlockSignals`()

    Unlock the change events

    Returns: | False if the model is still locked, else True

  `wasChanged`()

    Emit the change event in case of the model was not locked.

    Returns: | True if the signal was emitted.

## pyFAI.gui.model.CalibrantModel module

class `pyFAI.gui.model.CalibrantModel.``CalibrantModel`(parent=None)

  Bases: `pyFAI.gui.model.AbstractModel.AbstractModel`

  `__init__`(parent=None)

    Initialize self. See help(type(self)) for accurate signature.

  `calibrant`()
  `isValid`()
  `setCalibrant`(calibrant)

## pyFAI.gui.model.CalibrationModel module

class `pyFAI.gui.model.CalibrationModel.``CalibrationModel`(parent=None)

  Bases: `pyFAI.gui.model.AbstractModel.AbstractModel`

  `__init__`(parent=None)

    Initialize self. See help(type(self)) for accurate signature.

  `experimentSettingsModel`()

    Return type: | ExperimentSettingsModel

  `fittedGeometry`()
  `geometryConstraintsModel`()

    Return type: | GeometryConstraintsModel

  `geometryHistoryModel`()

    Return type: | GeometryHistoryModel

  `integrationSettingsModel`()

    Return type: | IntegrationSettingsModel

  `isValid`()
  `markerModel`()

    Return type: | MarkerModel

  `peakGeometry`()

    Return type: | GeometryModel

  `peakSelectionModel`()

    Return type: | PeakSelectionModel

  `rawPlotView`()

    Store definition of the RAW data view.

    This view is shared by some plots

    Return type: | PlotViewModel

## pyFAI.gui.model.ConstraintModel module

class `pyFAI.gui.model.ConstraintModel.``ConstraintModel`(parent=None)

  Bases: `pyFAI.gui.model.AbstractModel.AbstractModel`

  `__init__`(parent=None)

    Initialize self. See help(type(self)) for accurate signature.

  `fillDefault`(other)

    Fill unset values of this model with the other model

    Parameters: | other (GeometryConstraintsModel) –

  `hasConstraint`()
  `isFixed`()
  `isRangeConstrained`()
  `range`()
  `set`(other)
  `setFixed`(fixed=True)
  `setRangeConstraint`(minValue, maxValue)

## pyFAI.gui.model.DataModel module

class `pyFAI.gui.model.DataModel.``DataModel`(parent=None)

  Bases: `pyFAI.gui.model.AbstractModel.AbstractModel`

  `__init__`(parent=None)

    Initialize self. See help(type(self)) for accurate signature.

  `isValid`()
  `setValue`(value)
  `value`()

## pyFAI.gui.model.DataModelAdaptor module

class `pyFAI.gui.model.DataModelAdaptor.``DataModelAdaptor`(parent=None, model=None)

  Bases: `pyFAI.gui.model.AbstractModel.AbstractModel`

  `__init__`(parent=None, model=None)

    Initialize self. See help(type(self)) for accurate signature.

  `fromModel`(data)
  `isValid`()
  `setValue`(value)
  `toModel`(data)
  `value`()

## pyFAI.gui.model.DetectorModel module

class `pyFAI.gui.model.DetectorModel.``DetectorModel`(parent=None)

  Bases: `pyFAI.gui.model.AbstractModel.AbstractModel`

  `__init__`(parent=None)

    Initialize self. See help(type(self)) for accurate signature.

  `detector`()
  `isValid`()
  `setDetector`(detector)

## pyFAI.gui.model.ExperimentSettingsModel module

class `pyFAI.gui.model.ExperimentSettingsModel.``ExperimentSettingsModel`(parent=None)

  Bases: `pyFAI.gui.model.AbstractModel.AbstractModel`

  `__init__`(parent=None)

    Initialize self. See help(type(self)) for accurate signature.

  `calibrantModel`()
  `detector`()

    Detector getter synchronizing internal detector configuration to match the input image.

  `detectorModel`()
  `image`()
  `isValid`()
  `mask`()
  `maskedImage`()
  `polarizationFactor`()
  `poniFile`()
  `wavelength`()

## pyFAI.gui.model.FilenameModel module

class `pyFAI.gui.model.FilenameModel.``FilenameModel`(parent=None)

  Bases: `pyFAI.gui.model.DataModel.DataModel`

  Model storing a filename and if the data is still synchronized.

  `__init__`(parent=None)

    Initialize self. See help(type(self)) for accurate signature.

  `filename`()

    Returns the filename associated with this model.

    Return type: | Union[None,str]

  `hasFilename`()

    True if this model contains a filename.

    Return type: | bool

  `isSynchronized`()

    Returns True if the filename and the data are synchronized.

    Both contains the same data.

  `setFilename`(filename)

    Set a filename to this model

    Parameters: | filename (str) – The new filename

  `setSynchronized`(isSynchronized)

    ” Set if the filename and the data are synchronized.

  `setValue`(value)

## pyFAI.gui.model.Fit2dGeometryModel module

class `pyFAI.gui.model.Fit2dGeometryModel.``Fit2dGeometryModel`(parent=None)

  Bases: `pyFAI.gui.model.AbstractModel.AbstractModel`

  `__init__`(parent=None)

    Initialize self. See help(type(self)) for accurate signature.

  `centerX`()
  `centerY`()
  `distance`()
  `isValid`(checkWaveLength=True)

    Check if all the modele have a meaning.

    Parameters: | checkWaveLength (bool) – If true (default) the wavelength is checked

  `setFrom`(geometry)
  `tilt`()
  `tiltPlan`()

## pyFAI.gui.model.GeometryConstraintsModel module

class `pyFAI.gui.model.GeometryConstraintsModel.``GeometryConstraintsModel`(parent=None)

  Bases: `pyFAI.gui.model.AbstractModel.AbstractModel`

  `__init__`(parent=None)

    Initialize self. See help(type(self)) for accurate signature.

  `copy`(parent=None)

    Copy this model to a new model

    Parameters: | parent (qt.QObject) – Parent of the copyed model
    Return type: | GeometryConstraintsModel

  `distance`()
  `fillDefault`(other)

    Fill unset values of this model with the other model

    Parameters: | other (GeometryConstraintsModel) –

  `isValid`()
  `poni1`()
  `poni2`()
  `rotation1`()
  `rotation2`()
  `rotation3`()
  `set`(other)

    Set this geometry constraints with the other informations.

    Parameters: | other (GeometryConstraintsModel) –

  `wavelength`()

## pyFAI.gui.model.GeometryHistoryModel module

class `pyFAI.gui.model.GeometryHistoryModel.``GeometryHistoryModel`(parent=None)

  Bases: `pyFAI.gui.model.ListModel.ListModel`

  `appendGeometry`(label, time, geometry, rms)

    Parameters:

    - label (str) – Named geometry
    - time (datetime.datetime) – time of the record
    - geometry (GeometryModel) – Geometry to store
    - rms (float) – Root mean share of this geometry

class `pyFAI.gui.model.GeometryHistoryModel.``StoredGeometry`(parent, label, time, geometry, rms)

  Bases: `pyFAI.gui.model.AbstractModel.AbstractModel`

  Single element stored in the history of geometries.

  Parameters:

  - time (datetime.datetime) – time of the record
  - geometry (GeometryModel) – Geometry to store
  - rms (float) –

  `__init__`(parent, label, time, geometry, rms)

    Initialize self. See help(type(self)) for accurate signature.

  `geometry`()

    Return type: | GeometryModel

  `label`()

    Return type: | str

  `rms`()

    Return type: | float

  `time`()

    Return type: | datetime.datetime

## pyFAI.gui.model.GeometryModel module

class `pyFAI.gui.model.GeometryModel.``GeometryModel`(parent=None)

  Bases: `pyFAI.gui.model.AbstractModel.AbstractModel`

  `__init__`(parent=None)

    Initialize self. See help(type(self)) for accurate signature.

  `distance`()
  `isValid`(checkWaveLength=True)

    Check if all the modele have a meaning.

    Parameters: | checkWaveLength (bool) – If true (default) the wavelength is checked

  `poni1`()
  `poni2`()
  `rotation1`()
  `rotation2`()
  `rotation3`()
  `setFrom`(geometry)
  `wavelength`()

## pyFAI.gui.model.ImageModel module

class `pyFAI.gui.model.ImageModel.``ImageFilenameModel`(parent=None)

  Bases: `pyFAI.gui.model.DataModel.DataModel`

  Model storing an image using it’s filename.

  `filename`()

    Returns the filename associated with this model.

    Return type: | Union[None,str]

  `filenameChanged`
  `hasFilename`()

    True if this model contains a filename.

    Return type: | bool

  `setFilename`(filename)

    Set a filename to this model

    Parameters: | filename (str) – The new filename

class `pyFAI.gui.model.ImageModel.``ImageFromFilenameModel`(parent=None)

  Bases: `pyFAI.gui.model.DataModel.DataModel`

  Model storing an image array which could come from a filename.

  This model deal with unsynchronized filename/data.

  `__init__`(parent=None)

    Initialize self. See help(type(self)) for accurate signature.

  `filename`()

    Returns the filename associated with this model.

    Return type: | Union[None,str]

  `filenameChanged`
  `hasFilename`()

    True if this model contains a filename.

    Return type: | bool

  `isSynchronized`()

    Returns True if the filename and the data are synchronized.

    Both contains the same data.

  `setFilename`(filename)

    Set a filename to this model

    Parameters: | filename (str) – The new filename

  `setSynchronized`(isSynchronized)

    ” Set if the filename and the data are synchronized.

  `setValue`(value)

    Set the value of this image model.

  `unlockSignals`()

    Unlock the change events

    Returns: | False if the model is still locked, else True

class `pyFAI.gui.model.ImageModel.``ImageModel`(parent=None)

  Bases: `pyFAI.gui.model.DataModel.DataModel`

  `setValue`(value)

    Set the value of this image model.

## pyFAI.gui.model.IntegrationSettingsModel module

class `pyFAI.gui.model.IntegrationSettingsModel.``IntegrationSettingsModel`(parent=None)

  Bases: `pyFAI.gui.model.AbstractModel.AbstractModel`

  `__init__`(parent=None)

    Initialize self. See help(type(self)) for accurate signature.

  `isValid`()
  `nPointsAzimuthal`()
  `nPointsRadial`()
  `radialUnit`()

## pyFAI.gui.model.ListModel module

class `pyFAI.gui.model.ListModel.``ChangeEvent`(index, item, added=False, removed=False, updated=False)

  Bases: `object`

  `__init__`(index, item, added=False, removed=False, updated=False)

    Define a change done on an item from the `ListModel`.

    Parameters:

    - index (int) – The location where to put/remove the item (before the change) or the current index of the changed item
    - item (object) – The item involved in this change
    - updated (bool) – True if the item was changed
    - added (bool) – True if the item was added
    - removed (bool) – True if the item was removed

class `pyFAI.gui.model.ListModel.``ChangeListEvent`

  Bases: `object`

  A container of consecutive change events

  `__init__`()

    Initialize self. See help(type(self)) for accurate signature.

  `hasOnlyStructuralEvents`()

    True if only structural change (added, removed) is part of the changes

    Return type: | bool

  `hasOnlyUpdateEvents`()

    True if only updates events (updated) is part of the changes

    Return type: | bool

  `hasStructuralEvents`()

    True if a structural change (added, removed) is part of the changes

    Return type: | bool

  `hasUpdateEvents`()

    True if an update change (updated) is part of the changes

    Return type: | bool

class `pyFAI.gui.model.ListModel.``ListModel`(parent=None)

  Bases: `pyFAI.gui.model.AbstractModel.AbstractModel`

  List of AbstractModel managing signals when items are eadited, added and removed.

  Atomic events for each add/remove of items. To manage it in a better way, structureAboutToChange and structureChanged, in order to compute all the atomic events in a single time.

  Parameters: | parent – Owner of this model

  `__init__`(parent=None)

    Initialize self. See help(type(self)) for accurate signature.

  `append`(item)

    Add a new item to the end of the list.

  `changed`

    Emitted at the end of a structural change.

  `clear`()

    Remove all the items from the list.

  `contentChanged`

    Emitted when the content of the elements changed.

  `index`(item)

    Returns the index of the item in the list structure

  `isValid`()
  `remove`(item)

    Remove an item.

  `structureChanged`

    Emitted at the end of a structural change.

  `unlockSignals`()

    Unlock the change events

    Returns: | False if the model is still locked, else True

## pyFAI.gui.model.MarkerModel module

class `pyFAI.gui.model.MarkerModel.``Marker`(name)

  Bases: `object`

  Abstract marker

  `__init__`(name)

    Initialize self. See help(type(self)) for accurate signature.

  `name`()

class `pyFAI.gui.model.MarkerModel.``MarkerModel`(parent=None)

  Bases: `pyFAI.gui.model.AbstractModel.AbstractModel`

  `__init__`(parent=None)

    Initialize self. See help(type(self)) for accurate signature.

  `add`(marker)
  `remove`(marker)

class `pyFAI.gui.model.MarkerModel.``PhysicalMarker`(name, chi, tth)

  Bases: `pyFAI.gui.model.MarkerModel.Marker`

  Mark a point at a specific location of chi/tth

  `__init__`(name, chi, tth)

    Initialize self. See help(type(self)) for accurate signature.

  `physicalPosition`()
  `pixelPosition`()
  `removePixelPosition`()
  `setPixelPosition`(x, y)

class `pyFAI.gui.model.MarkerModel.``PixelMarker`(name, x, y)

  Bases: `pyFAI.gui.model.MarkerModel.Marker`

  Mark a pixel at a specific location of an image

  `__init__`(name, x, y)

    Initialize self. See help(type(self)) for accurate signature.

  `pixelPosition`()

## pyFAI.gui.model.MaskedImageModel module

class `pyFAI.gui.model.MaskedImageModel.``MaskedImageModel`(parent=None, image=None, mask=None)

  Bases: `pyFAI.gui.model.DataModel.DataModel`

  Image cleaned up by setting masked pixels to NaN

  `__init__`(parent=None, image=None, mask=None)

    Initialize self. See help(type(self)) for accurate signature.

  `value`()

## pyFAI.gui.model.PeakModel module

class `pyFAI.gui.model.PeakModel.``PeakModel`(parent=None)

  Bases: `pyFAI.gui.model.AbstractModel.AbstractModel`

  `__init__`(parent=None)

    Initialize self. See help(type(self)) for accurate signature.

  `color`()
  `coords`()

    Returns coords as numpy array.

    The first index identify a coord, the seconf identify the coord dimensions.

    List of axis/ord can be reached like that.

        coords = group.coords()
        yy = coords[:, 0]
        xx = coords[:, 1]

  `copy`(parent=None)
  `distanceTo`(coord)

    Returns the smallest distance to this coord.

    None is retruned if the group contains no peaks.

    Parameters: | coord (Tuple[float,float]) – Distance to mesure

  `isEnabled`()

    True if this group have to be taken into acount.

    Return type: | bool

  `isValid`()
  `mergeCoords`(coords)

    Merge new coords to the current list of coords.

    Duplicated values are removed from the new coords, and the is added the end of the previous list.

    Parameters: | coords ([numpy.ndarray,PeakModel]) –

  `name`()
  `ringNumber`()
  `setColor`(color)
  `setCoords`(coords)

    Set coords as numpy array.

    Parameters: | coords (numpy.ndarray) – Array of coords (1st dimension is the index of the coord; the second dimension contains y as first index, and x as second index).

  `setEnabled`(isEnabled)

    Set if this group have to be taken into acount.

    Parameters: | isEnabled (bool) – True to enable this group.

  `setName`(name)
  `setRingNumber`(ringNumber)

## pyFAI.gui.model.PeakSelectionModel module

class `pyFAI.gui.model.PeakSelectionModel.``PeakSelectionModel`(parent=None)

  Bases: `pyFAI.gui.model.AbstractModel.AbstractModel`

  `__init__`(parent=None)

    Initialize self. See help(type(self)) for accurate signature.

  `append`(peak)
  `clear`()
  `closestGroup`(coord, threshold=None)

    Returns the closest group from coord.

    Parameters:

    - Tuple[float,float] – Position coord to search around.
    - threshold (float) – If specified, filter out groups when the distance is highter than this value.

  `contentChanged`

    Emitted when the content of the elements changed.

  `index`(peak)
  `isValid`()
  `peakCount`()

    Returns the amout of peak selected throug all the groups

    Return type: | int

  `peakFromRingNumber`(ringNumber)

    Returns a peak model from it’s ring number.

    If no peaks where found, returns None.

    Return type: | Union[PeakModel,None]

  `remove`(peak)
  `structureChanged`

    Emitted when there is different elements in the list.

  `unlockSignals`()

    Unlock the change events

    Returns: | False if the model is still locked, else True

## pyFAI.gui.model.PlotViewModel module

class `pyFAI.gui.model.PlotViewModel.``PlotViewModel`(parent=None)

  Bases: `pyFAI.gui.model.DataModel.DataModel`

  This model allow to store and restitute a plot view.

  Stored data can be applyed to another plot in order to synchronize location of the data coords.

  `setFromPlot`(plot)
  `synchronizePlotConfig`(plot)
  `synchronizePlotView`(plot)

## Module contents

Models relative to calibration