demonstration beam path files from Ron #564
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this is
This is a demonstration example, how a beam path description by NXbeam_device could look like
What this is not
A working code, which automatically performs the beam path description for arbitrary files with a standardized output format.
Content
The content are 3 folders, which shows different examples of a Beam Path description via directed graphs. This was done in python, via networkx.
1. example_beam_path_interferometer
The folder contains a python file to create a .nxs file (interferometer_v4.py) called
interferometer_v4.nxs
. The scriptcalculate_with_transfer_matrix_v4_adjusted_labels.py
will useinterferometer_v4.nxs
as input, to calculate a beam path. See this figure:All NXbeam_device elements have a transfermatrix table assigned. Arbitrary values are given to describe parameters such as beam attenuation and beam divergence. The output of these transfermatrix calculations is shown in this figure:
In this case, a subpath was calculated only. From: beam03 to beam07 to final_beam_detector and from BS1_to_Mirror_1_Beam to beam05 to final_beam_detector. The subpath development was done, as this is most probably only of relevance for real applications (power measured before and after an element. Only this can be compared. The desciption of the whole setup is not useful (error too large)). NXbeam entries, which maybe have to be generated by the program, are added to the NeXus file. A new output is created named
interferometer_v4_mod.nxs
.2. example_contraction_of_nodes:
The folder shows an example, how the interferometer can be contracted, by using a the
group
field fromNXbeam_device
. In this way, a simplified version of the setup can be displayed. This is shown in this figure:
This will be useful, for setup with several hundets of elements, as some components are just a frequency doubling of an input laser. This eases the visualization. In this example, the interferometer components (mirros and beamsplitters) are summed up as a single element.
3. example_beam_path_raman_setup:
** THIS EXAMPLE WAS MOVED TO
pynxtools-raman
see here: FAIRmat-NFDI/pynxtools-raman#32The algorithm:
Note: There is a lot of hardcoding involved, and various things are not generalized. Most probably, many functions from pynxtools could be used (i.e. to filter out all NXbeam_device entries in the NeXus file)
previous_devices
field inNXbeam_device
.NXtransformations
inNXbeam_device
.Note, that the beam direction is revered, as only the previous element of an optical beam is described.
Beams, which are not defined in the NeXus file (as the user only knows properties of the beam incident to the sample),
have to be created. These are named: NXS_Beam_1.
n2
ton6
andn7
(see: all_paths = list(nx.all_simple_paths(G, source=source_node_list[0], target=target_node_list[0]))).Iterate along the graph edges (beam states), and use the nodes (transfer matricies) to calculate the next edge (beam state).
Note for testing the scripts:
This was developed via Spyder on Windows 10. On my Linux system, the interactive graphs did now show up, as I did not invest any time to solve this.