nexusformat / features

Work on NeXus features and recipes by the NIAC and friends
0 stars 6 forks source link

disk chopper off file feature #34

Closed DolicaAkelloEgwel closed 5 years ago

DolicaAkelloEgwel commented 5 years ago

Creates OFF files from NXdisk_chopper info in a NeXus file. The chopper width and resolution have to be set in the recipe __init__ method and will be the same for every file generated. The resolution works by creating an array of angles using np.linspace(0, recipe.TWO_PI, resolution + 1)[1:] and then "splits" the chopper at these angles. This doesn't take the slits into account so the splits can end up close to the slit edges. Files are saved to the working directory in the format chopper_geometry_X.off with X being the file number.

matthew-d-jones commented 5 years ago

Can be tested by running:

python src/nxfeature.py examples/example_nx_disk_chopper.nxs

The example in the file is a WFM chopper disk from V20: Screenshot_20190524_121029

The output from the feature is an OFF model which looks like this: Screenshot_20190605_104220

DolicaAkelloEgwel commented 5 years ago

I ran it again after fixing the slit_height mistake and it looks closer to the diagram from this perspective. snapshotchopper00

zjttoefs commented 5 years ago

This is very nice! A really nice example of a NeXus feature!

I also applaud your effort to actually request an official ID from the semi-official https://hidden-springs-12500.herokuapp.com/

On that page (and I agree that's not obvious enough) it says that further I/O to files other than the open NeXus file is not allowed. So I have an issue with the file automatic generation.

What I would recommend is that the process() returns an object that wraps the file_content, is (potentially) able to write itself to file, and has a str() method that actually returns some information about the chopper to instil trust that the feature processed correctly. Like:

Chopper ("name") has 6 openings covering 43% of the disk.

To allow for multiple choppers it can obviously return an array of such objects.

Makes sense?

BTW: Do you have an idea what the travis build claims to fail? I've not investigated, but suspect it's got nothing to do with you.

zjttoefs commented 5 years ago

One additional thing: If there are no Choppers defined in the file or they are incorrectly defined, the recipe is supposed to throw an exception.

And I was thinking whether there would be a good way to indicate the position of the TDC pickup. We help if you incorporate the OFF into a larger model. Otherwise the location is at the top. Right?

zjttoefs commented 5 years ago

Looks like you may have addressed all my comments. Shall I have another look or is there stuff still in progress?

matthew-d-jones commented 5 years ago

I think the only remaining point regards the TDC position. We could document it with a comment in the recipe, but I don't really have any other ideas.

zjttoefs commented 5 years ago

For the TDC I was thinking to put some indicator triangle on the outside rim. That has the obvious problem that it could coincide with a cut out or the edge of one. But a cut out triangle in the inside radius would work. Have a think, if that's easy. Not the end of the world, if I don't get it. :)

DolicaAkelloEgwel commented 5 years ago

This how the mesh looks with the top dead cente arrow snapshot00