Skip to content

Commit

Permalink
Merge pull request #8 from dpscience/dpscience-local
Browse files Browse the repository at this point in the history
preparing update to version 1.09
  • Loading branch information
dpscience authored Jul 9, 2019
2 parents 73e2da2 + a5061e9 commit 15ec5ba
Show file tree
Hide file tree
Showing 10 changed files with 600 additions and 52 deletions.
136 changes: 125 additions & 11 deletions GUI/drs4scopedlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ DRS4ScopeDlg::DRS4ScopeDlg(const ProgramStartType &startType, bool *connectionLo
m_pulseSaveRangeDlg(nullptr),
m_burstModeTimer(nullptr),
m_autoSaveSpectraTimer(nullptr),
m_bSwapDirection(true)
{
m_bSwapDirection(true) {
ui->setupUi(this);

#ifdef __DISABLE_SCRIPT
Expand Down Expand Up @@ -240,6 +239,12 @@ DRS4ScopeDlg::DRS4ScopeDlg(const ProgramStartType &startType, bool *connectionLo
connect(ui->action_StartDAQStreaming, SIGNAL(triggered()), this, SLOT(startStreaming()));
connect(ui->actionStop_Running, SIGNAL(triggered()), this, SLOT(stopStreaming()));

ui->actionStart_True_False_Pulse_Streaming->setEnabled(true);
ui->actionStop_True_False_Pulse_Streaming->setEnabled(false);

connect(ui->actionStart_True_False_Pulse_Streaming, SIGNAL(triggered()), this, SLOT(startTrueFalsePulseStreaming()));
connect(ui->actionStop_True_False_Pulse_Streaming, SIGNAL(triggered()), this, SLOT(stopTrueFalsePulseStreaming()));

connect(ui->actionInfo, SIGNAL(triggered()), this, SLOT(showAboutBox()));

connect(this, SIGNAL(signalUpdateCurrentFileLabelFromScript(QString)), this, SLOT(updateCurrentFileLabelFromScript(QString)), Qt::QueuedConnection);
Expand Down Expand Up @@ -272,6 +277,9 @@ DRS4ScopeDlg::DRS4ScopeDlg(const ProgramStartType &startType, bool *connectionLo
ui->label_88->setEnabled(false);
ui->label_89->setEnabled(false);
ui->label_cores->setEnabled(false);

ui->actionStart_True_False_Pulse_Streaming->setEnabled(true);
ui->actionStop_True_False_Pulse_Streaming->setEnabled(false);
}

ui->widget_CFDAlgorithm->init(m_worker);
Expand Down Expand Up @@ -382,6 +390,15 @@ DRS4ScopeDlg::DRS4ScopeDlg(const ProgramStartType &startType, bool *connectionLo

ui->checkBox_hyperthreading->setChecked(DRS4ProgramSettingsManager::sharedInstance()->isMulticoreThreadingEnabled());

if (ui->checkBox_hyperthreading->isChecked()) {
ui->actionStart_True_False_Pulse_Streaming->setEnabled(false);
ui->actionStop_True_False_Pulse_Streaming->setEnabled(false);
}
else {
ui->actionStart_True_False_Pulse_Streaming->setEnabled(true);
ui->actionStop_True_False_Pulse_Streaming->setEnabled(false);
}

if (DRS4ProgramSettingsManager::sharedInstance()->isMulticoreThreadingEnabled()) {
ui->actionSave_next_N_Pulses->setEnabled(false);
ui->actionSave_next_N_Pulses_in_Range->setEnabled(false);
Expand Down Expand Up @@ -607,20 +624,20 @@ DRS4ScopeDlg::DRS4ScopeDlg(const ProgramStartType &startType, bool *connectionLo
ui->spinBox_stopMinB->setValue(0);
ui->spinBox_stopMaxB->setValue(1000);

ui->spinBox_chnCountAB->setRange(1, 12384);
ui->spinBox_chnCountBA->setRange(1, 12384);
ui->spinBox_chnCountCoincidence->setRange(1, 12384);
ui->spinBox_chnCountMerged->setRange(1, 12384);
ui->spinBox_chnCountAB->setRange(10, 50000);
ui->spinBox_chnCountBA->setRange(10, 50000);
ui->spinBox_chnCountCoincidence->setRange(10, 50000);
ui->spinBox_chnCountMerged->setRange(10, 50000);

ui->doubleSpinBox_offsetAB->setRange(-900, 900);
ui->doubleSpinBox_offsetBA->setRange(-900, 900);
ui->doubleSpinBox_offsetCoincidence->setRange(-900, 900);
ui->doubleSpinBox_offsetMerged->setRange(-900, 900);

ui->doubleSpinBox_scalerAB->setRange(0.010, 2000);
ui->doubleSpinBox_scalerBA->setRange(0.010, 2000);
ui->doubleSpinBox_scalerCoincidence->setRange(0.010, 2000);
ui->doubleSpinBox_scalerMerged->setRange(0.010, 2000);
ui->doubleSpinBox_scalerAB->setRange(0.010, 50000);
ui->doubleSpinBox_scalerBA->setRange(0.010, 50000);
ui->doubleSpinBox_scalerCoincidence->setRange(0.010, 50000);
ui->doubleSpinBox_scalerMerged->setRange(0.010, 50000);

ui->spinBox_chnCountAB->setValue(4096);
ui->spinBox_chnCountBA->setValue(4096);
Expand Down Expand Up @@ -4196,6 +4213,8 @@ void DRS4ScopeDlg::plotPersistance()
m_bSwapDirection = m_bSwapDirection?false:true;
}



m_worker->setBusy(false);

ui->widget_persistanceA->replot();
Expand Down Expand Up @@ -6374,13 +6393,21 @@ void DRS4ScopeDlg::changeMulticoreThreadingEnabled(bool on, const FunctionSource
DDELETE_SAFETY(m_pulseSaveDlg);
m_pulseSaveDlg = new DRS4PulseSaveDlg(m_worker);
}

if(DRS4FalseTruePulseStreamManager::sharedInstance()->isArmed()) {
DRS4FalseTruePulseStreamManager::sharedInstance()->stopAndSave();
}
}

ui->actionSave_next_N_Pulses->setEnabled(!on);
ui->actionSave_next_N_Pulses_in_Range->setEnabled(!on);
ui->tabWidget_persistanceB->setEnabled(!on);
ui->tabWidget_persistanceB->setEnabled(!on);
ui->checkBox_enablePersistance->setEnabled(!on);
ui->actionStart_True_False_Pulse_Streaming->setEnabled(!on);

if (DRS4FalseTruePulseStreamManager::sharedInstance()->isArmed())
ui->actionStop_True_False_Pulse_Streaming->setEnabled(!on);

m_worker->setBusy(false);
}
Expand Down Expand Up @@ -6567,6 +6594,87 @@ void DRS4ScopeDlg::stopStreaming()
MSGBOX("OK. Finished Streaming!");
}

void DRS4ScopeDlg::startTrueFalsePulseStreaming()
{
/*const QString fileName = QFileDialog::getSaveFileName(this, tr("Stream Data to..."),
DRS4ProgramSettingsManager::sharedInstance()->streamInputFilePath(),
QString("DRS4 Data Stream (*" + EXT_PULSE_STREAM_FILE + ")"));*/

QFileDialog *fd = new QFileDialog(this);
fd->setWindowTitle(tr("Stream Data to.."));
fd->setAcceptMode(QFileDialog::AcceptSave);
fd->setDirectory(DRS4ProgramSettingsManager::sharedInstance()->streamInputFilePath());
fd->setViewMode(QFileDialog::Detail);
fd->setDefaultSuffix(EXT_PULSE_STREAM_FILE);
fd->setFileMode(QFileDialog::AnyFile);
fd->setNameFilter(QString("DRS4 Data Stream (*" + EXT_PULSE_STREAM_FILE + ")"));

fd->setOption(QFileDialog::DontUseNativeDialog, true);

QGridLayout *layout = static_cast<QGridLayout*>(fd->layout());

QHBoxLayout *hboxLayout = new QHBoxLayout;

QLabel *label = new QLabel("stream for branch A (otherwise B)?");
QCheckBox *streamCheckBox = new QCheckBox;
streamCheckBox->setChecked(true);

hboxLayout->addWidget(label);
hboxLayout->addWidget(streamCheckBox);

layout->addLayout(hboxLayout, layout->rowCount()-1, layout->columnCount());

if (!fd->exec())
return;

const QString fileName = !fd->selectedFiles().isEmpty()?fd->selectedFiles().first():QString("");
const bool bStreamForA = streamCheckBox->isChecked();

DDELETE_SAFETY(label);
DDELETE_SAFETY(streamCheckBox);
DDELETE_SAFETY(hboxLayout);
DDELETE_SAFETY(fd);


if ( fileName.isEmpty() )
return;

DRS4ProgramSettingsManager::sharedInstance()->setStreamInputFilePath(fileName);

m_worker->setBusy(true);

while(!m_worker->isBlocking()) {}

DRS4FalseTruePulseStreamManager::sharedInstance()->init(fileName, this);

if ( DRS4FalseTruePulseStreamManager::sharedInstance()->start(bStreamForA) ) {
m_worker->setBusy(false);

ui->actionStart_True_False_Pulse_Streaming->setEnabled(false);
ui->actionStop_True_False_Pulse_Streaming->setEnabled(true);
}
else {
m_worker->setBusy(false);
MSGBOX("Sorry, an error occurred while starting the pulse-stream!");
}
}

void DRS4ScopeDlg::stopTrueFalsePulseStreaming()
{
m_worker->setBusy(true);

while(!m_worker->isBlocking()) {}

DRS4FalseTruePulseStreamManager::sharedInstance()->stopAndSave();

ui->actionStart_True_False_Pulse_Streaming->setEnabled(true);
ui->actionStop_True_False_Pulse_Streaming->setEnabled(false);

m_worker->setBusy(false);

MSGBOX("OK. Finished streaming!");
}

void DRS4ScopeDlg::saveSettings()
{
if ( m_currentSettingsPath == NO_SETTINGS_FILE_PLACEHOLDER
Expand Down Expand Up @@ -8330,7 +8438,7 @@ void DRS4ScopeDlg::closeEvent(QCloseEvent *event)
{
const QMessageBox::StandardButton reply = QMessageBox::question(this, "Quit Program?", "Exit Program?", QMessageBox::Yes|QMessageBox::No);

if ( reply != QMessageBox::Yes ) {
if (reply != QMessageBox::Yes) {
event->ignore();
return;
}
Expand All @@ -8354,6 +8462,9 @@ void DRS4ScopeDlg::closeEvent(QCloseEvent *event)
if ( DRS4StreamManager::sharedInstance()->isArmed() )
DRS4StreamManager::sharedInstance()->stopAndSave();

if ( DRS4FalseTruePulseStreamManager::sharedInstance()->isArmed() )
DRS4FalseTruePulseStreamManager::sharedInstance()->stopAndSave();

if ( DRS4StreamDataLoader::sharedInstance()->isArmed() )
DRS4StreamDataLoader::sharedInstance()->stop();

Expand All @@ -8372,6 +8483,9 @@ void DRS4ScopeDlg::arrangeIcons()
ui->action_StartDAQStreaming->setIcon(QIcon(":/images/images/play_click.svg"));
ui->actionStop_Running->setIcon(QIcon(":/images/images/stop_hover.svg"));

ui->actionStart_True_False_Pulse_Streaming->setIcon(QIcon(":/images/images/play_click.svg"));
ui->actionStop_True_False_Pulse_Streaming->setIcon(QIcon(":/images/images/stop_hover.svg"));

ui->actionSave_next_N_Pulses->setIcon(QIcon(":/images/images/001-heart-rate-monitor.png"));
ui->actionSave_next_N_Pulses_in_Range->setIcon(QIcon(":/images/images/001-heart-rate-monitor.png"));

Expand Down
4 changes: 4 additions & 0 deletions GUI/drs4scopedlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ class DRS4ScopeDlg : public QMainWindow, public DRSCallback
friend class DRS4ScriptingEngineAccessManager;
friend class DRS4StreamDataLoader;
friend class DRS4StreamManager;
friend class DRS4FalseTruePulseStreamManager;
public:
explicit DRS4ScopeDlg(const ProgramStartType& startType, bool *connectionLost, QWidget *parent = 0);
virtual ~DRS4ScopeDlg();
Expand Down Expand Up @@ -260,6 +261,9 @@ private slots:
void startStreaming();
void stopStreaming();

void startTrueFalsePulseStreaming();
void stopTrueFalsePulseStreaming();

void loadSimulationToolSettings();
void loadStreamingData();

Expand Down
37 changes: 25 additions & 12 deletions GUI/drs4scopedlg.ui
Original file line number Diff line number Diff line change
Expand Up @@ -1779,7 +1779,7 @@
<double>0.005000000000000</double>
</property>
<property name="maximum">
<double>200.000000000000000</double>
<double>2000.000000000000000</double>
</property>
<property name="value">
<double>5.000000000000000</double>
Expand Down Expand Up @@ -1808,10 +1808,10 @@
</size>
</property>
<property name="minimum">
<number>1</number>
<number>10</number>
</property>
<property name="maximum">
<number>12384</number>
<number>300000</number>
</property>
<property name="value">
<number>4096</number>
Expand Down Expand Up @@ -2134,7 +2134,7 @@
<double>0.005000000000000</double>
</property>
<property name="maximum">
<double>200.000000000000000</double>
<double>2000.000000000000000</double>
</property>
<property name="value">
<double>5.000000000000000</double>
Expand Down Expand Up @@ -2163,10 +2163,10 @@
</size>
</property>
<property name="minimum">
<number>1</number>
<number>10</number>
</property>
<property name="maximum">
<number>12384</number>
<number>300000</number>
</property>
<property name="value">
<number>4096</number>
Expand Down Expand Up @@ -2489,7 +2489,7 @@
<double>0.005000000000000</double>
</property>
<property name="maximum">
<double>200.000000000000000</double>
<double>2000.000000000000000</double>
</property>
<property name="value">
<double>5.000000000000000</double>
Expand Down Expand Up @@ -2518,10 +2518,10 @@
</size>
</property>
<property name="minimum">
<number>1</number>
<number>10</number>
</property>
<property name="maximum">
<number>12384</number>
<number>300000</number>
</property>
<property name="value">
<number>4096</number>
Expand Down Expand Up @@ -2878,7 +2878,7 @@
<double>0.005000000000000</double>
</property>
<property name="maximum">
<double>200.000000000000000</double>
<double>2000.000000000000000</double>
</property>
<property name="value">
<double>5.000000000000000</double>
Expand Down Expand Up @@ -2907,10 +2907,10 @@
</size>
</property>
<property name="minimum">
<number>1</number>
<number>10</number>
</property>
<property name="maximum">
<number>12384</number>
<number>300000</number>
</property>
<property name="value">
<number>4096</number>
Expand Down Expand Up @@ -6651,6 +6651,9 @@
<addaction name="separator"/>
<addaction name="actionSave_next_N_Pulses"/>
<addaction name="actionSave_next_N_Pulses_in_Range"/>
<addaction name="separator"/>
<addaction name="actionStart_True_False_Pulse_Streaming"/>
<addaction name="actionStop_True_False_Pulse_Streaming"/>
</widget>
<widget class="QMenu" name="menuFile">
<property name="title">
Expand Down Expand Up @@ -6886,6 +6889,16 @@
<string>Check for Updates of DDRS4PALS...</string>
</property>
</action>
<action name="actionStart_True_False_Pulse_Streaming">
<property name="text">
<string>Start (True/False) Pulse Streaming...</string>
</property>
</action>
<action name="actionStop_True_False_Pulse_Streaming">
<property name="text">
<string>Stop (True/False) Pulse Streaming...</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>
Expand Down
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,27 @@ Copyright (c) 2016-2019 Danny Petschke (danny.petschke@uni-wuerzburg.de) All rig
### Feb. 2019
Experimentally obtained and simulated Positron Annihilation Lifetime Spectra (PALS) acquired on pure Tin (4N) using DDRS4PALS software were published in the following [Data in Brief (Elsevier)](https://www.sciencedirect.com/science/article/pii/S2352340918315142) article.<br><br>

### Jun. 2019
[DDRS4PALS: A software for the acquisition and simulation of lifetime spectra using the DRS4 evaluation board (SoftwareX, Elsevier)](https://www.sciencedirect.com/science/article/pii/S2352711019300676)<br><br>

# Documentation

### Jun. 2019
[DDRS4PALS: A software for the acquisition and simulation of lifetime spectra using the DRS4 evaluation board (SoftwareX, Elsevier)](https://www.sciencedirect.com/science/article/pii/S2352711019300676)<br><br>

# How to cite this Software?

You can cite all versions by using the <b>DOI 10.5281/zenodo.1219522</b>. This DOI represents all versions, and will always resolve to the latest one.<br>
<b>You should at least cite the following publication:</b><br><br>
[DDRS4PALS: A software for the acquisition and simulation of lifetime spectra using the DRS4 evaluation board](https://www.sciencedirect.com/science/article/pii/S2352711019300676)<br>

Additionally, you can cite all released software versions by using the <b>DOI 10.5281/zenodo.1219522</b>. This DOI represents all versions, and will always resolve to the latest one.<br>

[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1219522.svg)](https://doi.org/10.5281/zenodo.1219522)

## v1.x

DDRS4PALS <b>v1.09</b> (<b>DLTPulseGenerator v1.3</b>):<br>[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.2540851.svg)](https://doi.org/10.5281/zenodo.2540851)<br>

DDRS4PALS <b>v1.08</b> (<b>DLTPulseGenerator v1.3</b>):<br>[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.2540851.svg)](https://doi.org/10.5281/zenodo.2540851)<br>

DDRS4PALS <b>v1.07</b> (<b>DLTPulseGenerator v1.2</b>):<br>[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1495099.svg)](https://doi.org/10.5281/zenodo.1495099)<br>
Expand Down
Loading

0 comments on commit 15ec5ba

Please sign in to comment.