pyFAI.gui.model package

pyFAI.gui.model.AbstractModel module

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

Bases: QObject

__init__(parent=None)
changed

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

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: AbstractModel

__init__(parent=None)
calibrant() Optional[Calibrant]
isValid() bool
setCalibrant(calibrant: Optional[Calibrant])

pyFAI.gui.model.CalibrationModel module

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

Bases: AbstractModel

__init__(parent=None)
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: AbstractModel

__init__(parent=None)
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: AbstractModel

__init__(parent=None)
isValid()
setValue(value)
value()

pyFAI.gui.model.DataModelAdaptor module

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

Bases: AbstractModel

__init__(parent=None, model=None)
fromModel(data)
isValid()
setValue(value)
toModel(data)
value()

pyFAI.gui.model.DetectorModel module

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

Bases: AbstractModel

__init__(parent=None)
detector()
isValid()
setDetector(detector)

pyFAI.gui.model.ExperimentSettingsModel module

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

Bases: AbstractModel

__init__(parent=None)
calibrantModel()
dark()
detector()

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

detectorModel()
flat()
image()
isValid()
mask()
maskedImage()
polarizationFactor()
poniFile()
preprocessedImage()
wavelength()

pyFAI.gui.model.FilenameModel module

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

Bases: DataModel

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

__init__(parent=None)
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: AbstractModel

__init__(parent=None)
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: AbstractModel

__init__(parent=None)
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: 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: 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)
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: AbstractModel

__init__(parent=None)
copy()
distance()
isValid(checkWaveLength=True)

Check if all the model 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: DataModel

Model storing an image using it’s filename.

filename()

Returns the filename associated with this model.

Return type:

Union[None,str]

filenameChanged

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

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: DataModel

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

This model deal with unsynchronized filename/data.

__init__(parent=None)
filename()

Returns the filename associated with this model.

Return type:

Union[None,str]

filenameChanged

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

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: DataModel

setValue(value)

Set the value of this image model.

pyFAI.gui.model.IntegrationSettingsModel module

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

Bases: AbstractModel

__init__(parent=None)
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__()
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: 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)
append(item)

Add a new item to the end of the list.

changed

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

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)
name()
class pyFAI.gui.model.MarkerModel.MarkerModel(parent=None)

Bases: AbstractModel

__init__(parent=None)
add(marker)
remove(marker)
class pyFAI.gui.model.MarkerModel.PhysicalMarker(name, chi, tth)

Bases: Marker

Mark a point at a specific location of chi/tth

__init__(name, chi, tth)
physicalPosition()
pixelPosition()
removePixelPosition()
setPixelPosition(x, y)
class pyFAI.gui.model.MarkerModel.PixelMarker(name, x, y)

Bases: Marker

Mark a pixel at a specific location of an image

__init__(name, x, y)
pixelPosition()

pyFAI.gui.model.MaskedImageModel module

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

Bases: DataModel

Image cleaned up by setting masked pixels to NaN

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

pyFAI.gui.model.PeakModel module

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

Bases: AbstractModel

__init__(parent=None)
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 has 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 this group to be taken into acount (or not).

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: AbstractModel

__init__(parent=None)
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: 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