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 new geometry definitions #601

Merged

Conversation

matthew-d-jones
Copy link
Member

Added the new geometry groups for describing the shape of any beamline component (including detectors) as discussed at the NeXus Code Camp (11/17).

Copy link
Contributor

@zjttoefs zjttoefs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it Github or is the indentation a bit inconsistent?


<dimensions rank="2">
<dim index="1" value="i" />
<dim index="2" value="2 or 3" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You cannot define a cylinder in two dimensions.

Shape description of the whole detector. Use only if pixels in the detector are not of uniform shape.
</doc>
</group>
<group name="pixel_shape" type="NXcylindrical_geometry">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You cannot have two "pixel_shape" groups with the same name. For now this could be an either/or choice, but in the long run we did discuss some scheme of providing alternatives (OFF for the dumb programs, cylinders for the slightly smarter ones, and the CAD thing for whoever wants to implement it - or so).
Probably worth thinking about that some more.

if the pixel shapes are non-uniform, to describe the shape of the whole detector.
</doc>

<field name="vertices" type="NX_FLOAT" units="NX_LENGTH">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would allow NX_NUMBER. Then you could us mm and store INTs.
Applies a number of times.


<dimensions rank="2">
<dim index="1" value="i" />
<dim index="2" value="2 or 3" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we're saving much by allowing 2D here.

Copy link
Contributor

@zjttoefs zjttoefs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The question may depend on what @prjemian thinks. Otherwise I'm okay with this PR.

subdivision of a detector.
</doc>
</group>
<group name="pixel_shape" type="NXoff_geometry">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My gut feeling would be to wrap the two kinds of pixel_shape in an XSD (or whatever the correct thing is). That makes it obvious that you cannot have both.
To the very least I would group the two next to each other. Same for detector_shape.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe @zjttoefs is correct. A definition with a this-or-that component needs support in the XSD (XML Schema for the NXDL). I'll take a deeper look later today. There may already be a precedent in another definition.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation builds with no errors.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a typo on this line? Perhaps, instead, this:

<dim index="2" value="3" />

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A matter of style in the documentation (in the NXDL files).

Good practice to keep the first documentation to one line and separate from any succeeding lines. This allows automatic generation of concise summaries such as for the base class definitions.

Also, please make a line break between 60-80 characters on a line so that the raw source code becomes much easier to read and review such as this example.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering this line:

This dataset should only be used only if the ``NXoff_geometry`` group is describing a detector.

Can we describe the algorithm by which the XML Schema could enforce this? The XML Schema should have no knowledge of any of the NXDL classes. Probably best not to implement in the XSD since that would introduce this knowledge.

Could we enforce this by some rule in the NXDL file itself? Where is the information provided by which validation can check this? By traversing the parent (or chain of parents) of the NXoff_geometry instance?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That the documentation builds is good, but I'm not sure it is sufficient. The validation may need some help to know that there can be one of two groups under a single name. Even just for the person reading the NXDL <choice> make things that little bit more obvious.

@prjemian prjemian self-requested a review March 19, 2018 12:37
@zjttoefs
Copy link
Contributor

@matthew-d-jones if you could check it all works with the <choice> we should be able to get this into the upcoming milestone.

@zjttoefs zjttoefs added the telco label Apr 18, 2018
@zjttoefs
Copy link
Contributor

@mkoennecke volunteered to make <choice> work in the validation if it has been added to NXDL and the manual. Both can happen after the next release, but we can merge this before.
Do you agree @prjemian ?

@prjemian
Copy link
Contributor

I believe the best way to proceed for the proposed <choice> element to be added to the NXDL is to open a new issue. The use in this instance seems clear, yet I can imagine new situations may be presented in the future that will not be associated with NXdetector.

@prjemian
Copy link
Contributor

Once #619 is resolved, this PR can proceed.

Copy link
Contributor

@prjemian prjemian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once #619 is resolved, this PR can proceed accordingly.

@zjttoefs zjttoefs added this to the NXDL 2018.5 milestone May 15, 2018
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://definition.nexusformat.org/nxdl/3.1 ../nxdl.xsd"
name="NXcylindrical_geometry"
version="1.0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

due to recent #619 (& PR 622), please remove the version attribute

<!--
# NeXus - Neutron and X-ray Common Data Format
#
# Copyright (C) 2008-2017 NeXus International Advisory Committee (NIAC)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change 2017 to 2018 in the copyright date

@prjemian
Copy link
Contributor

I will squash merge, then fix these minor things myself.

@prjemian prjemian merged commit 1cd055f into nexusformat:master May 15, 2018
prjemian added a commit that referenced this pull request May 15, 2018
@matthew-d-jones matthew-d-jones deleted the Add_new_geometry_definitions branch May 15, 2018 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants