Skip to content

Commit d19fb86

Browse files
ndg63276Mark Williams
andauthored
LIMS-1515: Add energy value to data collections (#853)
* LIMS-1515: Add energy value to data collections * LIMS-1515: Use a class constant --------- Co-authored-by: Mark Williams <[email protected]>
1 parent 4452872 commit d19fb86

File tree

5 files changed

+34
-17
lines changed

5 files changed

+34
-17
lines changed

api/src/Page/DC.php

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ class DC extends Page
6262
array('/dat/:id', 'get', '_plot'),
6363
);
6464

65+
const EVTOA = 12398.4198;
66+
6567
# ------------------------------------------------------------------------
6668
# Data Collection AJAX Requests
6769
# This is pretty crazy, it will return unioned data collections, energy
@@ -422,9 +424,12 @@ function _data_collections($single = null)
422424
dc.transmission,
423425
dc.axisrange,
424426
dc.wavelength,
427+
".self::EVTOA."/dc.wavelength as energy,
425428
dc.comments,
426429
1 as epk,
427430
1 as ein,
431+
1 as wpk,
432+
1 as win,
428433
dc.xtalsnapshotfullpath1 as x1,
429434
dc.xtalsnapshotfullpath2 as x2,
430435
dc.xtalsnapshotfullpath3 as x3,
@@ -556,9 +561,12 @@ function _data_collections($single = null)
556561
min(dc.transmission) as transmission,
557562
min(dc.axisrange) as axisrange,
558563
min(dc.wavelength) as wavelength,
564+
".self::EVTOA."/min(dc.wavelength) as energy,
559565
min(dc.comments) as comments,
560566
1 as epk,
561567
1 as ein,
568+
1 as wpk,
569+
1 as win,
562570
min(dc.xtalsnapshotfullpath1) as x1,
563571
min(dc.xtalsnapshotfullpath2) as x2,
564572
min(dc.xtalsnapshotfullpath3) as x3,
@@ -705,17 +713,20 @@ function _data_collections($single = null)
705713
es.energyscanid,
706714
1,
707715
es.element,
708-
es.peakfprime,
716+
es.peakfprime as resolution,
709717
es.exposuretime,
710718
es.axisposition,
711-
es.peakfdoubleprime,
719+
es.peakfdoubleprime as numimg,
712720
es.starttime as st,
713721
es.transmissionfactor,
714-
es.inflectionfprime,
715-
es.inflectionfdoubleprime,
722+
es.inflectionfprime as axisrange,
723+
es.inflectionfdoubleprime as wavelength,
724+
1 as energy,
716725
es.comments,
717726
es.peakenergy,
718727
es.inflectionenergy,
728+
".self::EVTOA."/es.peakenergy as wpk,
729+
".self::EVTOA."/es.inflectionenergy as win,
719730
'A',
720731
'A',
721732
'A',
@@ -805,10 +816,13 @@ function _data_collections($single = null)
805816
TO_CHAR(xrf.starttime, 'DD-MM-YYYY HH24:MI:SS') as st,
806817
xrf.beamtransmission,
807818
1,
808-
xrf.energy,
819+
".self::EVTOA."/xrf.energy as wavelength,
820+
xrf.energy as energy,
809821
xrf.comments,
810822
1,
811823
1,
824+
1 as wpk,
825+
1 as win,
812826
'A',
813827
'A',
814828
'A',
@@ -899,9 +913,12 @@ function _data_collections($single = null)
899913
1,
900914
1,
901915
1,
916+
1 as energy,
902917
'A',
903918
1,
904919
1,
920+
1 as wpk,
921+
1 as win,
905922
r.xtalsnapshotbefore,
906923
r.xtalsnapshotafter,
907924
'A',
@@ -974,7 +991,7 @@ function _data_collections($single = null)
974991

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

979996
$dc['DIRFULL'] = $dc['DIR'];
980997
$dc['DIR'] = preg_replace('/.*\/' . $this->arg('prop') . '-' . $dc['VN'] . '\//', '', $dc['DIR']);
@@ -1011,12 +1028,12 @@ function _data_collections($single = null)
10111028

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

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

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

client/src/js/templates/dc/dc.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ <h1 class="title"></h1>
2424
<% if (SI != 1 ) { %> <li data-testid="dc-first-image">First Image: <%-SI%></li><% } %>
2525
<% 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><% } %>
2626
<li data-testid="dc-resolution">Resolution: <%-RESOLUTION%>&#197;</li>
27-
<li data-testid="dc-wavelength">Wavelength: <%-WAVELENGTH%>&#197;</li>
27+
<li data-testid="dc-wavelength">Wavelength: <%-WAVELENGTH%>&#197; (<%-ENERGY%>eV)</li>
2828
<li data-testid="dc-exposure-time">Exposure: <%-EXPOSURETIME%>s</li>
2929
<%if (DCC > 1 && TOTALDOSE) { %>
3030
<li data-testid="dc-dose">Total Dose: <%-TOTALDOSE%>MGy</li>

client/src/js/templates/dc/edge.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ <h1>
99
</h1>
1010

1111
<ul class="clearfix half">
12-
<li>Scan File: <%-FILETEMPLATE%></li>
13-
<li>E(Peak): <%-EPK.toFixed(1) %>eV (<% print ((12398.4193/EPK).toFixed(4)) %>&#197;)</li>
14-
<li>f&rsquo;&rsquo;: <%-NUMIMG%> / f&rsquo;: <%-RESOLUTION%>e</li>
15-
<li>E(Inf): <%-EIN.toFixed(1) %>eV (<% print((12398.4193/EIN).toFixed(4)) %>&#197;)</li>
16-
<li>f&rsquo;&rsquo;: <%-WAVELENGTH%> / f&rsquo;: <%-AXISRANGE%>e</li>
12+
<li class="comment">Scan File: <%-FILETEMPLATE%></li>
13+
<li>E(Peak): <%-EPK%>eV (<%-WPK%>&#197;)</li>
14+
<li>f&rsquo;&rsquo;: <%-NUMIMG%>e<sup>-</sup> / f&rsquo;: <%-RESOLUTION%>e<sup>-</sup></li>
15+
<li>E(Inf): <%-EIN%>eV (<%-WIN%>&#197;)</li>
16+
<li>f&rsquo;&rsquo;: <%-WAVELENGTH%>e<sup>-</sup> / f&rsquo;: <%-AXISRANGE%>e<sup>-</sup></li>
1717
<li>Exposure: <%-EXPOSURETIME%>s</li>
1818
<li>Transmission: <%-TRANSMISSION%>%</li>
1919
<li>Beamsize: <%-BSX%>x<%-BSY%>&mu;m</li>

client/src/js/templates/dc/grid.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ <h1 class="title"></h1>
88
<li>&<%-ROTATIONAXIS%>; Start: <%-AXISSTART%>&deg;</li>
99
<% 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><% } %>
1010
<li>Resolution: <%-RESOLUTION%>&#197;</li>
11-
<li>Wavelength: <%-WAVELENGTH%>&#197;</li>
11+
<li>Wavelength: <%-WAVELENGTH%>&#197; (<%-ENERGY%>eV)</li>
1212
<li>Exposure: <%-EXPOSURETIME%>s</li>
1313
<li>Transmission: <%-TRANSMISSION%>%</li>
1414
<li>Beamsize: <%-BSX%>x<%-BSY%>&mu;m</li>

client/src/js/templates/dc/mca.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ <h1>
1010
</h1>
1111

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

0 commit comments

Comments
 (0)