Skip to content

Commit

Permalink
add ScanNamesNoMetadata and ScanNamesNoGrouping variable
Browse files Browse the repository at this point in the history
  • Loading branch information
jkotan committed Jul 19, 2024
1 parent 0e65da2 commit 67efbf3
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 28 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2024-07-19 Jan Kotanski <jankotan@gmail.com>
* add ScanNamesNoMetadata and ScanNamesNoGrouping variables (#145)
* tagged as 3.29.0

2024-07-15 Jan Kotanski <jankotan@gmail.com>
* do not restart the measurement in the grouping mode (#142)
* tagged as 3.28.1
Expand Down
8 changes: 7 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -227,4 +227,10 @@ The NeXus file recorder uses the following sardana environment variables
* **NeXusWriterProperties** *(dict)* - a dictionary of TangoDataWriter (NXSDataWriter) properties (starting with a small letter)
* **NeXusMeshScanID** *(int)* - ScanID used for composed scans e.g. mesh scan combined from many linear scans
* **NeXusWriterModes** *(list)* - a list of strategy modes e.g. ``NOINIT``, ``NOSTEP``, ``NOFINAL``, ``MESH``, ``VDS`` separated by commas

* **ScanNames** *(bool)* - special mode of using ScanName directories i.e.
* ``True``: the master file in ScanName directory,
* ``False``: Themaster file in grouping ScanName directory,
* ``None`` (or undefined): standard mode where the master files are outside ScanName directory
* **ScanNamesNoGrouping** *(bool)* - do not perform grouping when ``ScanNames`` is ``False``
* **ScanNamesNoMetadata** *(bool)* - do not perform master file metadata ingestion when ``ScanNames`` is ``False``

39 changes: 24 additions & 15 deletions man/sardananxsrecorder.1
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.TH "SARDANANXSRECORDER" "1" "Jul 14, 2024" "3.28" "Sardana NeXus Recorder"
.TH "SARDANANXSRECORDER" "1" "Jul 19, 2024" "3.29" "Sardana NeXus Recorder"
.SH NAME
sardananxsrecorder \- sardananxsrecorder Documentation
.sp
Expand Down Expand Up @@ -359,6 +359,15 @@ The NeXus file recorder uses the following sardana environment variables
\fBNeXusMeshScanID\fP \fI(int)\fP \- ScanID used for composed scans e.g. mesh scan combined from many linear scans
.IP \(bu 2
\fBNeXusWriterModes\fP \fI(list)\fP \- a list of strategy modes e.g. \fBNOINIT\fP, \fBNOSTEP\fP, \fBNOFINAL\fP, \fBMESH\fP, \fBVDS\fP separated by commas
.IP \(bu 2
\fBScanNames\fP \fI(bool)\fP \- special mode of using ScanName directories i.e.
* \fBTrue\fP: the master file in ScanName directory,
* \fBFalse\fP: Themaster file in grouping ScanName directory,
* \fBNone\fP (or undefined): standard mode where the master files are outside ScanName directory
.IP \(bu 2
\fBScanNamesNoGrouping\fP \fI(bool)\fP \- do not perform grouping when \fBScanNames\fP is \fBFalse\fP
.IP \(bu 2
\fBScanNamesNoMetadata\fP \fI(bool)\fP \- do not perform master file metadata ingestion when \fBScanNames\fP is \fBFalse\fP
.UNINDENT
.sp
Contents:
Expand All @@ -380,9 +389,9 @@ constructor
.B Parameters
.INDENT 7.0
.IP \(bu 2
\fBfilename\fP (\fI\%str\fP) ScanFile name
\fBfilename\fP (\fI\%str\fP) \-\- ScanFile name
.IP \(bu 2
\fBmacro\fP (\fI\%sardana.macroserver.macro.Macro\fP) macro object
\fBmacro\fP (\fI\%sardana.macroserver.macro.Macro\fP) \-\- macro object
.UNINDENT
.UNINDENT
.INDENT 7.0
Expand All @@ -394,13 +403,13 @@ adds custom data to configuration variables, i.e. from macros
.B Parameters
.INDENT 7.0
.IP \(bu 2
\fBvalue\fP (\fIany\fP) variable value
\fBvalue\fP (\fIany\fP) \-\- variable value
.IP \(bu 2
\fBname\fP (\fI\%str\fP) variable name
\fBname\fP (\fI\%str\fP) \-\- variable name
.IP \(bu 2
\fBgroup\fP (\fI\%str\fP) variable group inside variable dictionary
\fBgroup\fP (\fI\%str\fP) \-\- variable group inside variable dictionary
.IP \(bu 2
\fBremove\fP (\fI\%bool\fP) if True variable will be removed
\fBremove\fP (\fI\%bool\fP) \-\- if True variable will be removed
.UNINDENT
.UNINDENT
.UNINDENT
Expand All @@ -415,7 +424,7 @@ and closes the nexus file
.INDENT 7.0
.TP
.B Parameters
\fBrecordlist\fP (\fBsardana.macroserver.scan.scandata.RecordList\fP) sardana record list
\fBrecordlist\fP (\fBsardana.macroserver.scan.scandata.RecordList\fP) \-\- sardana record list
.UNINDENT
.UNINDENT
.INDENT 7.0
Expand All @@ -429,7 +438,7 @@ and records in INIT mode
.INDENT 7.0
.TP
.B Parameters
\fBrecordlist\fP (\fBsardana.macroserver.scan.scandata.RecordList\fP) sardana record list
\fBrecordlist\fP (\fBsardana.macroserver.scan.scandata.RecordList\fP) \-\- sardana record list
.UNINDENT
.UNINDENT
.INDENT 7.0
Expand All @@ -443,7 +452,7 @@ and records in INIT mode
.INDENT 7.0
.TP
.B Parameters
\fBrecord\fP (\fBsardana.macroserver.scan.scandata.Record\fP) sardana record list
\fBrecord\fP (\fBsardana.macroserver.scan.scandata.Record\fP) \-\- sardana record list
.UNINDENT
.UNINDENT
.INDENT 7.0
Expand Down Expand Up @@ -501,12 +510,12 @@ indent level. An indent level of 0 will only insert newlines.
None is the most compact representation.
.sp
If specified, separators should be an (item_separator, key_separator)
tuple. The default is (’, ‘, ‘: ‘) if \fIindent\fP is \fBNone\fP and
(‘,’, ‘: ‘) otherwise. To get the most compact JSON representation,
you should specify (‘,’, ‘:’) to eliminate whitespace.
tuple. The default is (\(aq, \(aq, \(aq: \(aq) if \fIindent\fP is \fBNone\fP and
(\(aq,\(aq, \(aq: \(aq) otherwise. To get the most compact JSON representation,
you should specify (\(aq,\(aq, \(aq:\(aq) to eliminate whitespace.
.sp
If specified, default is a function that gets called for objects
that can’t otherwise be serialized. It should return a JSON encodable
that can\(aqt otherwise be serialized. It should return a JSON encodable
version of the object or raise a \fBTypeError\fP\&.
.INDENT 7.0
.TP
Expand All @@ -515,7 +524,7 @@ default encoder
.INDENT 7.0
.TP
.B Parameters
\fBobj\fP (\fI\%object\fP or \fIany\fP) numpy array object
\fBobj\fP (\fI\%object\fP or \fIany\fP) \-\- numpy array object
.UNINDENT
.UNINDENT
.UNINDENT
Expand Down
2 changes: 1 addition & 1 deletion sardananxsrecorder/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
""" Sardana Scan Recorders """

#: package version
__version__ = "3.28.1"
__version__ = "3.29.0"
30 changes: 19 additions & 11 deletions sardananxsrecorder/nxsrecorder.py
Original file line number Diff line number Diff line change
Expand Up @@ -1348,6 +1348,8 @@ def __appendSciCatDataset(self, hostname=None):
sid = self.__serial
fdir, fname = os.path.split(self.filename)
snmode = self.__getEnvVar("ScanNames", None)
nometa = self.__getEnvVar("ScanNamesNoMetadata", False)
nogrouping = self.__getEnvVar("ScanNamesNoGrouping", False)
appendentry = self.__getConfVar("AppendEntry", False)
pdir = None
if snmode is not None:
Expand Down Expand Up @@ -1406,22 +1408,28 @@ def __appendSciCatDataset(self, hostname=None):
if fdir in sm.keys():
cgrp = sm[fdir]
if cgrp != scanname:
commands.append("__command__ stop")
commands.append("%s:%s" % (cgrp, time.time()))
commands.append("__command__ start %s" % scanname)
if not nogrouping and not nometa:
commands.append("__command__ stop")
commands.append("%s:%s" % (cgrp, time.time()))
commands.append("__command__ start %s" % scanname)
else:
commands.append("__command__ start %s" % scanname)
commands.append(sname)
commands.append("__command__ stop")
commands.append("%s:%s" % (scanname, time.time()))
# commands.append("__command__ start %s" % scanname)
if not nogrouping and not nometa:
commands.append("__command__ start %s" % scanname)
if not nometa:
commands.append(sname)
if not nogrouping and not nometa:
commands.append("__command__ stop")
if not nogrouping:
commands.append("%s:%s" % (scanname, time.time()))
sname = "\n".join(commands)

sm[fdir] = scanname
if not nogrouping and not nometa:
sm[fdir] = scanname
self.__env['SciCatMeasurements'] = sm

with open(dslfile, "a+") as fl:
fl.write("\n%s" % sname)
if sname:
with open(dslfile, "a+") as fl:
fl.write("\n%s" % sname)

def __createMeasurementFile(self):
""" create measurement file """
Expand Down

0 comments on commit 67efbf3

Please sign in to comment.