Nxlauetof exporter and loader update for easier geometry reconstruction.#201
Nxlauetof exporter and loader update for easier geometry reconstruction.#201YooSunYoung merged 26 commits intomainfrom
Conversation
…ile as much as possible and fix unit test according to the chnages.
|
@aaronfinke I found the wrong calculation in the code and fixed it...! Now it gives the correct position. |
| reducer: NMXProgram = field(default_factory=NMXProgram) | ||
| "Information of the reduction software." | ||
|
|
||
| def to_datagroup(self) -> sc.DataGroup: |
There was a problem hiding this comment.
If this is just for display, can you turn this into _repr_mimebundle_?
There was a problem hiding this comment.
Not exactly. Because when it's a DataGroup the display repr says that it's sc.DataGroup, which is not really true.
There was a problem hiding this comment.
I don't understand.
Because when it's a DataGroup
When what is a data group?
I am suggesting something like
def _repr_mimebundle_(self):
return to_datagroup(self)._repr_mimebundle_()Does this not work?
There was a problem hiding this comment.
Data group does not have any repr_mimebundle though.
File [~/Projects/essnmx/src/ess/nmx/types.py:280](http://localhost:8888/lab/tree/src/ess/nmx/types.py#line=279), in NMXLauetof._repr_mimebundle_(self, include, exclude)
279 def _repr_mimebundle_(self, include=None, exclude=None):
--> 280 return to_datagroup(self)._repr_mimebundle_(include=include, exclude=exclude)
AttributeError: 'DataGroup' object has no attribute '_repr_mimebundle_'I could do sth like
def _repr_mimebundle_(self, include=None, exclude=None):
return {'text/html': to_datagroup(self)._repr_html_()}But then the html representation says that it's a scipp DataGroup like this.
But that's not true. It's a dataclass and also the children are dataclasses.
It'll be confusing to users.
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "!cp '/home/sunyoungyoo/.cache/scippnexus/1/PG3_4844_event.nxs' ./" |
There was a problem hiding this comment.
Please remove this and use portable code instead.
There was a problem hiding this comment.
Oh this is accidentally added... thanks
|
|
||
|
|
||
| @dataclass(kw_only=True) | ||
| class NMXSourceMetadata: |
There was a problem hiding this comment.
You could use scippneutron.metadata.Source (newly released) here. If you want inline fields, you could inherit from it. The only problem is that the classes in scippneutron are pydantic models, not dataclasses.
There was a problem hiding this comment.
As we discussed before you went home, I used the scippneutron.metadata SourceType and RadiationProbe but not the Source. I added comments about that too.
Co-authored-by: Jan-Lukas Wynen <j-l.wynen@hotmail.de>
It was a bit hard to validate the result without custom loader for the NMX output file (nxlauetof).
Most changes is related to adjusting the in-memory result data structure, so it should not affect the output file.
Output files are meant to be read by DIALS and it won't use this loader so regression tests won't be necessary.
The loader is only for the IDS member and developers.
The loader adjust and reconstruct some coordinates from the file.
And there is a test that checks if the reconstructed positions are good enough (i.e. difference less than 10th of pixel size.)