#============================================================================== # 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= [-m ] [-w uid:gid] # # $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://] # define a variable % datagrp = $(entry_name)/scan_data # 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)/] # 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)/[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] @) ?) @) @)