QXRD  0.11.16
Functions | Variables
qxrdscriptengine.cpp File Reference

(Commit a65ccc9... : jennings : 2016-03-15 14:00:18 -0500)

#include "qxrddebug.h"
#include "qxrdscriptengine.h"
#include "qxrdapplication.h"
#include "qxrdwindow.h"
#include "qxrdexperiment.h"
#include "qxrdacquisition.h"
#include "qxrdcenterfinder.h"
#include "qxrddataprocessor.h"
#include "qxrdcalibrantlibrary.h"
#include "qxrdcalibrant.h"
#include "qxrdintegrator.h"
#include "qcepmutexlocker.h"
#include "qxrdgeneratetestimage.h"
#include "qxrdsynchronizedacquisition.h"
#include "qxrdnidaqplugininterface.h"
#include "qxrdacquisitionextrainputs.h"
#include "qcepallocator.h"
#include "qxrdserver.h"
#include "qxrdsimpleserver.h"
#include "qcepdocumentationdictionary.h"
#include "qcepdatagroup.h"
#include "qcepdatagroup-ptr.h"
#include "qcepdataarray.h"
#include "qcepdataarray-ptr.h"
#include "qcepdatacolumn.h"
#include "qcepdatacolumn-ptr.h"
#include "qcepdatacolumnscan.h"
#include "qcepdatacolumnscan-ptr.h"
#include "qcepdatasetmodel.h"
#include "qxrddetectorprocessor.h"
#include "qxrdroicalculator.h"
#include "qxrdroicoordinates.h"
#include "qxrdroicoordinateslistmodel.h"
#include <QThread>
#include <QDir>
#include <QScriptValueIterator>
#include <QMetaObject>
#include <QMetaProperty>
#include <QRegExp>
Include dependency graph for qxrdscriptengine.cpp:

Go to the source code of this file.

Functions

 QCEP_DOC_FUNCTION ("print","print([value]...)","Print values to the log file and message window","<p>The values of the arguments are catenated into a single string which is ""printed to the log file and to the message window</p>\n""<p>The following is a typical use: print out the names and values of the ""elements of an object:</p>\n""<code>""for(i in acquisition) print(i, acquisition[i])""</code>") QScriptValue QxrdScriptEngine
 
 QCEP_DOC_FUNCTION ("fopen","fopen(fileName)","Open a script output file","<p>The fileName given is opened as the current output file ussed by fprint</p>\n""<p>Only one script output file may be open at a time</p>\n") QScriptValue QxrdScriptEngine
 
 QCEP_DOC_FUNCTION ("fprint","fprint([value]...)","Print values to the script output file","<p>The values of the arguments are catenated into a single string which is ""printed to the script output file</p>\n""<p>The following is a typical use: print out the names and values of the ""elements of an object:</p>\n""<code>""for(i in acquisition) fprint(i, acquisition[i])""</code>") QScriptValue QxrdScriptEngine
 
 QCEP_DOC_FUNCTION ("fclose","fclose()","Closes the script output file","<p>Note that only one script output file may be open at a time</p>\n") QScriptValue QxrdScriptEngine
 
 QCEP_DOC_FUNCTION ("fdelete","fdelete(path)","Deletes a file","<p>If the file does not exist no error occurs</p>") QScriptValue QxrdScriptEngine
 
 QCEP_DOC_FUNCTION ("acquire","acquire([fileName[, exposure[, summedExposures[, postTriggerFiles[, preTriggerFiles[, nPhases]]]]]])","Start acquisition of a sequence of images","<p>The arguments are optional and may be successively omitted from the ""right. If <i>preTriggerFiles</i> is omitted, zero is used instead. ""If <i>nPhases</i> is omitted, one is used. ""Any other argument which is omitted will take its value ""instead from the values entered in the acquire dialog. Any ""argument which is given will replace the corresponding value ""in the acquire dialog.</p>\n""<p>Note that the script function merely starts the acquisition ""- you should use the separate \"status\" function to wait for ""acquisition and processing to be completed.</p>\n""<p>The following is a typical example of the use of this ""command from spec:</p>\n""<code>""def PEexp(filename,exposure,subframes,frames) '{<br/>""&nbsp;&nbsp;remote_eval(PEHOST,""sprintf(\"acquire(\\\"%s\\\",%g,%d,%d,0)\",filename,exposure,subframes,frames));<br/>""&nbsp;&nbsp;<br/> &nbsp;&nbsp;PEwait()<br/> }'<br/>""</code>") QScriptValue QxrdScriptEngine
 
 QCEP_DOC_FUNCTION ("acquireDark","acquireDark([filename [,exposure [,darkSummedExposures]]])","Start acquisition of a dark image","<p>Arguments are optional and, if given, will replace the ""corresponding value in the acquire dialog, if not given the ""dialog values are used.</p>\n""<p>The following is a typical example of the use of this ""command from spec:</p>\n""<code>\n""def PEexpd(filename, exposure, subframes) '{<br/>\n""&nbsp;&nbsp;remote_eval(PEHOST,""sprintf(\"acquireDark(\\\"%s\\\",%g,%d)\",filename,exposure,subframes));<br/>\n""&nbsp;&nbsp;<br/> &nbsp;&nbsp;PEwait()<br/> }'<br/>\n""</code>\n") QScriptValue QxrdScriptEngine
 
 QCEP_DOC_FUNCTION ("status","status([time])","Test if acquisition and processing have finished","<p>""If the argument is given the function will wait up to that ""many seconds - if acquisition and processing finish before ""the time elapsed then <code>status</code> will return at ""that time, otherwise at the end of the timeout period. The ""function returns a non-zero result if acquisition and ""processing are complete, or zero if they are not.""</p>\n""<p>""If no argument is given the function tests if acquisition ""and processing are complete and returns the result of the ""test immediately.""</p>\n""<p>""The following is a typical use of this command from spec:""</p>\n""<code>""def PEwait() '{<br/>""&nbsp;&nbsp;while(remote_eval(PEHOST,\"status(1.0)\")==0) {<br/>""&nbsp;&nbsp;}<br/> }'<br/>""</code>\n") QScriptValue QxrdScriptEngine
 
 QCEP_DOC_FUNCTION ("acquireStatus","acquireStatus([time])","Test if acquisition has finished","<p>""Similar to 'status' ""except that it only tests for the acquisition operation being complete.""</p>") QScriptValue QxrdScriptEngine
 
 QCEP_DOC_FUNCTION ("processStatus","processStatus([time])","Test if processing has finished","<p>""Similar to 'status' ""except that it only tests for the processing operation being complete.""</p>") QScriptValue QxrdScriptEngine
 
 QCEP_DOC_FUNCTION ("acquireCancel","acquireCancel()","Cancel the current acquisition operation","") QScriptValue QxrdScriptEngine
 
 QCEP_DOC_FUNCTION ("acquireScalers","vals <- acquireScalers()","Returns the scaler counts values for the latest acquisition operation","") QScriptValue QxrdScriptEngine
 
 QCEP_DOC_FUNCTION ("trigger","trigger()","Trigger triggered acquisition","<p>If 'preTriggerFiles' is greater than zero then acquisition operations proceed in the ""'triggered' mode. This acts much like a digital oscilloscope trigger where a certain number ""('preTriggerFiles') of acquired images are held in the computer RAM until the trigger operation occurs ""and then the most recent acquired images are written to disk, along with a number of post-trigger images</p>") QScriptValue QxrdScriptEngine
 
 QCEP_DOC_FUNCTION ("exposureTime","exposureTime([time])","Get or set the acquisition exposure time (also for dark exposures)","<p>If the time argument is given, set the exposure time, otherwise return the ""current exposure time</p>""<p>This function provides a convenient method to access the ""<code>acquisition.exposureTime</code> property</p>") QScriptValue QxrdScriptEngine
 
 QCEP_DOC_FUNCTION ("summedExposures","summedExposures([n])","Get or set the number of summed exposures for acquisition","<p>If the n argument is given, set the number of summed exposures, otherwise return the ""current value.</p>""<p>Easy access to <code>acquisition.summedExposures</code></p>") QScriptValue QxrdScriptEngine
 
 QCEP_DOC_FUNCTION ("skippedExposures","skippedExposures([n])","Get or set the number of skipped exposures for acquisition","<p>If the n argument is given, set the number of skipped exposures, otherwise return the ""current value.</p>""<p>Easy access to <code>acquisition.skippedExposures</code></p>") QScriptValue QxrdScriptEngine
 
 QCEP_DOC_FUNCTION ("darkSummedExposures","darkSummedExposures([n])","Get or set the number of summed exposures for dark acquisition","<p>If the n argument is given, set the number of summed exposures, otherwise return the ""current value.</p>""<p>Easy access to <code>acquisition.darkSummedExposures</code></p>") QScriptValue QxrdScriptEngine
 
 QCEP_DOC_FUNCTION ("phasesInGroup","phasesInGroup([n])","Get or set the number of phases for synchronized acquisition","<p>If the n argument is given, set the number of phases, otherwise return the ""current value.</p>""<p>Easy access to <code>acquisition.phasesInGroup</code></p>") QScriptValue QxrdScriptEngine
 
 QCEP_DOC_FUNCTION ("preTriggerFiles","preTriggerFiles([n])","Get or set the number of pre-trigger file groups for triggered acquisition","<p>If the n argument is given, set the number of pre-trigger file groups, otherwise return the ""current value.</p>""<p>Easy access to <code>acquisition.preTriggerFiles</code></p>") QScriptValue QxrdScriptEngine
 
 QCEP_DOC_FUNCTION ("postTriggerFiles","postTriggerFiles([n])","Get or set the number of post-trigger file groups for triggered acquisition","<p>If the n argument is given, set the number of post-trigger file groups, otherwise return the ""current value.</p>""<p>Easy access to <code>acquisition.postTriggerFiles</code></p>") QScriptValue QxrdScriptEngine
 
 QCEP_DOC_FUNCTION ("filePattern","filePattern([pattern])","Get or set the acquisition file name pattern","<p>If the pattern argument is given, set the file name pattern, otherwise return the ""current value.</p>""<p>Easy access to <code>acquisition.filePattern</code></p>") QScriptValue QxrdScriptEngine
 
 QCEP_DOC_FUNCTION ("outputDirectory","outputDirectory([dir])","Get or set the acquisition output directory","<p>If the dir argument is given, set the output directory, otherwise return the ""current value.</p>""<p>Easy access to <code>experiment.dataDirectory</code></p>") QScriptValue QxrdScriptEngine
 
 QCEP_DOC_FUNCTION ("fileIndex","fileIndex([n])","Get or set the acquisition file index","<p>If the n argument is given, set the file index, otherwise return the ""current value.</p>""<p>Easy access to <code>acquisition.fileIndex</code></p>") QScriptValue QxrdScriptEngine
 
 QCEP_DOC_FUNCTION ("data","data()","Get the current image","<p>Returns a reference to the most recently acquired or most recently loaded image.</p>""<p>The returned object can have its properties queried.</p>""<p>Note that the value returned by this function will change as each ""new image is acquired so be careful if calling this function during acquisition.</p>") QScriptValue QxrdScriptEngine
 
 QCEP_DOC_FUNCTION ("dark","dark()","Get the dark image (or null if none has been taken)","<p>Returns a reference to the current dark image.</p>""<p>The returned object can have its properties queried.</p>""<p>For example, to get the file name of the dark image:</p>""<code>print(dark().fileName)</code>""<p>Or to show a list of properties of the dark image:</p>""<code>for(i in dark()) print(i, dark()[i])</code>") QScriptValue QxrdScriptEngine
 
 QCEP_DOC_FUNCTION ("mask","mask()","Get the top item of the mask stack","<p>Returns a reference to the top of the mask stack, or null if the ""mask stack is empty.</p>") QScriptValue QxrdScriptEngine
 
 QCEP_DOC_FUNCTION ("overflow","overflow()","Get the overflow pixel map for acquired images","<p>Returns the overflow pixels map for the most recently acquired image ""(if overflow processing is enabled)</p>\n""<p>The overflow map is non-zero wherever an image pixel exceeded the overflow ""threshold during acquisition. Where more than one exposures are summed, the overflow ""map will count the number of exposures for which the pixel overflowed.</p>") QScriptValue QxrdScriptEngine
 
 QCEP_DOC_FUNCTION ("liveData","liveData()","Get the current live view image","<p>Returns a reference to the most recently acquired live view image.</p>""<p>The returned object can have its properties queried.</p>""<p>Note that the value returned by this function will change as each ""new live view image is acquired so be careful when calling this function.</p>") QScriptValue QxrdScriptEngine
 
 QCEP_DOC_FUNCTION ("help","help([name...])","Returns help text for a given name or names","<p>Returns a string containing an html representation of the help text ""for a name or names. If more than one name is given the result is the ""concatenation of the help for each name in turn</p>""<p>The names may contain wildcard characters, the result will contain help ""for all available matching the wildcard patterns.</p>""<p>If no name is given the command returns help for the help command itself.</p>""<p>If the command is executed in the QXRD script window the html result will ""be properly formatted in the message window.</p>""<p>For example:</p>""<code>help(\"help\")</code>") QScriptValue QxrdScriptEngine
 
 QCEP_DOC_FUNCTION ("extraChannel","extraChannel(n)","Access channels for extra inputs","<p>Returns a reference to configuration data for an extra input channel.</p>""<p>Example: to access the acquired waveform for extra channel 0</p>""<code>extraChannel(0).waveform</code>") QScriptValue QxrdScriptEngine
 
 QCEP_DOC_FUNCTION ("process","process(filename [, norm...])","Load and process an image file","<p>Load and process the file filename. The norm arguments are used as ""normalization values during processing</p>""<p>The function is closely related to</p>""<code>processor.processNormalizedFile(QString,QDoubleList)</code>") QScriptValue QxrdScriptEngine
 
 QCEP_DOC_FUNCTION ("setFileNormalization","setFileNormalization(filename [, norm...])","Set the normalization values for an image file","<p>Loads the file filename, sets its normalization values and ""rewrites the metadata file</p>""<p>The function is closely related to</p>""<code>processor.setFileNormalization(QString,QDoubleList)</code>") QScriptValue QxrdScriptEngine
 
 QCEP_DOC_FUNCTION ("matchFiles","matchFiles([pattern]...)","Return a list of files matching a pattern","<p>Returns a list of file names matching the provided pattern(s).</p>""<p>The patterns support 'wild card' characters sush as * and ?.</p>""<p>Example - to calculate the sum of the pixel intensity of pixel 100,100 in ""all the TIFF files in the current directory:</p>""<code>var sum=0;<br/>\n""for(f in matchFiles(\"*.tif\") {<br/>\n""&nbsp;&nbsp;processor.loadData(f);<br/>\n""&nbsp;&nbsp;sum += data().getImageData(100,100);<br/>\n""}<br>") QScriptValue QxrdScriptEngine
 
 QCEP_DOC_FUNCTION ("mapUserFunction","mapUserFunction(functionname)","Map a user function over current data","") QScriptValue QxrdScriptEngine
 
 QCEP_DOC_FUNCTION ("timeStamp","timeStamp()","Returns system time as seconds since unix epoch","") QScriptValue QxrdScriptEngine
 
 QCEP_DOC_FUNCTION ("newDataGroup","newDataGroup(name)","Creates a new named data group","") QScriptValue QxrdScriptEngine
 
 QCEP_DOC_FUNCTION ("newDataArray","newDataArray(name,dim1 .. dimn)","Creates a new named n-dimensional data array","") QScriptValue QxrdScriptEngine
 
 QCEP_DOC_FUNCTION ("newDataColumn","newDataColumn(name, npts)","Creates a new named data column","") QScriptValue QxrdScriptEngine
 
 QCEP_DOC_FUNCTION ("newDataColumnScan","newDataColumnScan(name, npts, col1name .. colnname)","Creates a new named data column scan","") QScriptValue QxrdScriptEngine
 
 QCEP_DOC_FUNCTION ("newDataImage","newDataImage(name, width, height)","Creates a new named data image","") QScriptValue QxrdScriptEngine
 
 QCEP_DOC_FUNCTION ("newIntegratedData","newIntegratedData(name, size)","Creates a new integrated data object","") QScriptValue QxrdScriptEngine
 
 QCEP_DOC_FUNCTION ("detector","detector(n)","Returns a reference to the 'n'th detector","") QScriptValue QxrdScriptEngine
 
 QCEP_DOC_FUNCTION ("roi","roi(n,m)","Returns a reference to the 'm'th ROI of the 'n'th detector","") QScriptValue QxrdScriptEngine
 
 QCEP_DOC_OBJECT ("JSON","Qt Built-in JSON Parser") QCEP_DOC_FUNCTION("JSON.parse"
 
JSON parse (string)"
 
JSON Parse a string as a JSON< p > A built in function in the Qt script system</p > QCEP_DOC_FUNCTION ("JSON.stringify","JSON.stringify(object)","Produce JSON string representation of an object","<p>A built-in function in the Qt script system</p>") QCEP_DOC_FUNCTION("Math"
 

Variables

JSON Parse a string as a JSON object
 

Function Documentation

JSON parse ( string  )
QCEP_DOC_FUNCTION ( "print"  ,
"print([value]...)"  ,
"Print values to the log file and message window"  ,
"<p>The values of the arguments are catenated into a single string which is ""printed to the log file and to the message window</p>\n""<p>The following is a typical use: print out the names and values of the ""elements of an object:</p>\n""<code>""for(i in acquisition) print(i, acquisition[i])""</code>"   
)

Definition at line 286 of file qxrdscriptengine.cpp.

References QxrdScriptEngine::experiment().

292  : print out the names and values of the "
293  "elements of an object:</p>\n"
294  "<code>"
295  "for(i in acquisition) print(i, acquisition[i])"
296  "</code>"
297  )
298 
299 QScriptValue QxrdScriptEngine::printFunc(QScriptContext *context, QScriptEngine *engine, void * /*u*/)
300 {
301  QxrdScriptEngine *eng = qobject_cast<QxrdScriptEngine*>(engine);
302 
303  if (eng) {
304  int nArgs = context->argumentCount();
305  QString msg;
306 
307  for (int i=0; i<nArgs; i++) {
308  if (i != 0) {
309  msg += " ";
310  }
311 
312  msg += context -> argument(i).toString();
313  }
314 
315  QxrdExperimentPtr expt(eng->experiment());
316 
317  if (expt) {
318  expt->printLine(msg);
319  }
320  }
321 
322  return QScriptValue(engine, 1);
323 }

Here is the call graph for this function:

QCEP_DOC_FUNCTION ( "fopen"  ,
"fopen(fileName)"  ,
"Open a script output file"  ,
"<p>The fileName given is opened as the current output file ussed by fprint</p>\n""<p>Only one script output file may be open at a time</p>\n"   
)

Definition at line 325 of file qxrdscriptengine.cpp.

References QxrdScriptEngine::openScriptOutput().

334 {
335  QxrdScriptEngine *eng = qobject_cast<QxrdScriptEngine*>(engine);
336 
337  if (eng) {
338  int nArgs = context->argumentCount();
339 
340  if (nArgs >= 1) {
341  eng -> openScriptOutput(context -> argument(0).toString());
342  }
343  }
344 
345  return QScriptValue(engine, 1);
346 }

Here is the call graph for this function:

QCEP_DOC_FUNCTION ( "fprint"  ,
"fprint([value]...)"  ,
"Print values to the script output file"  ,
"<p>The values of the arguments are catenated into a single string which is ""printed to the script output file</p>\n""<p>The following is a typical use: print out the names and values of the ""elements of an object:</p>\n""<code>""for(i in acquisition) fprint(i, acquisition[i])""</code>"   
)

Definition at line 348 of file qxrdscriptengine.cpp.

References QxrdScriptEngine::writeScriptOutput().

354  : print out the names and values of the "
355  "elements of an object:</p>\n"
356  "<code>"
357  "for(i in acquisition) fprint(i, acquisition[i])"
358  "</code>"
359  )
360 
361 QScriptValue QxrdScriptEngine::fprintFunc(QScriptContext *context, QScriptEngine *engine, void * /*u*/)
362 {
363  QxrdScriptEngine *eng = qobject_cast<QxrdScriptEngine*>(engine);
364 
365  if (eng) {
366  int nArgs = context->argumentCount();
367  QString msg;
368 
369  for (int i=0; i<nArgs; i++) {
370  if (i != 0) {
371  msg += " ";
372  }
373 
374  msg += context -> argument(i).toString();
375  }
376 
377  eng -> writeScriptOutput(msg);
378  }
379 
380  return QScriptValue(engine, 1);
381 }

Here is the call graph for this function:

QCEP_DOC_FUNCTION ( "fclose"  ,
"fclose()"  ,
"Closes the script output file"  ,
"<p>Note that only one script output file may be open at a time</p>\n"   
)

Definition at line 383 of file qxrdscriptengine.cpp.

References QxrdScriptEngine::closeScriptOutput().

391 {
392  QxrdScriptEngine *eng = qobject_cast<QxrdScriptEngine*>(engine);
393 
394  if (eng) {
395  eng -> closeScriptOutput();
396  }
397 
398  return QScriptValue(engine, 1);
399 }

Here is the call graph for this function:

QCEP_DOC_FUNCTION ( "fdelete"  ,
"fdelete(path)"  ,
"Deletes a file"  ,
"<p>If the file does not exist no error occurs</p>"   
)

Definition at line 401 of file qxrdscriptengine.cpp.

409 {
410  QxrdScriptEngine *eng = qobject_cast<QxrdScriptEngine*>(engine);
411 
412  bool res = false;
413 
414  if (eng) {
415  QString path = context -> argument(0).toString();
416 
417  if (path.length() > 0) {
418  res = QFile::remove(path);
419  }
420  }
421 
422  return QScriptValue(engine, res);
423 }
QCEP_DOC_FUNCTION ( "acquire"  ,
"acquire([fileName[, exposure[, summedExposures[, postTriggerFiles[, preTriggerFiles[, nPhases]]]]]])"  ,
"Start acquisition of a sequence of images"  ,
"<p>The arguments are optional and may be successively omitted from the ""right. If <i>preTriggerFiles</i> is  omitted,
zero is used instead." "If< i >nPhases</i > is  omitted,
one is used." "Any other argument which is omitted will take its value" "instead from the values entered in the acquire dialog.Any" "argument which is given will replace the corresponding value" "in the acquire dialog.</p >\n" "< p >Note that the script function merely starts the acquisition" "-you should use the separate\"status\" function to wait for ""acquisition and processing to be completed.</p>\n""<p>The following is a typical example of the use of this ""command from spec:</p>\n""<code>""def PEexp(filename,exposure,subframes,frames) '{<br/>""&nbsp;&nbsp;remote_eval(PEHOST,""sprintf(\"acquire(\\\"%s\\\",%g,%d,%d,0)\",filename,exposure,subframes,frames));<br/>""&nbsp;&nbsp;<br/> &nbsp;&nbsp;PEwait()<br/> }'<br/>""</code>"   
)

Definition at line 425 of file qxrdscriptengine.cpp.

References QxrdScriptEngine::acquisition().

442  :</p>\n"
443  "<code>"
444  "def PEexp(filename,exposure,subframes,frames) '{<br/>"
445  "&nbsp;&nbsp;remote_eval(PEHOST,"
446  "sprintf(\"acquire(\\\"%s\\\",%g,%d,%d,0)\",filename,exposure,subframes,frames));<br/>"
447  "&nbsp;&nbsp;<br/> &nbsp;&nbsp;PEwait()<br/> }'<br/>"
448  "</code>"
449  )
450 
451 QScriptValue QxrdScriptEngine::acquireFunc(QScriptContext *context, QScriptEngine *engine)
452 {
453  QxrdScriptEngine *eng = qobject_cast<QxrdScriptEngine*>(engine);
454 
455  if (eng) {
456  QxrdAcquisitionPtr acq(eng->acquisition());
457 
458  if (!acq) return QScriptValue(engine, -1);
459 
460  int nArgs = context->argumentCount();
461 
462  if (nArgs < 6) {
463  acq -> set_PhasesInGroup(1);
464  }
465 
466  if (nArgs < 5) {
467  acq -> set_PreTriggerFiles(0);
468  }
469 
470  switch (nArgs) {
471  default:
472 
473  case 6:
474  acq -> set_PhasesInGroup(context -> argument(5).toUInt32());
475 
476  case 5:
477  acq -> set_PreTriggerFiles(context -> argument(4).toUInt32());
478 
479  case 4:
480  acq -> set_PostTriggerFiles(context -> argument(3).toUInt32());
481 
482  case 3:
483  acq -> set_SummedExposures(context -> argument(2).toUInt32());
484 
485  case 2:
486  acq -> set_ExposureTime(context -> argument(1).toNumber());
487 
488  case 1:
489  acq -> set_FilePattern(context -> argument(0).toString());
490 
491  case 0:
492  acq->acquire();
493  }
494  }
495 
496  return QScriptValue(engine, 1);
497 }

Here is the call graph for this function:

QCEP_DOC_FUNCTION ( "acquireDark"  ,
"acquireDark([filename [,exposure [,darkSummedExposures]]])"  ,
"Start acquisition of a dark image"  ,
"<p>Arguments are optional  and,
if  given,
will replace the" "corresponding value in the acquire  dialog,
if not given the" "dialog values are used.</p >\n" "< p >The following is a typical example of the use of this" "command from spec:</p >\n" "< code >\n" "def PEexpd(filename, exposure, subframes) '{< br/>\n" "&nbsp;&nbsp;remote_eval(PEHOST," "sprintf(\"acquireDark(\\\"%s\\\",%g,%d)\",filename,exposure,subframes));<br/>\n""&nbsp;&nbsp;<br/> &nbsp;&nbsp;PEwait()<br/> }'<br/>\n""</code>\n"   
)

Definition at line 499 of file qxrdscriptengine.cpp.

References QxrdScriptEngine::acquisition().

507  :</p>\n"
508  "<code>\n"
509  "def PEexpd(filename, exposure, subframes) '{<br/>\n"
510  "&nbsp;&nbsp;remote_eval(PEHOST,"
511  "sprintf(\"acquireDark(\\\"%s\\\",%g,%d)\",filename,exposure,subframes));<br/>\n"
512  "&nbsp;&nbsp;<br/> &nbsp;&nbsp;PEwait()<br/> }'<br/>\n"
513  "</code>\n"
514  )
515 
516 QScriptValue QxrdScriptEngine::acquireDarkFunc(QScriptContext *context, QScriptEngine *engine)
517 {
518  QxrdScriptEngine *eng = qobject_cast<QxrdScriptEngine*>(engine);
519 
520  if (eng) {
521  QxrdAcquisitionPtr acq(eng->acquisition());
522 
523  if (!acq) return QScriptValue(engine, -1);
524 
525  int nArgs = context->argumentCount();
526 
527  switch (nArgs) {
528  default:
529  case 3:
530  acq -> set_DarkSummedExposures(context -> argument(2).toUInt32());
531 
532  case 2:
533  acq -> set_ExposureTime(context -> argument(1).toNumber());
534 
535  case 1:
536  acq -> set_FilePattern(context -> argument(0).toString());
537 
538  case 0:
539  acq -> acquireDark();
540  }
541  }
542 
543  return QScriptValue(engine, 1);
544 }

Here is the call graph for this function:

QCEP_DOC_FUNCTION ( "status"  ,
"status([time])"  ,
"Test if acquisition and processing have finished"  ,
"<p>""If the argument is given the function will wait up to that ""many seconds - if acquisition and processing finish before ""the time elapsed then <code>status</code> will return at ""that  time,
otherwise at the end of the timeout period.The" "function returns a non-zero result if acquisition and" "processing are  complete,
or zero if they are not." "</p >\n" "< p >" "If no argument is given the function tests if acquisition" "and processing are complete and returns the result of the" "test immediately." "</p >\n" "< p >" "The following is a typical use of this command from spec:" "</p >\n" "< code >" "def PEwait() '{< br/>" "&nbsp;&nbsp;while(remote_eval(PEHOST,\"status(1.0)\")==0) {<br/>""&nbsp;&nbsp;}<br/> }'<br/>""</code>\n"   
)

Definition at line 546 of file qxrdscriptengine.cpp.

References QxrdScriptEngine::acquisition(), and QxrdScriptEngine::dataProcessor().

564  :"
565  "</p>\n"
566  "<code>"
567  "def PEwait() '{<br/>"
568  "&nbsp;&nbsp;while(remote_eval(PEHOST,\"status(1.0)\")==0) {<br/>"
569  "&nbsp;&nbsp;}<br/> }'<br/>"
570  "</code>\n"
571  )
572 
573 QScriptValue QxrdScriptEngine::statusFunc(QScriptContext *context, QScriptEngine *engine)
574 {
575  QxrdScriptEngine *eng = qobject_cast<QxrdScriptEngine*>(engine);
576 
577  if (eng) {
578  QxrdAcquisitionPtr acq(eng->acquisition());
579  QxrdDataProcessorPtr proc(eng->dataProcessor());
580 
581  if (!acq || !proc) return QScriptValue(engine, -1);
582 
583  double time=0;
584  int status=0;
585 
586  if (context->argumentCount() > 0) {
587  time = context->argument(0).toNumber();
588  }
589 
590  status = acq -> acquisitionStatus(time);
591 
592  if (status == 1) {
593  status = proc -> status(time);
594  }
595 
596  return QScriptValue(engine, status);
597  } else {
598  return QScriptValue(engine, -1);
599  }
600 }

Here is the call graph for this function:

QCEP_DOC_FUNCTION ( "acquireStatus"  ,
"acquireStatus([time])"  ,
"Test if acquisition has finished"  ,
"<p>""Similar to 'status' ""except that it only tests for the acquisition operation being complete.""</p>"   
)

Definition at line 602 of file qxrdscriptengine.cpp.

References QxrdScriptEngine::acquisition().

613 {
614  QxrdScriptEngine *eng = qobject_cast<QxrdScriptEngine*>(engine);
615 
616  if (eng) {
617  QxrdAcquisitionPtr acq(eng->acquisition());
618 
619  if (acq) {
620  if (context->argumentCount() == 0) {
621  return QScriptValue(engine, acq -> acquisitionStatus(0));
622  } else {
623  double time = context->argument(0).toNumber();
624  return QScriptValue(engine, acq -> acquisitionStatus(time));
625  }
626  }
627  }
628 
629  return QScriptValue(engine, -1);
630 }
QSharedPointer< QxrdAcquisition > QxrdAcquisitionPtr
QxrdAcquisitionWPtr acquisition() const

Here is the call graph for this function:

QCEP_DOC_FUNCTION ( "processStatus"  ,
"processStatus([time])"  ,
"Test if processing has finished"  ,
"<p>""Similar to 'status' ""except that it only tests for the processing operation being complete.""</p>"   
)

Definition at line 632 of file qxrdscriptengine.cpp.

References QxrdScriptEngine::dataProcessor().

643 {
644  QxrdScriptEngine *eng = qobject_cast<QxrdScriptEngine*>(engine);
645 
646  if (eng) {
647  QxrdDataProcessorPtr proc(eng->dataProcessor());
648 
649  if (proc) {
650  if (context->argumentCount() == 0) {
651  return QScriptValue(engine, proc -> status(0));
652  } else {
653  double time = context->argument(0).toNumber();
654  return QScriptValue(engine, proc -> status(time));
655  }
656  }
657  }
658 
659  return QScriptValue(engine, -1);
660 }
QSharedPointer< QxrdDataProcessor > QxrdDataProcessorPtr
QxrdDataProcessorWPtr dataProcessor() const

Here is the call graph for this function:

QCEP_DOC_FUNCTION ( "acquireCancel"  ,
"acquireCancel()"  ,
"Cancel the current acquisition operation"  ,
""   
)

Definition at line 662 of file qxrdscriptengine.cpp.

References QxrdScriptEngine::acquisition().

670 {
671  QxrdScriptEngine *eng = qobject_cast<QxrdScriptEngine*>(engine);
672 
673  if (eng) {
674  QxrdAcquisitionPtr acq(eng->acquisition());
675 
676  if (acq) {
677  acq -> cancel();
678 
679  return QScriptValue(engine, 1);
680  }
681  }
682 
683  return QScriptValue(engine, -1);
684 }
QSharedPointer< QxrdAcquisition > QxrdAcquisitionPtr
QxrdAcquisitionWPtr acquisition() const

Here is the call graph for this function:

QCEP_DOC_FUNCTION ( "acquireScalers"  )

Definition at line 686 of file qxrdscriptengine.cpp.

References QxrdScriptEngine::acquisition().

693 {
694  QxrdScriptEngine *eng = qobject_cast<QxrdScriptEngine*>(engine);
695 
696  if (eng) {
697  QxrdAcquisitionPtr acq(eng->acquisition());
698 
699  if (acq) {
700  int i = context->argument(0).toInteger();
701 
702  return QScriptValue(eng, acq->scalerValue(i));
703  }
704  }
705 
706  return QScriptValue();
707 }
QSharedPointer< QxrdAcquisition > QxrdAcquisitionPtr
QxrdAcquisitionWPtr acquisition() const

Here is the call graph for this function:

QCEP_DOC_FUNCTION ( "trigger"  ,
"trigger()"  ,
"Trigger triggered acquisition"  ,
"<p>If 'preTriggerFiles' is greater than zero then acquisition operations proceed in the ""'triggered' mode. This acts much like a digital oscilloscope trigger where a certain number ""('preTriggerFiles') of acquired images are held in the computer RAM until the trigger operation occurs ""and then the most recent acquired images are written to  disk,
along with a number of post-trigger images</p >"   
)

Definition at line 709 of file qxrdscriptengine.cpp.

References QxrdScriptEngine::acquisition().

720 {
721  QxrdScriptEngine *eng = qobject_cast<QxrdScriptEngine*>(engine);
722 
723  if (eng) {
724  QxrdAcquisitionPtr acq(eng->acquisition());
725 
726  if (acq) {
727  acq -> trigger();
728 
729  return QScriptValue(engine, 1);
730  }
731  }
732 
733  return QScriptValue(engine, -1);
734 }
QSharedPointer< QxrdAcquisition > QxrdAcquisitionPtr
QxrdAcquisitionWPtr acquisition() const

Here is the call graph for this function:

QCEP_DOC_FUNCTION ( "exposureTime"  ,
"exposureTime([time])"  ,
"Get or set the acquisition exposure time (also for dark exposures)"  ,
"<p>If the time argument is  given,
set the exposure  time,
otherwise return the" "current exposure time</p >" "< p >This function provides a convenient method to access the" "< code >acquisition.exposureTime</code > property</p >"   
)

Definition at line 736 of file qxrdscriptengine.cpp.

References QxrdScriptEngine::acquisition().

747 {
748  QxrdScriptEngine *eng = qobject_cast<QxrdScriptEngine*>(engine);
749 
750  if (eng) {
751  QxrdAcquisitionPtr acq(eng->acquisition());
752 
753  if (acq) {
754  if (context->argumentCount() != 0) {
755  acq -> set_ExposureTime(context->argument(0).toNumber());
756  }
757 
758  return QScriptValue(engine, acq -> get_ExposureTime());
759  }
760  }
761 
762  return QScriptValue(engine, -1);
763 }
QSharedPointer< QxrdAcquisition > QxrdAcquisitionPtr
QxrdAcquisitionWPtr acquisition() const

Here is the call graph for this function:

QCEP_DOC_FUNCTION ( "summedExposures"  ,
"summedExposures([n])"  ,
"Get or set the number of summed exposures for acquisition"  ,
"<p>If the n argument is  given,
set the number of summed  exposures,
otherwise return the" "current value.</p >" "< p >Easy access to< code >acquisition.summedExposures</code ></p >"   
)

Definition at line 765 of file qxrdscriptengine.cpp.

References QxrdScriptEngine::acquisition().

775 {
776  QxrdScriptEngine *eng = qobject_cast<QxrdScriptEngine*>(engine);
777 
778  if (eng) {
779  QxrdAcquisitionPtr acq(eng->acquisition());
780 
781  if (acq) {
782  if (context->argumentCount() != 0) {
783  acq -> set_SummedExposures(context->argument(0).toUInt32());
784  }
785 
786  return QScriptValue(engine, acq -> get_SummedExposures());
787  }
788  }
789 
790  return QScriptValue(engine, -1);
791 }
QSharedPointer< QxrdAcquisition > QxrdAcquisitionPtr
QxrdAcquisitionWPtr acquisition() const

Here is the call graph for this function:

QCEP_DOC_FUNCTION ( "skippedExposures"  ,
"skippedExposures([n])"  ,
"Get or set the number of skipped exposures for acquisition"  ,
"<p>If the n argument is  given,
set the number of skipped  exposures,
otherwise return the" "current value.</p >" "< p >Easy access to< code >acquisition.skippedExposures</code ></p >"   
)

Definition at line 793 of file qxrdscriptengine.cpp.

References QxrdScriptEngine::acquisition().

803 {
804  QxrdScriptEngine *eng = qobject_cast<QxrdScriptEngine*>(engine);
805 
806  if (eng) {
807  QxrdAcquisitionPtr acq(eng->acquisition());
808 
809  if (acq) {
810  if (context->argumentCount() != 0) {
811  acq -> set_SkippedExposures(context->argument(0).toUInt32());
812  }
813 
814  return QScriptValue(engine, acq -> get_SkippedExposures());
815  }
816  }
817 
818  return QScriptValue(engine, -1);
819 }
QSharedPointer< QxrdAcquisition > QxrdAcquisitionPtr
QxrdAcquisitionWPtr acquisition() const

Here is the call graph for this function:

QCEP_DOC_FUNCTION ( "darkSummedExposures"  ,
"darkSummedExposures([n])"  ,
"Get or set the number of summed exposures for dark acquisition"  ,
"<p>If the n argument is  given,
set the number of summed  exposures,
otherwise return the" "current value.</p >" "< p >Easy access to< code >acquisition.darkSummedExposures</code ></p >"   
)

Definition at line 821 of file qxrdscriptengine.cpp.

References QxrdScriptEngine::acquisition().

831 {
832  QxrdScriptEngine *eng = qobject_cast<QxrdScriptEngine*>(engine);
833 
834  if (eng) {
835  QxrdAcquisitionPtr acq(eng->acquisition());
836 
837  if (acq) {
838  if (context->argumentCount() != 0) {
839  acq -> set_DarkSummedExposures(context->argument(0).toUInt32());
840  }
841 
842  return QScriptValue(engine, acq -> get_DarkSummedExposures());
843  }
844  }
845 
846  return QScriptValue(engine, -1);
847 }
QSharedPointer< QxrdAcquisition > QxrdAcquisitionPtr
QxrdAcquisitionWPtr acquisition() const

Here is the call graph for this function:

QCEP_DOC_FUNCTION ( "phasesInGroup"  ,
"phasesInGroup([n])"  ,
"Get or set the number of phases for synchronized acquisition"  ,
"<p>If the n argument is  given,
set the number of  phases,
otherwise return the" "current value.</p >" "< p >Easy access to< code >acquisition.phasesInGroup</code ></p >"   
)

Definition at line 849 of file qxrdscriptengine.cpp.

References QxrdScriptEngine::acquisition().

859 {
860  QxrdScriptEngine *eng = qobject_cast<QxrdScriptEngine*>(engine);
861 
862  if (eng) {
863  QxrdAcquisitionPtr acq(eng->acquisition());
864 
865  if (acq) {
866  if (context->argumentCount() != 0) {
867  acq -> set_PhasesInGroup(context->argument(0).toUInt32());
868  }
869 
870  return QScriptValue(engine, acq -> get_PhasesInGroup());
871  }
872  }
873 
874  return QScriptValue(engine, -1);
875 }
QSharedPointer< QxrdAcquisition > QxrdAcquisitionPtr
QxrdAcquisitionWPtr acquisition() const

Here is the call graph for this function:

QCEP_DOC_FUNCTION ( "preTriggerFiles"  ,
"preTriggerFiles([n])"  ,
"Get or set the number of pre-trigger file groups for triggered acquisition"  ,
"<p>If the n argument is  given,
set the number of pre-trigger file  groups,
otherwise return the" "current value.</p >" "< p >Easy access to< code >acquisition.preTriggerFiles</code ></p >"   
)

Definition at line 877 of file qxrdscriptengine.cpp.

References QxrdScriptEngine::acquisition().

887 {
888  QxrdScriptEngine *eng = qobject_cast<QxrdScriptEngine*>(engine);
889 
890  if (eng) {
891  QxrdAcquisitionPtr acq(eng->acquisition());
892 
893  if (acq) {
894  if (context->argumentCount() != 0) {
895  acq -> set_PreTriggerFiles(context->argument(0).toUInt32());
896  }
897 
898  return QScriptValue(engine, acq -> get_PreTriggerFiles());
899  }
900  }
901 
902  return QScriptValue(engine, -1);
903 }
QSharedPointer< QxrdAcquisition > QxrdAcquisitionPtr
QxrdAcquisitionWPtr acquisition() const

Here is the call graph for this function:

QCEP_DOC_FUNCTION ( "postTriggerFiles"  ,
"postTriggerFiles([n])"  ,
"Get or set the number of post-trigger file groups for triggered acquisition"  ,
"<p>If the n argument is  given,
set the number of post-trigger file  groups,
otherwise return the" "current value.</p >" "< p >Easy access to< code >acquisition.postTriggerFiles</code ></p >"   
)

Definition at line 905 of file qxrdscriptengine.cpp.

References QxrdScriptEngine::acquisition().

915 {
916  QxrdScriptEngine *eng = qobject_cast<QxrdScriptEngine*>(engine);
917 
918  if (eng) {
919  QxrdAcquisitionPtr acq(eng->acquisition());
920 
921  if (acq) {
922  if (context->argumentCount() != 0) {
923  acq -> set_PostTriggerFiles(context->argument(0).toUInt32());
924  }
925 
926  return QScriptValue(engine, acq -> get_PostTriggerFiles());
927  }
928  }
929 
930  return QScriptValue(engine, -1);
931 }
QSharedPointer< QxrdAcquisition > QxrdAcquisitionPtr
QxrdAcquisitionWPtr acquisition() const

Here is the call graph for this function:

QCEP_DOC_FUNCTION ( "filePattern"  ,
"filePattern([pattern])"  ,
"Get or set the acquisition file name pattern"  ,
"<p>If the pattern argument is  given,
set the file name  pattern,
otherwise return the" "current value.</p >" "< p >Easy access to< code >acquisition.filePattern</code ></p >"   
)

Definition at line 933 of file qxrdscriptengine.cpp.

References QxrdScriptEngine::acquisition().

943 {
944  QxrdScriptEngine *eng = qobject_cast<QxrdScriptEngine*>(engine);
945 
946  if (eng) {
947  QxrdAcquisitionPtr acq(eng->acquisition());
948 
949  if (acq) {
950  if (context->argumentCount() != 0) {
951  acq -> set_FilePattern(context->argument(0).toString());
952  }
953 
954  return QScriptValue(engine, acq -> get_FilePattern());
955  }
956  }
957 
958  return QScriptValue(engine, -1);
959 }
QSharedPointer< QxrdAcquisition > QxrdAcquisitionPtr
QxrdAcquisitionWPtr acquisition() const

Here is the call graph for this function:

QCEP_DOC_FUNCTION ( "outputDirectory"  ,
"outputDirectory([dir])"  ,
"Get or set the acquisition output directory"  ,
"<p>If the dir argument is  given,
set the output  directory,
otherwise return the" "current value.</p >" "< p >Easy access to< code >experiment.dataDirectory</code ></p >"   
)

Definition at line 961 of file qxrdscriptengine.cpp.

References QxrdScriptEngine::experiment().

971 {
972  QxrdScriptEngine *eng = qobject_cast<QxrdScriptEngine*>(engine);
973 
974  if (eng) {
975  QxrdExperimentPtr doc(eng->experiment());
976 
977  if (doc) {
978  if (context->argumentCount() != 0) {
979  doc -> set_DataDirectory(context->argument(0).toString());
980  }
981 
982  return QScriptValue(engine, doc -> get_DataDirectory());
983  }
984  }
985 
986  return QScriptValue(engine, -1);
987 }
QSharedPointer< QxrdExperiment > QxrdExperimentPtr
QxrdExperimentWPtr experiment() const

Here is the call graph for this function:

QCEP_DOC_FUNCTION ( "fileIndex"  ,
"fileIndex([n])"  ,
"Get or set the acquisition file index"  ,
"<p>If the n argument is  given,
set the file  index,
otherwise return the" "current value.</p >" "< p >Easy access to< code >acquisition.fileIndex</code ></p >"   
)

Definition at line 989 of file qxrdscriptengine.cpp.

References QxrdScriptEngine::acquisition().

999 {
1000  QxrdScriptEngine *eng = qobject_cast<QxrdScriptEngine*>(engine);
1001 
1002  if (eng) {
1003  QxrdAcquisitionPtr acq(eng->acquisition());
1004 
1005  if (acq) {
1006  if (context->argumentCount() != 0) {
1007  acq -> set_FileIndex(context->argument(0).toUInt32());
1008  }
1009 
1010  return QScriptValue(engine, acq -> get_FileIndex());
1011  }
1012  }
1013 
1014  return QScriptValue(engine, -1);
1015 }
QSharedPointer< QxrdAcquisition > QxrdAcquisitionPtr
QxrdAcquisitionWPtr acquisition() const

Here is the call graph for this function:

QCEP_DOC_FUNCTION ( "data"  ,
"data()"  ,
"Get the current image"  ,
"<p>Returns a reference to the most recently acquired or most recently loaded image.</p>""<p>The returned object can have its properties queried.</p>""<p>Note that the value returned by this function will change as each ""new image is acquired so be careful if calling this function during acquisition.</p>"   
)

Definition at line 1017 of file qxrdscriptengine.cpp.

References QxrdScriptEngine::dataProcessor().

1028 {
1029  QxrdScriptEngine *eng = qobject_cast<QxrdScriptEngine*>(engine);
1030 
1031  if (eng) {
1032  QxrdDataProcessorPtr proc(eng->dataProcessor());
1033 
1034  if (proc) {
1035  return engine -> newQObject(proc -> data().data(),QtOwnership, QScriptEngine::AutoCreateDynamicProperties);
1036  }
1037  }
1038 
1039  return QScriptValue(engine, -1);
1040 }
QSharedPointer< QxrdDataProcessor > QxrdDataProcessorPtr
QxrdDataProcessorWPtr dataProcessor() const

Here is the call graph for this function:

QCEP_DOC_FUNCTION ( "dark"  ,
"dark()"  ,
"Get the dark image (or null if none has been taken)"  ,
"<p>Returns a reference to the current dark image.</p>""<p>The returned object can have its properties queried.</p>""<p>For  example,
to get the file name of the dark image:</p >" "< code >print(dark().fileName)</code >" "< p >Or to show a list of properties of the dark image:</p >" "< code >for(i in dark()) print(i, dark()[i])</code >"   
)

Definition at line 1042 of file qxrdscriptengine.cpp.

References QxrdScriptEngine::dataProcessor().

1048  :</p>"
1049  "<code>print(dark().fileName)</code>"
1050  "<p>Or to show a list of properties of the dark image:</p>"
1051  "<code>for(i in dark()) print(i, dark()[i])</code>"
1052  )
1053 
1054 QScriptValue QxrdScriptEngine::darkFunc(QScriptContext * /*context*/, QScriptEngine *engine)
1055 {
1056  QxrdScriptEngine *eng = qobject_cast<QxrdScriptEngine*>(engine);
1057 
1058  if (eng) {
1059  QxrdDataProcessorPtr proc(eng->dataProcessor());
1060 
1061  if (proc) {
1062  return engine -> newQObject(proc -> darkImage().data(), QtOwnership, QScriptEngine::AutoCreateDynamicProperties);
1063  }
1064  }
1065 
1066  return QScriptValue(engine, -1);
1067 }

Here is the call graph for this function:

QCEP_DOC_FUNCTION ( "mask"  ,
"mask()"  ,
"Get the top item of the mask stack"  ,
"<p>Returns a reference to the top of the mask  stack,
or null if the" "mask stack is empty.</p >"   
)

Definition at line 1069 of file qxrdscriptengine.cpp.

References QxrdScriptEngine::dataProcessor().

1078 {
1079  QxrdScriptEngine *eng = qobject_cast<QxrdScriptEngine*>(engine);
1080 
1081  if (eng) {
1082  QxrdDataProcessorPtr proc(eng->dataProcessor());
1083 
1084  if (proc) {
1085  return engine -> newQObject(proc -> mask().data(), QtOwnership, QScriptEngine::AutoCreateDynamicProperties);
1086  }
1087  }
1088 
1089  return QScriptValue(engine, -1);
1090 }
QSharedPointer< QxrdDataProcessor > QxrdDataProcessorPtr
QxrdDataProcessorWPtr dataProcessor() const

Here is the call graph for this function:

QCEP_DOC_FUNCTION ( "overflow"  ,
"overflow()"  ,
"Get the overflow pixel map for acquired images"  ,
"<p>Returns the overflow pixels map for the most recently acquired image ""(if overflow processing is enabled)</p>\n""<p>The overflow map is non-zero wherever an image pixel exceeded the overflow ""threshold during acquisition. Where more than one exposures are  summed,
the overflow" "map will count the number of exposures for which the pixel overflowed.</p >"   
)

Definition at line 1092 of file qxrdscriptengine.cpp.

References QxrdScriptEngine::dataProcessor().

1104 {
1105  QxrdScriptEngine *eng = qobject_cast<QxrdScriptEngine*>(engine);
1106 
1107  if (eng) {
1108  QxrdDataProcessorPtr proc(eng->dataProcessor());
1109 
1110  if (proc) {
1111  return engine -> newQObject(proc -> overflow().data(), QtOwnership, QScriptEngine::AutoCreateDynamicProperties);
1112  }
1113  }
1114 
1115  return QScriptValue(engine, -1);
1116 }
QSharedPointer< QxrdDataProcessor > QxrdDataProcessorPtr
QxrdDataProcessorWPtr dataProcessor() const

Here is the call graph for this function:

QCEP_DOC_FUNCTION ( "liveData"  ,
"liveData()"  ,
"Get the current live view image"  ,
"<p>Returns a reference to the most recently acquired live view image.</p>""<p>The returned object can have its properties queried.</p>""<p>Note that the value returned by this function will change as each ""new live view image is acquired so be careful when calling this function.</p>"   
)

Definition at line 1118 of file qxrdscriptengine.cpp.

References QxrdScriptEngine::dataProcessor().

1129 {
1130  QxrdScriptEngine *eng = qobject_cast<QxrdScriptEngine*>(engine);
1131 
1132  if (eng) {
1133  QxrdDataProcessorPtr proc(eng->dataProcessor());
1134 
1135  if (proc) {
1136  return engine -> newQObject(proc -> liveData().data(), QtOwnership, QScriptEngine::AutoCreateDynamicProperties);
1137  }
1138  }
1139 
1140  return QScriptValue(engine, -1);
1141 }
QSharedPointer< QxrdDataProcessor > QxrdDataProcessorPtr
QxrdDataProcessorWPtr dataProcessor() const

Here is the call graph for this function:

QCEP_DOC_FUNCTION ( "help"  ,
"help([name...])"  ,
"Returns help text for a given name or names"  ,
"<p>Returns a string containing an html representation of the help text ""for a name or names. If more than one name is given the result is the ""concatenation of the help for each name in turn</p>""<p>The names may contain wildcard  characters,
the result will contain help" "for all available matching the wildcard patterns.</p >" "< p >If no name is given the command returns help for the help command itself.</p >" "< p >If the command is executed in the QXRD script window the html result will" "be properly formatted in the message window.</p >" "< p >For example:</p >" "< code >help(\"help\")</code>"   
)

Definition at line 1143 of file qxrdscriptengine.cpp.

References QcepScriptEngine::documentationText().

1155  :</p>"
1156  "<code>help(\"help\")</code>"
1157  )
1158 
1159 QScriptValue QxrdScriptEngine::helpFunc(QScriptContext * context, QScriptEngine * engine)
1160 {
1161  QxrdScriptEngine *eng = qobject_cast<QxrdScriptEngine*>(engine);
1162 
1163  if (eng) {
1164  int n=context->argumentCount();
1165  QString res="";
1166 
1167  if (n==0) {
1168  res = eng->documentationText("help");
1169  } else {
1170  for (int i=0; i<n; i++) {
1171  QString name = context->argument(i).toString();
1172 
1173  QRegExp re(name, Qt::CaseInsensitive, QRegExp::Wildcard);
1174 
1175  res.append(eng->documentationText(re));
1176  }
1177  }
1178 
1179  return QScriptValue(engine, res);
1180  } else {
1181  return QScriptValue(engine, QString());
1182  }
1183 }
QString documentationText(QString item)

Here is the call graph for this function:

QCEP_DOC_FUNCTION ( "extraChannel"  ,
"extraChannel(n)"  ,
"Access channels for extra inputs"  ,
"<p>Returns a reference to configuration data for an extra input channel.</p>""<p>Example: to access the acquired waveform for extra channel 0</p>""<code>extraChannel(0).waveform</code>"   
)

Definition at line 1185 of file qxrdscriptengine.cpp.

References QxrdScriptEngine::acquisition().

1190  : to access the acquired waveform for extra channel 0</p>"
1191  "<code>extraChannel(0).waveform</code>"
1192  )
1193 
1194 QScriptValue QxrdScriptEngine::extraChannelFunc(QScriptContext *context, QScriptEngine *engine)
1195 {
1196  QxrdScriptEngine *eng = qobject_cast<QxrdScriptEngine*>(engine);
1197 
1198  if (eng) {
1199  QxrdAcquisitionPtr acq(eng->acquisition());
1200 
1201  if (acq) {
1202  QxrdAcquisitionExtraInputsPtr xtra(acq->acquisitionExtraInputs());
1203 
1204  if (xtra) {
1205  if (context->argumentCount() != 0) {
1206  int channel = context->argument(0).toInteger();
1207 
1208  QxrdAcquisitionExtraInputsChannelPtr chan(xtra->channel(channel));
1209 
1210  return engine->newQObject(chan.data());
1211  }
1212  }
1213  }
1214  }
1215 
1216  return QScriptValue();
1217 }

Here is the call graph for this function:

QCEP_DOC_FUNCTION ( "process"  ,
"process(filename [, norm...])"  ,
"Load and process an image file"  ,
"<p>Load and process the file filename. The norm arguments are used as ""normalization values during processing</p>""<p>The function is closely related to</p>""<code>processor.processNormalizedFile(QString,QDoubleList)</code>"   
)

Definition at line 1219 of file qxrdscriptengine.cpp.

References QxrdScriptEngine::dataProcessor().

1230 {
1231  QxrdScriptEngine *eng = qobject_cast<QxrdScriptEngine*>(engine);
1232 
1233  if (eng) {
1234  QxrdDataProcessorPtr proc(eng->dataProcessor());
1235 
1236  if (proc) {
1237  if (context->argumentCount() >= 1) {
1238  QString file = context->argument(0).toString();
1239  QList<double> normVals;
1240 
1241  for (int i=1; i<context->argumentCount(); i++) {
1242  normVals.append(context->argument(i).toNumber());
1243  }
1244 
1245  proc -> processNormalizedFile(file, normVals);
1246  }
1247 
1248  return QScriptValue(engine, 1);
1249  }
1250  }
1251 
1252  return QScriptValue(engine, -1);
1253 }
QSharedPointer< QxrdDataProcessor > QxrdDataProcessorPtr
QxrdDataProcessorWPtr dataProcessor() const

Here is the call graph for this function:

QCEP_DOC_FUNCTION ( "setFileNormalization"  ,
"setFileNormalization(filename [, norm...])"  ,
"Set the normalization values for an image file"  ,
"<p>Loads the file  filename,
sets its normalization values and" "rewrites the metadata file</p >" "< p >The function is closely related to</p >" "< code >processor.setFileNormalization(QString, QDoubleList)</code >"   
)

Definition at line 1255 of file qxrdscriptengine.cpp.

References QxrdScriptEngine::dataProcessor().

1266 {
1267  QxrdScriptEngine *eng = qobject_cast<QxrdScriptEngine*>(engine);
1268 
1269  if (eng) {
1270  QxrdDataProcessorPtr proc(eng->dataProcessor());
1271 
1272  if (proc) {
1273  if (context->argumentCount() >= 1) {
1274  QString file = context->argument(0).toString();
1275  QList<double> normVals;
1276 
1277  for (int i=1; i<context->argumentCount(); i++) {
1278  normVals.append(context->argument(i).toNumber());
1279  }
1280 
1281  proc -> setFileNormalization(file, normVals);
1282  }
1283 
1284  return QScriptValue(engine, 1);
1285  }
1286  }
1287 
1288  return QScriptValue(engine, -1);
1289 }
QSharedPointer< QxrdDataProcessor > QxrdDataProcessorPtr
QxrdDataProcessorWPtr dataProcessor() const

Here is the call graph for this function:

QCEP_DOC_FUNCTION ( "matchFiles"  ,
"matchFiles([pattern]...)"  ,
"Return a list of files matching a pattern"  ,
"<p>Returns a list of file names matching the provided pattern(s).</p>""<p>The patterns support 'wild card' characters sush as * and ?.</p>""<p>Example - to calculate the sum of the pixel intensity of pixel  100 
)

Definition at line 1291 of file qxrdscriptengine.cpp.

1298  :</p>"
1299  "<code>var sum=0;<br/>\n"
1300  "for(f in matchFiles(\"*.tif\") {<br/>\n"
1301  "&nbsp;&nbsp;processor.loadData(f);<br/>\n"
1302  "&nbsp;&nbsp;sum += data().getImageData(100,100);<br/>\n"
1303  "}<br>"
1304  )
1305 
1306 QScriptValue QxrdScriptEngine::matchFilesFunc(QScriptContext *context, QScriptEngine *engine)
1307 {
1308  QStringList result;
1309 
1310  if (context->argumentCount() >= 1) {
1311  QString dir = context->argument(0).toString();
1312 
1313  if (context->argumentCount() == 1) {
1314  QDir a(dir);
1315  a.setFilter(QDir::Dirs | QDir::Files);
1316 
1317  result.append(a.entryList());
1318  } else {
1319  for (int i=1; i<context->argumentCount(); i++) {
1320  QString patt = context->argument(i).toString();
1321 
1322  // g_Application->printMessage(tr("Matching %1").arg(patt));
1323 
1324  QDir a(dir);
1325 
1326  a.setFilter(QDir::Dirs | QDir::Files);
1327  QStringList patts;
1328  patts<<patt;
1329 
1330  a.setNameFilters(patts);
1331 
1332  QStringList entries = a.entryList();
1333  // int nEntries = entries.length();
1334  // g_Application->printMessage(tr("Matched %1 entries").arg(nEntries));
1335 
1336  result.append(entries);
1337  }
1338  }
1339  }
1340 
1341  return engine->toScriptValue(result);
1342 }
static QScriptValue matchFilesFunc(QScriptContext *context, QScriptEngine *engine)
QCEP_DOC_FUNCTION ( "mapUserFunction"  ,
"mapUserFunction(functionname)"  ,
"Map a user function over current data"  ,
""   
)

Definition at line 1344 of file qxrdscriptengine.cpp.

References QxrdScriptEngine::dataProcessor().

1352 {
1353  QxrdScriptEngine *eng = qobject_cast<QxrdScriptEngine*>(engine);
1354 
1355  if (eng) {
1356  QxrdDataProcessorPtr proc(eng->dataProcessor());
1357 
1358  QcepDoubleImageDataPtr d = proc->data();
1359 
1360  if (d) {
1361  int ht = d->get_Height();
1362  int wd = d->get_Width();
1363 
1364  if (context->argumentCount() == 1) {
1365  QScriptValue func = context->argument(0);
1366 
1367  if (!func.isFunction()) {
1368  func = eng->globalObject().property(func.toString());
1369  }
1370 
1371  if (func.isFunction()) {
1372  for (int i=0; i<wd; i++) {
1373  for (int j=0; j<ht; j++) {
1374  d->setValue(i,j, func.call(QScriptValue(), QScriptValueList() << i << j).toNumber());
1375  }
1376  }
1377 
1378  proc->newData(d, QcepMaskDataPtr());
1379  }
1380  }
1381  }
1382  }
1383 
1384  return engine->toScriptValue(0);
1385 }
QSharedPointer< QxrdDataProcessor > QxrdDataProcessorPtr
QxrdDataProcessorWPtr dataProcessor() const
QSharedPointer< QcepMaskData > QcepMaskDataPtr
QSharedPointer< QcepDoubleImageData > QcepDoubleImageDataPtr

Here is the call graph for this function:

QCEP_DOC_FUNCTION ( "timeStamp"  ,
"timeStamp()"  ,
"Returns system time as seconds since unix epoch"  ,
""   
)

Definition at line 1387 of file qxrdscriptengine.cpp.

References QcepImageDataBase::secondsSinceEpoch().

1395 {
1396  double val = QcepImageDataBase::secondsSinceEpoch();
1397 
1398  return engine->toScriptValue(val);
1399 }
static double secondsSinceEpoch()

Here is the call graph for this function:

QCEP_DOC_FUNCTION ( "newDataGroup"  ,
"newDataGroup(name)"  ,
"Creates a new named data group"  ,
""   
)

Definition at line 1402 of file qxrdscriptengine.cpp.

References QxrdScriptEngine::experiment().

1410 {
1411  QxrdScriptEngine *eng = qobject_cast<QxrdScriptEngine*>(engine);
1412 
1413  if (eng) {
1414  QxrdExperimentPtr expt = eng->experiment();
1415 
1416  if (expt) {
1417  QcepDatasetModelPtr dataModel = expt->dataset();
1418 
1419  if (dataModel) {
1420  QString name = context->argument(0).toString();
1421 
1422  return engine->newQObject(
1423  dataModel->newGroup(name).data());
1424  }
1425  }
1426  }
1427 
1428  return QScriptValue();
1429 }
QSharedPointer< QxrdExperiment > QxrdExperimentPtr
QxrdExperimentWPtr experiment() const
QSharedPointer< QcepDatasetModel > QcepDatasetModelPtr

Here is the call graph for this function:

QCEP_DOC_FUNCTION ( "newDataArray"  ,
"newDataArray(name,dim1 .. dimn)"  ,
"Creates a new named n-dimensional data array"  ,
""   
)

Definition at line 1431 of file qxrdscriptengine.cpp.

References QxrdScriptEngine::experiment().

1439 {
1440  QxrdScriptEngine *eng = qobject_cast<QxrdScriptEngine*>(engine);
1441 
1442  if (eng) {
1443  QxrdExperimentPtr expt = eng->experiment();
1444 
1445  if (expt) {
1446  QcepDatasetModelPtr dataModel = expt->dataset();
1447 
1448  if (dataModel) {
1449  QString name = context->argument(0).toString();
1450 
1451  QVector<int> dims;
1452 
1453  for (int i=1; i<context->argumentCount(); i++) {
1454  dims.append(context->argument(i).toInteger());
1455  }
1456 
1457  return engine->newQObject(
1458  dataModel->newArray(name, dims).data());
1459  }
1460  }
1461  }
1462 
1463  return QScriptValue();
1464 }
QSharedPointer< QxrdExperiment > QxrdExperimentPtr
QxrdExperimentWPtr experiment() const
QSharedPointer< QcepDatasetModel > QcepDatasetModelPtr

Here is the call graph for this function:

QCEP_DOC_FUNCTION ( "newDataColumn"  ,
"newDataColumn(name, npts)"  ,
"Creates a new named data column"  ,
""   
)

Definition at line 1466 of file qxrdscriptengine.cpp.

References QxrdScriptEngine::experiment().

1474 {
1475  QxrdScriptEngine *eng = qobject_cast<QxrdScriptEngine*>(engine);
1476 
1477  if (eng) {
1478  QxrdExperimentPtr expt = eng->experiment();
1479 
1480  if (expt) {
1481  QcepDatasetModelPtr dataModel = expt->dataset();
1482 
1483  if (dataModel) {
1484  QString name = context->argument(0).toString();
1485  int npts = context->argument(1).toInteger();
1486 
1487  return engine->newQObject(
1488  dataModel->newColumn(name, npts).data());
1489  }
1490  }
1491  }
1492 
1493  return QScriptValue();
1494 }
QSharedPointer< QxrdExperiment > QxrdExperimentPtr
QxrdExperimentWPtr experiment() const
QSharedPointer< QcepDatasetModel > QcepDatasetModelPtr

Here is the call graph for this function:

QCEP_DOC_FUNCTION ( "newDataColumnScan"  ,
"newDataColumnScan(name, npts, col1name .. colnname)"  ,
"Creates a new named data column scan"  ,
""   
)

Definition at line 1496 of file qxrdscriptengine.cpp.

References QxrdScriptEngine::experiment().

1504 {
1505  QxrdScriptEngine *eng = qobject_cast<QxrdScriptEngine*>(engine);
1506 
1507  if (eng) {
1508  QxrdExperimentPtr expt = eng->experiment();
1509 
1510  if (expt) {
1511  QcepDatasetModelPtr dataModel = expt->dataset();
1512 
1513  if (dataModel) {
1514  QString name = context->argument(0).toString();
1515  int npts = context->argument(1).toInteger();
1516 
1517  QStringList cols;
1518 
1519  for (int i=2; i<context->argumentCount(); i++) {
1520  cols.append(context->argument(i).toString());
1521  }
1522 
1523  return engine->newQObject(
1524  dataModel->newColumnScan(name, npts, cols).data());
1525  }
1526  }
1527  }
1528 
1529  return QScriptValue();
1530 }
QSharedPointer< QxrdExperiment > QxrdExperimentPtr
QxrdExperimentWPtr experiment() const
QSharedPointer< QcepDatasetModel > QcepDatasetModelPtr

Here is the call graph for this function:

QCEP_DOC_FUNCTION ( "newDataImage"  ,
"newDataImage(name, width, height)"  ,
"Creates a new named data image"  ,
""   
)

Definition at line 1532 of file qxrdscriptengine.cpp.

References QxrdScriptEngine::application(), and QxrdScriptEngine::experiment().

1540 {
1541  QxrdScriptEngine *eng = qobject_cast<QxrdScriptEngine*>(engine);
1542 
1543  if (eng) {
1544  QxrdExperimentPtr expt = eng->experiment();
1545  QxrdApplicationPtr app(eng->application());
1546 
1547  if (expt && app) {
1548 
1549  QcepDatasetModelPtr dataModel = expt->dataset();
1550 
1551  if (dataModel) {
1552  QString name = context->argument(0).toString();
1553  int width = context->argument(1).toInteger();
1554  int height = context->argument(2).toInteger();
1555 
1556  return engine->newQObject(
1557  dataModel->newImage(name, width, height).data());
1558  }
1559  }
1560  }
1561 
1562  return QScriptValue();
1563 }
QSharedPointer< QxrdExperiment > QxrdExperimentPtr
QxrdApplicationWPtr application() const
QxrdExperimentWPtr experiment() const
QSharedPointer< QxrdApplication > QxrdApplicationPtr
QSharedPointer< QcepDatasetModel > QcepDatasetModelPtr

Here is the call graph for this function:

QCEP_DOC_FUNCTION ( "newIntegratedData"  ,
"newIntegratedData(name, size)"  ,
"Creates a new integrated data object ,
""   
)

Definition at line 1565 of file qxrdscriptengine.cpp.

References QxrdScriptEngine::application(), and QxrdScriptEngine::experiment().

1573 {
1574  QxrdScriptEngine *eng = qobject_cast<QxrdScriptEngine*>(engine);
1575 
1576  if (eng) {
1577  QxrdExperimentPtr expt = eng->experiment();
1578  QxrdApplicationPtr app(eng->application());
1579 
1580  if (expt && app) {
1581  QcepDatasetModelPtr dataModel = expt->dataset();
1582 
1583  if (dataModel) {
1584  QString name = context->argument(0).toString();
1585  int size = context->argument(1).toInteger();
1586 
1587  return engine->newQObject(
1588  dataModel->newIntegratedData(name, size).data());
1589  }
1590  }
1591  }
1592 
1593  return QScriptValue();
1594 }
QSharedPointer< QxrdExperiment > QxrdExperimentPtr
QxrdApplicationWPtr application() const
QxrdExperimentWPtr experiment() const
QSharedPointer< QxrdApplication > QxrdApplicationPtr
QSharedPointer< QcepDatasetModel > QcepDatasetModelPtr

Here is the call graph for this function:

QCEP_DOC_FUNCTION ( "detector"  ,
"detector(n)"  ,
"Returns a reference to the 'n'th detector"  ,
""   
)

Definition at line 1596 of file qxrdscriptengine.cpp.

References QxrdScriptEngine::acquisition().

1603 {
1604  QxrdScriptEngine *eng = qobject_cast<QxrdScriptEngine*>(engine);
1605 
1606  if (eng) {
1607  QxrdAcquisitionPtr acq(eng->acquisition());
1608 
1609  if (acq) {
1610  int n = context->argument(0).toInteger();
1611 
1612  return engine->newQObject(acq->detector(n).data());
1613  }
1614  }
1615 
1616  return QScriptValue();
1617 }
QSharedPointer< QxrdAcquisition > QxrdAcquisitionPtr
QxrdAcquisitionWPtr acquisition() const

Here is the call graph for this function:

QCEP_DOC_FUNCTION ( "roi"  ,
"roi(n,m)"  ,
"Returns a reference to the 'm'th ROI of the 'n'th detector"  ,
""   
)

Definition at line 1619 of file qxrdscriptengine.cpp.

References QxrdScriptEngine::acquisition().

1627 {
1628  QxrdScriptEngine *eng = qobject_cast<QxrdScriptEngine*>(engine);
1629 
1630  if (eng) {
1631  QxrdAcquisitionPtr acq(eng->acquisition());
1632 
1633  if (acq) {
1634  int n = context->argument(0).toInteger();
1635  int m = context->argument(1).toInteger();
1636 
1637  QxrdDetectorPtr d = acq->detector(n);
1638 
1639  if (d) {
1640  return engine->newQObject(d->roi(m).data());
1641  }
1642  }
1643  }
1644 
1645  return QScriptValue();
1646 }
QSharedPointer< QxrdAcquisition > QxrdAcquisitionPtr
QSharedPointer< QxrdDetector > QxrdDetectorPtr
QxrdAcquisitionWPtr acquisition() const

Here is the call graph for this function:

JSON Parse a string as a JSON<p> A built in function in the Qt script system</p> QCEP_DOC_FUNCTION ( "JSON.stringify"  ,
"JSON.stringify(object)"  ,
"Produce JSON string representation of an object ,
"<p>A built-in function in the Qt script system</p>"   
)
QCEP_DOC_OBJECT ( "JSON"  ,
"Qt Built-in JSON Parser"   
)

Referenced by QcepProperty::QcepProperty(), and QxrdScriptEngine::setWindow().

Here is the caller graph for this function:

Variable Documentation

JSON Parse a string as a JSON object