-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
227079d
commit 662de93
Showing
37 changed files
with
17,986 additions
and
17,986 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
238 changes: 119 additions & 119 deletions
238
contrib/applications/NXextract/example/template_1.nxe
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,119 +1,119 @@ | ||
#============================================================================== | ||
# File: | ||
# Multiframes_to_EDF.nxe | ||
# | ||
# @desc Produce a EDF (ESRF Data Format) file for each image captured in 'multiframe' CCD camera mode | ||
# | ||
# @param dir directory 'Target directory for extracted data' $(_data_extraction_folder_) | ||
# @param header_length number 'EDF file header length' 4096 | ||
# | ||
# Usage: | ||
# nxextractor -t Multiframes_to_EDF.nxe -D dir=<destination directory> [-m <mode>] [-w uid:gid] <NeXus source file> | ||
# | ||
# $Author: poirier $ | ||
# | ||
# $Revision: 1.7 $ | ||
#============================================================================== | ||
# output to console | ||
> | ||
"%s\n" $(_FILE_NAME_) | ||
# loop other all entries | ||
# variable $(entry) will contain current entry path (ex: '/entry1') | ||
# variable $(entry_name) will contain curren tentry name (ex: 'entry1') | ||
@( entry = [nxs:/<NXentry>/] | ||
# loop other range [0, n[ | ||
@( i = 0, nxs:$(entry)<NXentry>/<NXinstrument>/<NXdetector>/Frames/data | ||
# define a new variable | ||
% image_grp = $(entry)<NXentry>/image#$(i)<NXdata> | ||
# define image name for edf file name using a data bloc named 'image_name' | ||
( image_name | ||
"im_%02d" $(i) | ||
) | ||
# define variable | ||
% image_full_name = $(entry_name)_$(image_name) | ||
# Test data dimensions | ||
?( nxs:$(image_grp)/<SDS-signal>._rank_ = 2 | ||
# Define data bloc for image data | ||
( binarydata | ||
# output into this bloc as 2 bytes unsigned integers | ||
'ui2' nxs:$(image_grp)/<SDS-signal> | ||
) | ||
# Define data bloc in memory for EDF header base content | ||
( edf_header | ||
"EDF_DataBlockID = 1.Image.Psd ;\n" | ||
"EDF_BinarySize = %s ;\n" $(binarydata_size) | ||
"EDF_HeaderSize = %s ;\n" $(header_length) | ||
"ByteOrder = LowByteFirst ;\n" | ||
"DataType = UnsignedShort ;\n" | ||
"Dim_1 = %d ;\n" nxs:$(image_grp)/data._size_(1) | ||
"Dim_2 = %d ;\n" nxs:$(image_grp)/data._size_(2) | ||
"Title = %s ;\n" $(image_full_name) | ||
"Time = ;\n" | ||
"HeaderID = EH:000001:000000:000000 ;\n" | ||
"Compression = None ;\n" | ||
"Image = 1 ;\n" | ||
"Size = %s ;\n" $(binarydata_size) | ||
) | ||
# Define data bloc for specific metadata | ||
( specific_metadata | ||
# loop other all NXintensity_monitor groups inside first (and unique) NXinstrument group | ||
@( mi_channel = [nxs:$(entry)/<NXinstrument>/<NXintensity_monitor>] | ||
"Intensity(%s) = %g ;\n" $(mi_channel_name), nxs:$(mi_channel)/intensity[i] | ||
"Gain(%s) = %g ;\n" $(mi_channel_name), nxs:$(mi_channel)/Gain/data | ||
"Offset(%s) = %g ;\n" $(mi_channel_name), nxs:$(mi_channel)/offset/data | ||
@) | ||
"Machine_Current = %? ;\n" nxs:$(entry)/<NXinstrument>/<NXsource>/current | ||
"Monochromator_energy = %?%s ;\n" nxs:$(entry)/<NXinstrument>/<NXmonochromator>/energy, nxs:$(entry)/<NXinstrument>/<NXmonochromator>/energy.units | ||
"Distance_sample-detector = %?mm ;\n" nxs:$(entry)/<NXinstrument>/<NXdetector>/distance | ||
# aviex parameters | ||
"_diffrn_detector.detector = %s ;\n" nxs:$(entry)/<NXinstrument>/<NXdetector>/type | ||
"Exposure_time = %?%s ;\n" nxs:$(entry)/<NXinstrument>/<NXdetector>/Exposure/data, nxs:$(entry)/<NXinstrument>/<NXdetector>/Exposure/data.units | ||
"Shutter_close_delay = %?%s ;\n" nxs:$(entry)/<NXinstrument>/<NXdetector>/ShutterCloseDelay/data, nxs:$(entry)/<NXinstrument>/<NXdetector>/ShutterCloseDelay/data.units | ||
"Xbin = %? ;\n" nxs:$(entry)/<NXinstrument>/<NXdetector>/Xbin/data | ||
"Ybin = %? ;\n" nxs:$(entry)/<NXinstrument>/<NXdetector>/Ybin/data | ||
# motors | ||
@( motor_data = [nxs:$(entry)/<NXinstrument>/<NXpositioner>] | ||
"Position(%s) = %g ;\n" $(motor_data_name), nxs:$(motor_data)/raw_value | ||
@) | ||
) | ||
# Define a data bloc with a fixed size given by 'header_length' parameter | ||
# the default value for 'header_length' (4096) is given in the header of this file | ||
# the lines begining with '@param' are interpreted by the parsor | ||
( header $(header_length) | ||
"{\n" | ||
'b' edf_header | ||
'b' specific_metadata | ||
# padding pattern (default is a 80 blank spaces string terminating with a CR) | ||
... | ||
"\n}\n" | ||
) | ||
# Define output as binary file | ||
b> $(dir)/$(image_full_name).edf | ||
# Output header bloc as binary data | ||
'b' header | ||
# Output data bloc as binary data | ||
'b' binarydata | ||
?) | ||
@) | ||
@) | ||
#============================================================================== | ||
# File: | ||
# Multiframes_to_EDF.nxe | ||
# | ||
# @desc Produce a EDF (ESRF Data Format) file for each image captured in 'multiframe' CCD camera mode | ||
# | ||
# @param dir directory 'Target directory for extracted data' $(_data_extraction_folder_) | ||
# @param header_length number 'EDF file header length' 4096 | ||
# | ||
# Usage: | ||
# nxextractor -t Multiframes_to_EDF.nxe -D dir=<destination directory> [-m <mode>] [-w uid:gid] <NeXus source file> | ||
# | ||
# $Author: poirier $ | ||
# | ||
# $Revision: 1.7 $ | ||
#============================================================================== | ||
|
||
# output to console | ||
> | ||
"%s\n" $(_FILE_NAME_) | ||
|
||
# loop other all entries | ||
# variable $(entry) will contain current entry path (ex: '/entry1') | ||
# variable $(entry_name) will contain curren tentry name (ex: 'entry1') | ||
@( entry = [nxs:/<NXentry>/] | ||
|
||
# loop other range [0, n[ | ||
@( i = 0, nxs:$(entry)<NXentry>/<NXinstrument>/<NXdetector>/Frames/data | ||
|
||
# define a new variable | ||
% image_grp = $(entry)<NXentry>/image#$(i)<NXdata> | ||
|
||
# define image name for edf file name using a data bloc named 'image_name' | ||
( image_name | ||
"im_%02d" $(i) | ||
) | ||
|
||
# define variable | ||
% image_full_name = $(entry_name)_$(image_name) | ||
|
||
# Test data dimensions | ||
?( nxs:$(image_grp)/<SDS-signal>._rank_ = 2 | ||
|
||
# Define data bloc for image data | ||
( binarydata | ||
# output into this bloc as 2 bytes unsigned integers | ||
'ui2' nxs:$(image_grp)/<SDS-signal> | ||
) | ||
|
||
# Define data bloc in memory for EDF header base content | ||
( edf_header | ||
|
||
"EDF_DataBlockID = 1.Image.Psd ;\n" | ||
"EDF_BinarySize = %s ;\n" $(binarydata_size) | ||
"EDF_HeaderSize = %s ;\n" $(header_length) | ||
"ByteOrder = LowByteFirst ;\n" | ||
"DataType = UnsignedShort ;\n" | ||
"Dim_1 = %d ;\n" nxs:$(image_grp)/data._size_(1) | ||
"Dim_2 = %d ;\n" nxs:$(image_grp)/data._size_(2) | ||
"Title = %s ;\n" $(image_full_name) | ||
"Time = ;\n" | ||
"HeaderID = EH:000001:000000:000000 ;\n" | ||
"Compression = None ;\n" | ||
"Image = 1 ;\n" | ||
"Size = %s ;\n" $(binarydata_size) | ||
) | ||
|
||
# Define data bloc for specific metadata | ||
( specific_metadata | ||
# loop other all NXintensity_monitor groups inside first (and unique) NXinstrument group | ||
@( mi_channel = [nxs:$(entry)/<NXinstrument>/<NXintensity_monitor>] | ||
"Intensity(%s) = %g ;\n" $(mi_channel_name), nxs:$(mi_channel)/intensity[i] | ||
"Gain(%s) = %g ;\n" $(mi_channel_name), nxs:$(mi_channel)/Gain/data | ||
"Offset(%s) = %g ;\n" $(mi_channel_name), nxs:$(mi_channel)/offset/data | ||
@) | ||
|
||
"Machine_Current = %? ;\n" nxs:$(entry)/<NXinstrument>/<NXsource>/current | ||
"Monochromator_energy = %?%s ;\n" nxs:$(entry)/<NXinstrument>/<NXmonochromator>/energy, nxs:$(entry)/<NXinstrument>/<NXmonochromator>/energy.units | ||
"Distance_sample-detector = %?mm ;\n" nxs:$(entry)/<NXinstrument>/<NXdetector>/distance | ||
|
||
# aviex parameters | ||
"_diffrn_detector.detector = %s ;\n" nxs:$(entry)/<NXinstrument>/<NXdetector>/type | ||
"Exposure_time = %?%s ;\n" nxs:$(entry)/<NXinstrument>/<NXdetector>/Exposure/data, nxs:$(entry)/<NXinstrument>/<NXdetector>/Exposure/data.units | ||
"Shutter_close_delay = %?%s ;\n" nxs:$(entry)/<NXinstrument>/<NXdetector>/ShutterCloseDelay/data, nxs:$(entry)/<NXinstrument>/<NXdetector>/ShutterCloseDelay/data.units | ||
"Xbin = %? ;\n" nxs:$(entry)/<NXinstrument>/<NXdetector>/Xbin/data | ||
"Ybin = %? ;\n" nxs:$(entry)/<NXinstrument>/<NXdetector>/Ybin/data | ||
|
||
# motors | ||
@( motor_data = [nxs:$(entry)/<NXinstrument>/<NXpositioner>] | ||
"Position(%s) = %g ;\n" $(motor_data_name), nxs:$(motor_data)/raw_value | ||
@) | ||
) | ||
|
||
# Define a data bloc with a fixed size given by 'header_length' parameter | ||
# the default value for 'header_length' (4096) is given in the header of this file | ||
# the lines begining with '@param' are interpreted by the parsor | ||
( header $(header_length) | ||
|
||
"{\n" | ||
'b' edf_header | ||
'b' specific_metadata | ||
# padding pattern (default is a 80 blank spaces string terminating with a CR) | ||
... | ||
"\n}\n" | ||
) | ||
|
||
# Define output as binary file | ||
b> $(dir)/$(image_full_name).edf | ||
|
||
# Output header bloc as binary data | ||
'b' header | ||
# Output data bloc as binary data | ||
'b' binarydata | ||
|
||
?) | ||
|
||
@) | ||
|
||
@) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,66 @@ | ||
#============================================================================== | ||
# File: | ||
# scan1D_bmp_raw.nxe | ||
# | ||
# @desc Bmp and raw data extractor. Extract 2D data (images) from 1D scan | ||
# | ||
# @param dir directory 'Target directory for extracted data' $(_data_extraction_folder_) | ||
# @usage | ||
# nxextractor -t scan1D_bmp_raw.nxe -D dir=<destination_directory> [-m <mode>] [-w uid:gid] <NeXus source file> | ||
# | ||
# $Author: poirier $ | ||
# | ||
# $Revision: 1.6 $ | ||
#============================================================================== | ||
# Loop over NXentry groups. | ||
# Variables 'entry_name' and 'entry' will respectively contains the name and the full path of | ||
# the current NXentry group | ||
@( entry = [nxs:/<NXentry>/] | ||
# define a variable | ||
% datagrp = $(entry_name)<NXentry>/scan_data<NXdata> | ||
# define output file in ASCII mode | ||
> $(dir)/$(_FILE_NAME_)_$(entry_name).txt | ||
# output some text data | ||
"# NeXus source file: $(_FILE_NAME_)\n" | ||
"# Creation time: %?\n" nxs:.file_time | ||
"# NXentry: name = %s\n" $(entry_name) | ||
"\n" | ||
# Loop over datasets containing the 'signal' attribute in the NXdata group | ||
@( signal = [nxs:/$(datagrp)/<SDS-signal>] | ||
# Checking dataset rank | ||
?( nxs:$(signal)._rank_ = 3 | ||
# loop over actuators arrays dimension | ||
@( i = 0, nxs:/$(signal)._size_(1) | ||
# defining a data bloc in memory | ||
( output_filename | ||
"%04d-" $(i) | ||
"%6.3f" nxs:/$(datagrp)/<SDS-axis1>[i] | ||
) | ||
# Re-define output in binary mode | ||
# the content of the variable 'dir' is passed through a argument of the command line | ||
# the content of the variable 'output_filename' is defining by the data bloc above | ||
b> $(dir)/$(entry_name)/$(output_filename).bmp | ||
# output 2D data slice of 3D array as a bmp image | ||
'bmp' nxs:/$(signal)[i] | ||
# Re-define output | ||
b> $(dir)/$(entry_name)/$(output_filename).raw | ||
# output same data as a binary bloc of 2 bytes integers | ||
'i2' nxs:/$(signal)[i] | ||
@) | ||
?) | ||
@) | ||
@) | ||
#============================================================================== | ||
# File: | ||
# scan1D_bmp_raw.nxe | ||
# | ||
# @desc Bmp and raw data extractor. Extract 2D data (images) from 1D scan | ||
# | ||
# @param dir directory 'Target directory for extracted data' $(_data_extraction_folder_) | ||
|
||
# @usage | ||
# nxextractor -t scan1D_bmp_raw.nxe -D dir=<destination_directory> [-m <mode>] [-w uid:gid] <NeXus source file> | ||
# | ||
# $Author: poirier $ | ||
# | ||
# $Revision: 1.6 $ | ||
#============================================================================== | ||
|
||
# Loop over NXentry groups. | ||
# Variables 'entry_name' and 'entry' will respectively contains the name and the full path of | ||
# the current NXentry group | ||
@( entry = [nxs:/<NXentry>/] | ||
|
||
# define a variable | ||
% datagrp = $(entry_name)<NXentry>/scan_data<NXdata> | ||
|
||
# define output file in ASCII mode | ||
> $(dir)/$(_FILE_NAME_)_$(entry_name).txt | ||
|
||
# output some text data | ||
"# NeXus source file: $(_FILE_NAME_)\n" | ||
"# Creation time: %?\n" nxs:.file_time | ||
"# NXentry: name = %s\n" $(entry_name) | ||
"\n" | ||
|
||
# Loop over datasets containing the 'signal' attribute in the NXdata group | ||
@( signal = [nxs:/$(datagrp)/<SDS-signal>] | ||
|
||
# Checking dataset rank | ||
?( nxs:$(signal)._rank_ = 3 | ||
|
||
# loop over actuators arrays dimension | ||
@( i = 0, nxs:/$(signal)._size_(1) | ||
|
||
# defining a data bloc in memory | ||
( output_filename | ||
"%04d-" $(i) | ||
"%6.3f" nxs:/$(datagrp)/<SDS-axis1>[i] | ||
) | ||
|
||
# Re-define output in binary mode | ||
# the content of the variable 'dir' is passed through a argument of the command line | ||
# the content of the variable 'output_filename' is defining by the data bloc above | ||
b> $(dir)/$(entry_name)/$(output_filename).bmp | ||
|
||
# output 2D data slice of 3D array as a bmp image | ||
'bmp' nxs:/$(signal)[i] | ||
|
||
# Re-define output | ||
b> $(dir)/$(entry_name)/$(output_filename).raw | ||
|
||
# output same data as a binary bloc of 2 bytes integers | ||
'i2' nxs:/$(signal)[i] | ||
|
||
@) | ||
?) | ||
@) | ||
@) |
Oops, something went wrong.