mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-08 04:00:44 +00:00
By Pressure experiments (temporary overlay)
This commit is contained in:
parent
fc8d5c1787
commit
2a8d2822ff
@ -267,6 +267,94 @@ void MinutesAtPressure::paint(QPainter &painter, gGraph &graph, const QRegion &r
|
|||||||
row++;
|
row++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
float maxmins = float(maxtime) / 60.0;
|
||||||
|
float ymult = height / maxmins;
|
||||||
|
|
||||||
|
|
||||||
|
row = 0;
|
||||||
|
|
||||||
|
xpos = left ;//+ pix / 2;
|
||||||
|
|
||||||
|
float y1, y2;
|
||||||
|
it = times.begin();
|
||||||
|
float bottom = top+height;
|
||||||
|
if (it != times_end) {
|
||||||
|
float minutes = float(it.value()) / 60.0;
|
||||||
|
y1 = minutes * ymult;
|
||||||
|
|
||||||
|
painter.setPen(QPen(QColor(Qt::gray), 2));
|
||||||
|
it++;
|
||||||
|
for (; it != times_end; ++it) {
|
||||||
|
float minutes = float(it.value()) / 60.0;
|
||||||
|
y2 = minutes * ymult;
|
||||||
|
|
||||||
|
painter.drawLine(xpos, bottom-y1, xpos+pix, bottom-y2);
|
||||||
|
y1 = y2;
|
||||||
|
xpos += pix;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
float maxev = 0;
|
||||||
|
for (int i=0; i< numchans; ++i) {
|
||||||
|
ChannelID code = chans.at(i);
|
||||||
|
if (code == CPAP_AHI) continue;
|
||||||
|
|
||||||
|
|
||||||
|
schema::Channel & chan = schema::channel[code];
|
||||||
|
if (!chan.enabled())
|
||||||
|
continue;
|
||||||
|
schema::ChanType type = chan.type();
|
||||||
|
if (type == schema::SPAN)
|
||||||
|
continue;
|
||||||
|
eit = events.find(code);
|
||||||
|
QMap<EventStoreType, EventDataType>::iterator eit_end = eit.value().end();
|
||||||
|
for (it = times.begin(), vit = eit.value().begin(); vit != eit_end; ++vit, ++it) {
|
||||||
|
//float minutes = float(it.value()) / 60.0;
|
||||||
|
float value = vit.value();
|
||||||
|
maxev = qMax(value, maxev);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
float emult = height / float(maxev);
|
||||||
|
if (maxev < 0.00001) emult = 0;
|
||||||
|
|
||||||
|
|
||||||
|
for (int i=0; i< numchans; ++i) {
|
||||||
|
ChannelID code = chans.at(i);
|
||||||
|
if (code == CPAP_AHI) continue;
|
||||||
|
|
||||||
|
|
||||||
|
schema::Channel & chan = schema::channel[code];
|
||||||
|
if (!chan.enabled())
|
||||||
|
continue;
|
||||||
|
schema::ChanType type = chan.type();
|
||||||
|
if (type == schema::SPAN)
|
||||||
|
continue;
|
||||||
|
painter.setPen(QPen(QColor(chan.defaultColor()), 2));
|
||||||
|
eit = events.find(code);
|
||||||
|
xpos = left;//+pix/2;
|
||||||
|
|
||||||
|
y1 = 0;
|
||||||
|
QMap<EventStoreType, EventDataType>::iterator eit_end = eit.value().end();
|
||||||
|
for (it = times.begin(), vit = eit.value().begin(); vit != eit_end; ++vit, ++it) {
|
||||||
|
//float minutes = float(it.value()) / 60.0;
|
||||||
|
float value = vit.value();
|
||||||
|
|
||||||
|
y2 = value * emult;
|
||||||
|
//painter.drawPoint(xpos, bottom-y1);
|
||||||
|
|
||||||
|
painter.drawLine(xpos, bottom-y1, xpos+pix, bottom-y2);
|
||||||
|
|
||||||
|
xpos += pix;
|
||||||
|
y1 = y2;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QString txt=QString("%1 %2").arg(maxmins).arg(float(maxevents * 60.0) / maxmins);
|
||||||
|
graph.renderText(txt, rect.left(), rect.top()-10);
|
||||||
|
|
||||||
timelock.unlock();
|
timelock.unlock();
|
||||||
|
|
||||||
if (m_recalculating) {
|
if (m_recalculating) {
|
||||||
@ -374,7 +462,7 @@ void RecalcMAP::run()
|
|||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((lastdata != data) || (time > maxx)) {
|
if (lastdata != data) {
|
||||||
qint64 d1 = qMax(minx, lasttime);
|
qint64 d1 = qMax(minx, lasttime);
|
||||||
qint64 d2 = qMin(maxx, time);
|
qint64 d2 = qMin(maxx, time);
|
||||||
|
|
||||||
@ -396,13 +484,37 @@ void RecalcMAP::run()
|
|||||||
lasttime = time;
|
lasttime = time;
|
||||||
lastdata = data;
|
lastdata = data;
|
||||||
}
|
}
|
||||||
if (time > maxx) break;
|
if (time > maxx) {
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
skip:
|
skip:
|
||||||
if (m_quit) {
|
if (m_quit) {
|
||||||
m_done = true;
|
m_done = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (lasttime < maxx) {
|
||||||
|
qint64 d1 = qMax(lasttime, minx);
|
||||||
|
qint64 d2 = qMin(maxx, EL->last());
|
||||||
|
|
||||||
|
int duration = (d2 - d1) / 1000L;
|
||||||
|
EventStoreType key = floor(lastdata * gain);
|
||||||
|
if (key <= 30) {
|
||||||
|
times[key] += duration;
|
||||||
|
for (int c = 0; c < chans.size(); ++c) {
|
||||||
|
ChannelID code = chans.at(c);
|
||||||
|
schema::Channel & chan = schema::channel[code];
|
||||||
|
if (chan.type() == schema::SPAN) {
|
||||||
|
events[code][key] += sess->rangeSum(code, d1, d2);
|
||||||
|
} else {
|
||||||
|
events[code][key] += sess->rangeCount(code, d1, d2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -424,10 +536,22 @@ skip:
|
|||||||
}
|
}
|
||||||
chans.push_front(CPAP_AHI);
|
chans.push_front(CPAP_AHI);
|
||||||
|
|
||||||
|
int maxevents = 0, val;
|
||||||
|
|
||||||
for (int i = map->m_minpressure; i <= map->m_maxpressure; i++) {
|
for (int i = map->m_minpressure; i <= map->m_maxpressure; i++) {
|
||||||
events[CPAP_AHI].insert(i,events[CPAP_Obstructive][i] + events[CPAP_Hypopnea][i] + events[CPAP_Apnea][i] + events[CPAP_ClearAirway][i]);
|
val = events[CPAP_Obstructive][i] + events[CPAP_Hypopnea][i] + events[CPAP_Apnea][i] + events[CPAP_ClearAirway][i];
|
||||||
|
events[CPAP_AHI].insert(i, val);
|
||||||
|
// maxevents = qMax(val, maxevents);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int i = map->m_minpressure; i <= map->m_maxpressure; i++) {
|
||||||
|
for (int j=0 ; j < chans.size(); ++j) {
|
||||||
|
code = chans.at(j);
|
||||||
|
if ((code == CPAP_AHI) || (schema::channel[code].type() == schema::SPAN)) continue;
|
||||||
|
val = events[code][i];
|
||||||
|
maxevents = qMax(val, maxevents);
|
||||||
|
}
|
||||||
|
}
|
||||||
QHash<ChannelID, QMap<EventStoreType, EventDataType> >::iterator eit;
|
QHash<ChannelID, QMap<EventStoreType, EventDataType> >::iterator eit;
|
||||||
|
|
||||||
// for (int i=0; i< trash.size(); ++i) {
|
// for (int i=0; i< trash.size(); ++i) {
|
||||||
@ -444,6 +568,7 @@ skip:
|
|||||||
map->times = times;
|
map->times = times;
|
||||||
map->events = events;
|
map->events = events;
|
||||||
map->maxtime = maxtime;
|
map->maxtime = maxtime;
|
||||||
|
map->maxevents = maxevents;
|
||||||
map->chans = chans;
|
map->chans = chans;
|
||||||
map->m_presChannel = prescode;
|
map->m_presChannel = prescode;
|
||||||
timelock.unlock();
|
timelock.unlock();
|
||||||
|
@ -66,10 +66,13 @@ protected:
|
|||||||
QList<ChannelID> chans;
|
QList<ChannelID> chans;
|
||||||
QHash<ChannelID, QMap<EventStoreType, EventDataType> > events;
|
QHash<ChannelID, QMap<EventStoreType, EventDataType> > events;
|
||||||
int maxtime;
|
int maxtime;
|
||||||
|
int maxevents;
|
||||||
ChannelID m_presChannel;
|
ChannelID m_presChannel;
|
||||||
EventStoreType m_minpressure;
|
EventStoreType m_minpressure;
|
||||||
EventStoreType m_maxpressure;
|
EventStoreType m_maxpressure;
|
||||||
|
|
||||||
|
EventDataType max_mins;
|
||||||
|
|
||||||
QMap<EventStoreType, EventDataType> ahis;
|
QMap<EventStoreType, EventDataType> ahis;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -327,7 +327,7 @@ void CMS50F37Loader::processBytes(QByteArray bytes)
|
|||||||
|
|
||||||
len = lengths[res & 0x1f];
|
len = lengths[res & 0x1f];
|
||||||
|
|
||||||
if (size < len)
|
if (len > size)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
@ -432,7 +432,7 @@ void CMS50F37Loader::processBytes(QByteArray bytes)
|
|||||||
|
|
||||||
|
|
||||||
have_perfindex = (res == 0x9);
|
have_perfindex = (res == 0x9);
|
||||||
// m_startTime = QDateTime(imp_date, imp_time);
|
|
||||||
oxirec = new QVector<OxiRecord>;
|
oxirec = new QVector<OxiRecord>;
|
||||||
oxirec->reserve(30000);
|
oxirec->reserve(30000);
|
||||||
|
|
||||||
@ -476,14 +476,14 @@ void CMS50F37Loader::processBytes(QByteArray bytes)
|
|||||||
|
|
||||||
QStringList str;
|
QStringList str;
|
||||||
for (int i=0; i < len; ++i) {
|
for (int i=0; i < len; ++i) {
|
||||||
str.append(QString::number((unsigned char)buffer.at(idx + i)^0x80,16));
|
str.append(QString::number((unsigned char)buffer.at(idx + i),16));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!started_import) {
|
if (!started_import) {
|
||||||
// startTimer.singleShot(2000, this, SLOT(requestData()));
|
// startTimer.singleShot(2000, this, SLOT(requestData()));
|
||||||
qDebug() << "Read:" << str.join(",");
|
qDebug() << "Read:" << len << size << str.join(",");
|
||||||
} else {
|
} else {
|
||||||
qDebug() << "Import:" << str.join(",");
|
qDebug() << "Import:" << len << size << str.join(",");
|
||||||
}
|
}
|
||||||
|
|
||||||
idx += len;
|
idx += len;
|
||||||
|
@ -155,10 +155,10 @@ Daily::Daily(QWidget *parent,gGraphView * shared)
|
|||||||
const QString STR_GRAPH_DailySummary = "DailySummary";
|
const QString STR_GRAPH_DailySummary = "DailySummary";
|
||||||
const QString STR_GRAPH_TAP = "TimeAtPressure";
|
const QString STR_GRAPH_TAP = "TimeAtPressure";
|
||||||
|
|
||||||
gGraph * SG;
|
// gGraph * SG;
|
||||||
graphlist[STR_GRAPH_DailySummary] = SG = new gGraph(STR_GRAPH_DailySummary, GraphView, QObject::tr("Summary"), QObject::tr("Summary of this daily information"), default_height);
|
// graphlist[STR_GRAPH_DailySummary] = SG = new gGraph(STR_GRAPH_DailySummary, GraphView, QObject::tr("Summary"), QObject::tr("Summary of this daily information"), default_height);
|
||||||
SG->AddLayer(new gLabelArea(nullptr),LayerLeft,gYAxis::Margin);
|
// SG->AddLayer(new gLabelArea(nullptr),LayerLeft,gYAxis::Margin);
|
||||||
SG->AddLayer(AddCPAP(new gDailySummary()));
|
// SG->AddLayer(AddCPAP(new gDailySummary()));
|
||||||
|
|
||||||
graphlist[STR_GRAPH_SleepFlags] = SF = new gGraph(STR_GRAPH_SleepFlags, GraphView, STR_TR_EventFlags, STR_TR_EventFlags, default_height);
|
graphlist[STR_GRAPH_SleepFlags] = SF = new gGraph(STR_GRAPH_SleepFlags, GraphView, STR_TR_EventFlags, STR_TR_EventFlags, default_height);
|
||||||
SF->setPinned(true);
|
SF->setPinned(true);
|
||||||
|
@ -1322,7 +1322,7 @@ void MainWindow::on_action_About_triggered()
|
|||||||
QString("<br/>%1<br/>").arg(gitrev) +
|
QString("<br/>%1<br/>").arg(gitrev) +
|
||||||
tr("Graphics Engine: %1").arg(getGraphicsEngine())+
|
tr("Graphics Engine: %1").arg(getGraphicsEngine())+
|
||||||
"<br/>" +
|
"<br/>" +
|
||||||
tr("Data Folder Location: %1").arg(QDir::toNativeSeparators(GetAppRoot()) +
|
(tr("Data Folder Location: <a href=\"file://%1\">%2</a>").arg(GetAppRoot()).arg(QDir::toNativeSeparators(GetAppRoot())) +
|
||||||
"<hr/>"+tr("Copyright") + " ©2011-2014 Mark Watkins (jedimark) <br/> \n" +
|
"<hr/>"+tr("Copyright") + " ©2011-2014 Mark Watkins (jedimark) <br/> \n" +
|
||||||
tr("This software is released under the GNU Public License v3.0<br/>") +
|
tr("This software is released under the GNU Public License v3.0<br/>") +
|
||||||
"<hr>"
|
"<hr>"
|
||||||
@ -1346,10 +1346,10 @@ void MainWindow::on_action_About_triggered()
|
|||||||
// Credits section
|
// Credits section
|
||||||
"<hr/><p><b><font size='+1'>" +tr("Kudos & Credits") + "</font></b></p><b>" +
|
"<hr/><p><b><font size='+1'>" +tr("Kudos & Credits") + "</font></b></p><b>" +
|
||||||
tr("Bugfixes, Patches and Platform Help:") + "</b> " +
|
tr("Bugfixes, Patches and Platform Help:") + "</b> " +
|
||||||
tr("James Marshall, Rich Freeman, John Masters, Keary Griffin, Patricia Shanahan, Alec Clews, manders99, Sean Stangl and Roy Stone.")
|
tr("James Marshall, Rich Freeman, John Masters, Keary Griffin, Patricia Shanahan, Alec Clews, manders99, Sean Stangl, Roy Stone, François Revol, Michael Masterson.")
|
||||||
+ "</p>"
|
+ "</p>"
|
||||||
|
|
||||||
"<p><b>" + tr("Translators:") + "</b> " + tr("Arie Klerk (Dutch), Steffen Reitz (German), and others I've still to add here.") +
|
"<p><b>" + tr("Translators:") + "</b> " + tr("Arie Klerk (Dutch), Steffen Reitz and Marc Stephan (German), Chen Hao (Chinese), Lars-Erik Söderström (Swedish), Damien Vigneron (French), António Jorge Costa (Portuguese), Judith Guzmán (Spanish) and others I've still to add here.") +
|
||||||
"</p>"
|
"</p>"
|
||||||
|
|
||||||
"<p><b>" + tr("3rd Party Libaries:") + "</b> " +
|
"<p><b>" + tr("3rd Party Libaries:") + "</b> " +
|
||||||
@ -1357,7 +1357,7 @@ void MainWindow::on_action_About_triggered()
|
|||||||
+ " " +
|
+ " " +
|
||||||
tr("In the updater code, SleepyHead uses <a href=\"http://sourceforge.net/projects/quazip\">QuaZip</a> by Sergey A. Tachenov, which is a C++ wrapper over Gilles Vollant's ZIP/UNZIP package.")
|
tr("In the updater code, SleepyHead uses <a href=\"http://sourceforge.net/projects/quazip\">QuaZip</a> by Sergey A. Tachenov, which is a C++ wrapper over Gilles Vollant's ZIP/UNZIP package.")
|
||||||
+ "<br/>"
|
+ "<br/>"
|
||||||
"<p>" + tr("Special thanks to Pugsy from <a href='http://cpaptalk.com'>CPAPTalk</a> for her help with documentation and tutorials, as well as everyone who helped out by testing and sharing their CPAP data.")
|
"<p>" + tr("Special thanks to Pugsy and Robysue from <a href='http://cpaptalk.com'>CPAPTalk</a> for their help with documentation and tutorials, as well as everyone who helped out by testing and sharing their CPAP data.")
|
||||||
+ "</p>"
|
+ "</p>"
|
||||||
|
|
||||||
// Donations
|
// Donations
|
||||||
|
Loading…
Reference in New Issue
Block a user