Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a loader for mcstas files? #458

Open
nvaytet opened this issue Sep 19, 2023 · 3 comments
Open

Add a loader for mcstas files? #458

nvaytet opened this issue Sep 19, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@nvaytet
Copy link
Member

nvaytet commented Sep 19, 2023

A simple loader for ascii and hdf mcstas files was added in the dmsc summer school repo.

I could be useful to generalise this and make it into a loader for mcstas files.

One issue is that the files contain the x and y positions of the events, but not the z positions (columns are ["p", "x", "y", "n", "id", "t"]).
Those, I guess, are deduced from where the detector is placed in the instrument.
So we would need to parse the instrument geometry to deduce them... which does not sound like a nice exercise.

In addition, the x and y coordinates are in the coordinate system of the detector, iirc. So this also means that if the detector is tilted with respect to the beamline axis (e.g. 45 degrees), then we also need the instrument geometry to convert those to real x,y,z in cartesian space.

Ideally for Scipp, at the end of the day, we need a list of x,y,z position in cartesian space, with absolute values (not relative to a detector panel).

Can this be achieved without parsing mcstas instrument files?

@nvaytet nvaytet added the enhancement New feature or request label Sep 19, 2023
@SimonHeybrock
Copy link
Member

SimonHeybrock commented Jan 31, 2024

Parts of this was probably implemented in https://github.com/scipp/essnmx. It also includes some parsing of the XML position information, but I do not know how generic that is.

@YooSunYoung
Copy link
Member

Greg said he has already tried to make a general one so let's have a look at that too...!

@YooSunYoung
Copy link
Member

Torben just found out McStas version 3 output breaks the nmx loader.
And Justin(NMX IDS) said they are not going to use McStas 3 so soon.
So we may need to survey how many of instrument data scientists are using which version of McStas when we implement this.

However, the breaking change in the output file should be trivial to adapt as far as Justin could see.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants