BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
FitComparisonWidget Class Reference

Description

The FitComparisonWidget class plots realdata, simulated data and relative difference map during the course of the fit.

Definition at line 35 of file FitComparisonWidget.h.

Inheritance diagram for FitComparisonWidget:
[legend]
Collaboration diagram for FitComparisonWidget:
[legend]

Public Member Functions

 FitComparisonWidget (QWidget *parent=nullptr)
 
 ~FitComparisonWidget () override
 
QList< QAction * > actionList () override
 
SessionItemcurrentItem ()
 
const SessionItemcurrentItem () const
 
virtual void setItem (SessionItem *item)
 

Protected Member Functions

void hideEvent (QHideEvent *) override
 
void showEvent (QShowEvent *) override
 
void subscribeToItem () override
 
void unsubscribeFromItem () override
 

Private Slots

void onResetViewAction ()
 

Private Member Functions

IntensityDataItemdiffItem ()
 
JobItemjobItem ()
 
IntensityDataItemrealDataItem ()
 
IntensityDataItemsimulatedDataItem ()
 

Private Attributes

FitComparisonController2Dm_comparisonController
 
FitFlowWidgetm_fitFlowWidget
 
SessionItemControllerm_itemController
 
IntensityDataPropertyWidgetm_propertyWidget
 
ColorMapCanvasm_realDataPlot
 
ColorMapCanvasm_relativeDiffPlot
 
QAction * m_resetViewAction
 
ColorMapCanvasm_simulatedDataPlot
 
PlotStatusLabelm_statusLabel
 
QAction * m_togglePropertiesAction
 

Constructor & Destructor Documentation

◆ FitComparisonWidget()

FitComparisonWidget::FitComparisonWidget ( QWidget *  parent = nullptr)
explicit

Definition at line 31 of file FitComparisonWidget.cpp.

32  : SessionItemWidget(parent)
37  , m_statusLabel(new PlotStatusLabel(nullptr, this))
39  , m_resetViewAction(new QAction(this))
41 {
42  auto* vlayout = new QVBoxLayout;
43  vlayout->setMargin(0);
44  vlayout->setSpacing(0);
45 
46  m_propertyWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
47 
48  auto* gridLayout = new QGridLayout;
49  gridLayout->setMargin(0);
50  gridLayout->setSpacing(0);
51 
52  gridLayout->addWidget(m_realDataPlot, 0, 0);
53  gridLayout->addWidget(m_simulatedDataPlot, 0, 1);
54  gridLayout->addWidget(m_relativeDiffPlot, 1, 0);
55  gridLayout->addWidget(m_fitFlowWidget, 1, 1);
56 
57  vlayout->addLayout(gridLayout);
58  vlayout->addWidget(m_statusLabel);
59 
60  auto* hlayout = new QHBoxLayout;
61  hlayout->setMargin(0);
62  hlayout->setSpacing(0);
63  hlayout->addLayout(vlayout);
64  hlayout->addWidget(m_propertyWidget);
65  setLayout(hlayout);
66 
67  m_resetViewAction->setText("Center view");
68  m_resetViewAction->setIcon(QIcon(":/images/camera-metering-center.svg"));
69  m_resetViewAction->setToolTip("Reset View");
70  connect(m_resetViewAction, &QAction::triggered, this, &FitComparisonWidget::onResetViewAction);
71 
74 
75  m_propertyWidget->setVisible(false);
76 }
static QAction * createTogglePropertiesPanelAction(QObject *parent, QWidget *toggledWidget=nullptr)
Create "toggle properties panel" action.
The ColorMapCanvas class contains ColorMap for intensity data presentation, and provide control of fo...
Provides synchronization between certain properties of fit related IntensityDataItems....
PlotStatusLabel * m_statusLabel
FitFlowWidget * m_fitFlowWidget
ColorMapCanvas * m_simulatedDataPlot
IntensityDataPropertyWidget * m_propertyWidget
ColorMapCanvas * m_realDataPlot
QAction * m_togglePropertiesAction
FitComparisonController2D * m_comparisonController
ColorMapCanvas * m_relativeDiffPlot
The FitFlowWidget class is intended for showing chi2 .vs interation count dependency....
Definition: FitFlowWidget.h:26
Widget to edit properties of an IntensityDataItem.
The PlotStatusLabel class shows status string as reported by DescriptedPlot in a frame....
SessionItemWidget(QWidget *parent=nullptr)

References ActionFactory::createTogglePropertiesPanelAction(), m_fitFlowWidget, m_propertyWidget, m_realDataPlot, m_relativeDiffPlot, m_resetViewAction, m_simulatedDataPlot, m_statusLabel, m_togglePropertiesAction, and onResetViewAction().

Here is the call graph for this function:

◆ ~FitComparisonWidget()

FitComparisonWidget::~FitComparisonWidget ( )
overridedefault

Member Function Documentation

◆ actionList()

QList< QAction * > FitComparisonWidget::actionList ( )
overridevirtual

Reimplemented from SessionItemWidget.

Definition at line 80 of file FitComparisonWidget.cpp.

81 {
82  return QList<QAction*>() << m_resetViewAction << m_togglePropertiesAction;
83 }

References m_resetViewAction, and m_togglePropertiesAction.

◆ currentItem() [1/2]

◆ currentItem() [2/2]

const SessionItem * SessionItemWidget::currentItem ( ) const
inherited

Definition at line 46 of file SessionItemWidget.cpp.

47 {
48  return m_itemController->currentItem();
49 }
SessionItemController * m_itemController

References SessionItemController::currentItem(), and SessionItemWidget::m_itemController.

Here is the call graph for this function:

◆ diffItem()

IntensityDataItem * FitComparisonWidget::diffItem ( )
private

Definition at line 138 of file FitComparisonWidget.cpp.

139 {
141 }

References FitComparisonController2D::diffItem(), and m_comparisonController.

Here is the call graph for this function:

◆ hideEvent()

void SessionItemWidget::hideEvent ( QHideEvent *  )
overrideprotectedinherited

Definition at line 56 of file SessionItemWidget.cpp.

57 {
59 }
void unsubscribe()
Fully unsubscribes the parent from listening item's signals. Controller stays active to track item de...

References SessionItemWidget::m_itemController, and SessionItemController::unsubscribe().

Here is the call graph for this function:

◆ jobItem()

JobItem * FitComparisonWidget::jobItem ( )
private

Definition at line 122 of file FitComparisonWidget.cpp.

123 {
124  auto* jobItem = dynamic_cast<JobItem*>(currentItem());
125  return jobItem;
126 }

References SessionItemWidget::currentItem().

Referenced by realDataItem(), simulatedDataItem(), and subscribeToItem().

Here is the call graph for this function:

◆ onResetViewAction

void FitComparisonWidget::onResetViewAction ( )
privateslot

Definition at line 114 of file FitComparisonWidget.cpp.

115 {
116  if (auto* item = realDataItem())
117  item->resetView();
118 
120 }
IntensityDataItem * realDataItem()

References m_comparisonController, realDataItem(), and FitComparisonController2D::resetDiffItem().

Referenced by FitComparisonWidget(), and subscribeToItem().

Here is the call graph for this function:

◆ realDataItem()

IntensityDataItem * FitComparisonWidget::realDataItem ( )
private

Definition at line 128 of file FitComparisonWidget.cpp.

129 {
130  return jobItem()->realDataItem()->intensityDataItem();
131 }
RealDataItem * realDataItem()
Definition: JobItem.cpp:290
IntensityDataItem * intensityDataItem()

References RealDataItem::intensityDataItem(), jobItem(), and JobItem::realDataItem().

Referenced by onResetViewAction(), and subscribeToItem().

Here is the call graph for this function:

◆ setItem()

◆ showEvent()

void SessionItemWidget::showEvent ( QShowEvent *  )
overrideprotectedinherited

Definition at line 51 of file SessionItemWidget.cpp.

52 {
54 }

References SessionItemWidget::m_itemController, and SessionItemController::subscribe().

Here is the call graph for this function:

◆ simulatedDataItem()

IntensityDataItem * FitComparisonWidget::simulatedDataItem ( )
private

Definition at line 133 of file FitComparisonWidget.cpp.

134 {
135  return jobItem()->intensityDataItem();
136 }
IntensityDataItem * intensityDataItem()
Definition: JobItem.cpp:96

References JobItem::intensityDataItem(), and jobItem().

Referenced by subscribeToItem().

Here is the call graph for this function:

◆ subscribeToItem()

void FitComparisonWidget::subscribeToItem ( )
overrideprotectedvirtual

Reimplemented from SessionItemWidget.

Definition at line 85 of file FitComparisonWidget.cpp.

86 {
87  if (!jobItem()->isValidForFitting())
88  return;
89 
90  connect(jobItem(), &JobItem::jobStatusChanged, this, [=](const JobStatus) {
91  if (jobItem()->isCompleted())
93  });
94 
99  m_fitFlowWidget->setItem(jobItem()->fitSuiteItem());
100 
101  m_statusLabel->reset();
105 
107 }
JobStatus
The JobStatus enum lists the possible states of a job.
Definition: JobStatus.h:22
void setItem(SessionItem *intensityDataItem) override
ColorMap * colorMap()
void setItem(JobItem *job_item)
IntensityDataItem * simulatedDataItem()
void setItem(IntensityDataItem *mainItem, IntensityDataItem *realItem=nullptr)
void jobStatusChanged(const JobStatus status)
void reset()
Disconnects all color maps from the label.
void addPlot(ScientificPlot *plot)
virtual void setItem(SessionItem *item)

References PlotStatusLabel::addPlot(), ColorMapCanvas::colorMap(), FitComparisonController2D::diffItem(), jobItem(), JobItem::jobStatusChanged(), m_comparisonController, m_fitFlowWidget, m_propertyWidget, m_realDataPlot, m_relativeDiffPlot, m_simulatedDataPlot, m_statusLabel, onResetViewAction(), realDataItem(), PlotStatusLabel::reset(), IntensityDataPropertyWidget::setItem(), FitComparisonController2D::setItem(), ColorMapCanvas::setItem(), SessionItemWidget::setItem(), and simulatedDataItem().

Here is the call graph for this function:

◆ unsubscribeFromItem()

void FitComparisonWidget::unsubscribeFromItem ( )
overrideprotectedvirtual

Reimplemented from SessionItemWidget.

Definition at line 109 of file FitComparisonWidget.cpp.

References FitComparisonController2D::clear(), and m_comparisonController.

Here is the call graph for this function:

Member Data Documentation

◆ m_comparisonController

FitComparisonController2D* FitComparisonWidget::m_comparisonController
private

◆ m_fitFlowWidget

FitFlowWidget* FitComparisonWidget::m_fitFlowWidget
private

Definition at line 60 of file FitComparisonWidget.h.

Referenced by FitComparisonWidget(), and subscribeToItem().

◆ m_itemController

◆ m_propertyWidget

IntensityDataPropertyWidget* FitComparisonWidget::m_propertyWidget
private

Definition at line 62 of file FitComparisonWidget.h.

Referenced by FitComparisonWidget(), and subscribeToItem().

◆ m_realDataPlot

ColorMapCanvas* FitComparisonWidget::m_realDataPlot
private

Definition at line 57 of file FitComparisonWidget.h.

Referenced by FitComparisonWidget(), and subscribeToItem().

◆ m_relativeDiffPlot

ColorMapCanvas* FitComparisonWidget::m_relativeDiffPlot
private

Definition at line 59 of file FitComparisonWidget.h.

Referenced by FitComparisonWidget(), and subscribeToItem().

◆ m_resetViewAction

QAction* FitComparisonWidget::m_resetViewAction
private

Definition at line 64 of file FitComparisonWidget.h.

Referenced by FitComparisonWidget(), and actionList().

◆ m_simulatedDataPlot

ColorMapCanvas* FitComparisonWidget::m_simulatedDataPlot
private

Definition at line 58 of file FitComparisonWidget.h.

Referenced by FitComparisonWidget(), and subscribeToItem().

◆ m_statusLabel

PlotStatusLabel* FitComparisonWidget::m_statusLabel
private

Definition at line 61 of file FitComparisonWidget.h.

Referenced by FitComparisonWidget(), and subscribeToItem().

◆ m_togglePropertiesAction

QAction* FitComparisonWidget::m_togglePropertiesAction
private

Definition at line 65 of file FitComparisonWidget.h.

Referenced by FitComparisonWidget(), and actionList().


The documentation for this class was generated from the following files: