Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LIMS-1515: Add energy value to data collections #853

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 25 additions & 8 deletions api/src/Page/DC.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ class DC extends Page
array('/dat/:id', 'get', '_plot'),
);

const EVTOA = 12398.4198;

# ------------------------------------------------------------------------
# Data Collection AJAX Requests
# This is pretty crazy, it will return unioned data collections, energy
Expand Down Expand Up @@ -422,9 +424,12 @@ function _data_collections($single = null)
dc.transmission,
dc.axisrange,
dc.wavelength,
".self::EVTOA."/dc.wavelength as energy,
dc.comments,
1 as epk,
1 as ein,
1 as wpk,
1 as win,
dc.xtalsnapshotfullpath1 as x1,
dc.xtalsnapshotfullpath2 as x2,
dc.xtalsnapshotfullpath3 as x3,
Expand Down Expand Up @@ -556,9 +561,12 @@ function _data_collections($single = null)
min(dc.transmission) as transmission,
min(dc.axisrange) as axisrange,
min(dc.wavelength) as wavelength,
".self::EVTOA."/min(dc.wavelength) as energy,
min(dc.comments) as comments,
1 as epk,
1 as ein,
1 as wpk,
1 as win,
min(dc.xtalsnapshotfullpath1) as x1,
min(dc.xtalsnapshotfullpath2) as x2,
min(dc.xtalsnapshotfullpath3) as x3,
Expand Down Expand Up @@ -705,17 +713,20 @@ function _data_collections($single = null)
es.energyscanid,
1,
es.element,
es.peakfprime,
es.peakfprime as resolution,
es.exposuretime,
es.axisposition,
es.peakfdoubleprime,
es.peakfdoubleprime as numimg,
es.starttime as st,
es.transmissionfactor,
es.inflectionfprime,
es.inflectionfdoubleprime,
es.inflectionfprime as axisrange,
es.inflectionfdoubleprime as wavelength,
1 as energy,
es.comments,
es.peakenergy,
es.inflectionenergy,
".self::EVTOA."/es.peakenergy as wpk,
".self::EVTOA."/es.inflectionenergy as win,
'A',
'A',
'A',
Expand Down Expand Up @@ -805,10 +816,13 @@ function _data_collections($single = null)
TO_CHAR(xrf.starttime, 'DD-MM-YYYY HH24:MI:SS') as st,
xrf.beamtransmission,
1,
xrf.energy,
".self::EVTOA."/xrf.energy as wavelength,
xrf.energy as energy,
xrf.comments,
1,
1,
1 as wpk,
1 as win,
'A',
'A',
'A',
Expand Down Expand Up @@ -899,9 +913,12 @@ function _data_collections($single = null)
1,
1,
1,
1 as energy,
'A',
1,
1,
1 as wpk,
1 as win,
r.xtalsnapshotbefore,
r.xtalsnapshotafter,
'A',
Expand Down Expand Up @@ -974,7 +991,7 @@ function _data_collections($single = null)

// Data collections
if ($dc['TYPE'] == 'data') {
$nf = array(1 => array('AXISSTART', 'CHISTART', 'PHI', 'OVERLAP'), 2 => array('RESOLUTION', 'TRANSMISSION', 'AXISRANGE', 'TOTALDOSE'), 4 => array('WAVELENGTH', 'EXPOSURETIME'));
$nf = array(0 => array('ENERGY'), 1 => array('AXISSTART', 'CHISTART', 'PHI', 'OVERLAP'), 2 => array('RESOLUTION', 'TRANSMISSION', 'AXISRANGE', 'TOTALDOSE'), 4 => array('WAVELENGTH', 'EXPOSURETIME'));

$dc['DIRFULL'] = $dc['DIR'];
$dc['DIR'] = preg_replace('/.*\/' . $this->arg('prop') . '-' . $dc['VN'] . '\//', '', $dc['DIR']);
Expand Down Expand Up @@ -1010,12 +1027,12 @@ function _data_collections($single = null)

$dc['FILETEMPLATE'] = preg_replace('/.*\/' . $this->arg('prop') . '-' . $dc['VN'] . '\//', '', $dc['FILETEMPLATE']);

$nf = array(2 => array('EXPOSURETIME', 'AXISSTART', 'RESOLUTION', 'TRANSMISSION'));
$nf = array(1 => array('EPK', 'EIN'), 2 => array('AXISRANGE', 'WAVELENGTH', 'EXPOSURETIME', 'AXISSTART', 'RESOLUTION', 'TRANSMISSION', 'NUMIMG'), 5 => array('WPK', 'WIN'));
$this->profile('edge');

// MCA Scans
} else if ($dc['TYPE'] == 'mca') {
$nf = array(2 => array('EXPOSURETIME', 'WAVELENGTH', 'TRANSMISSION'));
$nf = array(0 => array('ENERGY'), 2 => array('EXPOSURETIME', 'TRANSMISSION'), 4 => array('WAVELENGTH'));
$dc['DIRFULL'] = $dc['DIR'];
$dc['DIR'] = preg_replace('/.*\/\d\d\d\d\/\w\w\d+-\d+\//', '', $dc['DIR']);

Expand Down
2 changes: 1 addition & 1 deletion client/src/js/templates/dc/dc.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ <h1 class="title"></h1>
<% if (SI != 1 ) { %> <li data-testid="dc-first-image">First Image: <%-SI%></li><% } %>
<% if ((KAPPA && KAPPA !=0) || (PHI && PHI != 0) || (CHISTART && CHISTART !=0)) { %><li data-testid="dc-kappa-phi-chi"><% if (KAPPA != null) { %>&kappa;: <%-KAPPA%>&deg;<% } %> <% if (PHI != null) { %>&phi;: <%-PHI%>&deg;<% } %> <% if (CHISTART != null) { %>&chi;: <%-CHISTART%>&deg;<% } %></li><% } %>
<li data-testid="dc-resolution">Resolution: <%-RESOLUTION%>&#197;</li>
<li data-testid="dc-wavelength">Wavelength: <%-WAVELENGTH%>&#197;</li>
<li data-testid="dc-wavelength">Wavelength: <%-WAVELENGTH%>&#197; (<%-ENERGY%>eV)</li>
<li data-testid="dc-exposure-time">Exposure: <%-EXPOSURETIME%>s</li>
<%if (DCC > 1 && TOTALDOSE) { %>
<li data-testid="dc-dose">Total Dose: <%-TOTALDOSE%>MGy</li>
Expand Down
10 changes: 5 additions & 5 deletions client/src/js/templates/dc/edge.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ <h1>
</h1>

<ul class="clearfix half">
<li>Scan File: <%-FILETEMPLATE%></li>
<li>E(Peak): <%-EPK.toFixed(1) %>eV (<% print ((12398.4193/EPK).toFixed(4)) %>&#197;)</li>
<li>f&rsquo;&rsquo;: <%-NUMIMG%> / f&rsquo;: <%-RESOLUTION%>e</li>
<li>E(Inf): <%-EIN.toFixed(1) %>eV (<% print((12398.4193/EIN).toFixed(4)) %>&#197;)</li>
<li>f&rsquo;&rsquo;: <%-WAVELENGTH%> / f&rsquo;: <%-AXISRANGE%>e</li>
<li class="comment">Scan File: <%-FILETEMPLATE%></li>
<li>E(Peak): <%-EPK%>eV (<%-WPK%>&#197;)</li>
<li>f&rsquo;&rsquo;: <%-NUMIMG%>e<sup>-</sup> / f&rsquo;: <%-RESOLUTION%>e<sup>-</sup></li>
<li>E(Inf): <%-EIN%>eV (<%-WIN%>&#197;)</li>
<li>f&rsquo;&rsquo;: <%-WAVELENGTH%>e<sup>-</sup> / f&rsquo;: <%-AXISRANGE%>e<sup>-</sup></li>
<li>Exposure: <%-EXPOSURETIME%>s</li>
<li>Transmission: <%-TRANSMISSION%>%</li>
<li>Beamsize: <%-BSX%>x<%-BSY%>&mu;m</li>
Expand Down
2 changes: 1 addition & 1 deletion client/src/js/templates/dc/grid.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ <h1 class="title"></h1>
<li>&<%-ROTATIONAXIS%>; Start: <%-AXISSTART%>&deg;</li>
<% if ((KAPPA && KAPPA !=0) || (PHI && PHI != 0) || (CHISTART && CHISTART !=0)) { %><li><% if (KAPPA != null) { %>&kappa;: <%-KAPPA%>&deg;<% } %> <% if (PHI != null) { %>&phi;: <%-PHI%>&deg;<% } %> <% if (CHISTART != null) { %>&chi;: <%-CHISTART%>&deg;<% } %></li><% } %>
<li>Resolution: <%-RESOLUTION%>&#197;</li>
<li>Wavelength: <%-WAVELENGTH%>&#197;</li>
<li>Wavelength: <%-WAVELENGTH%>&#197; (<%-ENERGY%>eV)</li>
<li>Exposure: <%-EXPOSURETIME%>s</li>
<li>Transmission: <%-TRANSMISSION%>%</li>
<li>Beamsize: <%-BSX%>x<%-BSY%>&mu;m</li>
Expand Down
4 changes: 2 additions & 2 deletions client/src/js/templates/dc/mca.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ <h1>
</h1>

<ul class="clearfix half">
<li>Energy: <%-WAVELENGTH%>eV</li>
<li>Energy: <%-ENERGY%>eV (<%-WAVELENGTH%>&#197;)</li>
<li>Exposure: <%-EXPOSURETIME%>s</li>
<li>Transmission: <%-TRANSMISSION%>%</li>
<li>Beamsize: <%-BSX%>x<%-BSY%>&mu;m</li>
<li>Axis Position: <%-AXISSTART%>&deg;</li>
<li class="comment" title="Click to edit the comment for this mca spectrum">Comment: <span class="COMMENTS"><%-COMMENTS%></span></li>
</ul>
</div>
</div>
Loading