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

Fix for instrument view axes orientation. #38593

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

dmitry-ganyushin
Copy link
Contributor

Description of work

8875: [MANTID] The display of BIOSANS "detector1" in Mantid's instrument-viewer has an incorrect orientation

  • When viewing the instrument, if we select tab "instrument" then component "detector1", [the component is show with the horizontal axis (X) along the vertical]
CG3_detector1_view

Summary of work

The function which calculates 3D projections of instrument components was modified.

Further detail of work

To test:

Open a run file, select tab "Instrument" , and "detector1". The Y-axis should point up.


Reviewer

Please comment on the points listed below (full description).
Your comments will be used as part of the gatekeeper process, so please comment clearly on what you have checked during your review. If changes are made to the PR during the review process then your final comment will be the most important for gatekeepers. In this comment you should make it clear why any earlier review is still valid, or confirm that all requested changes have been addressed.

Code Review

  • Is the code of an acceptable quality?
  • Does the code conform to the coding standards?
  • Are the unit tests small and test the class in isolation?
  • If there is GUI work does it follow the GUI standards?
  • If there are changes in the release notes then do they describe the changes appropriately?
  • Do the release notes conform to the release notes guide?

Functional Tests

  • Do changes function as described? Add comments below that describe the tests performed?
  • Do the changes handle unexpected situations, e.g. bad input?
  • Has the relevant (user and developer) documentation been added/updated?

Does everything look good? Mark the review as Approve. A member of @mantidproject/gatekeepers will take care of it.

Gatekeeper

If you need to request changes to a PR then please add a comment and set the review status to "Request changes". This will stop the PR from showing up in the list for other gatekeepers.

@sf1919 sf1919 added this to the Release 6.12 milestone Jan 14, 2025
@jclarkeSTFC
Copy link
Contributor

I think this will change the orientation for every instrument, are they all wrong, or just BIOSANS?

@@ -287,7 +287,7 @@ void Projection3D::componentSelected(size_t componentIndex) {
Quat rot;
try {
const auto compDir = normalize(pos - componentInfo.samplePosition());
V3D up(0, 0, 1);
V3D up(0, 1, 0);
Copy link
Member

Choose a reason for hiding this comment

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

Would it be more robust to use the instrument's defaults/reference-frame/pointing-up#axis field (BIOSANS example)? I admit that only POLREF doesn't choose y, but it looks like it is supposed to be configurable.

Copy link
Member

Choose a reason for hiding this comment

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

I'm surprised that the Instrument::getReferenceFrame() doesn't come into play here. I don't see how one accesses it from the Project3D either

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That changes only the "Instrument"-->"detector1" view and "Instrument"-->"detector1"-->"bank" view
The "Instrument" view is not affected.
For BIOSANS:
"detector1" view current:
image
"detector1" view proposed:
image
Banks view current:
image
Banks view proposed:
image

For EQSANS
"detector1" view current:
image
"detector1" proposed view:
image
Banks view current:
image
Banks view proposed:
image

Copy link
Contributor

Choose a reason for hiding this comment

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

This changes how every instrument looks on that tab, e.g. here's MARI:
image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, can I obtain somehow your file for testing?

Copy link
Contributor

Choose a reason for hiding this comment

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

You can run LoadEmptyInstrument with InstrumentName="MARI", but all the instruments will be affected, I only used MARI as an example because that happened to be the last file I loaded in Workbench.

Copy link
Contributor Author

@dmitry-ganyushin dmitry-ganyushin Jan 16, 2025

Choose a reason for hiding this comment

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

Thanks. I assume the second image is the current implementation. The green axis on the first image points up as in all other (fixed) situations.

Copy link
Contributor Author

@dmitry-ganyushin dmitry-ganyushin Jan 16, 2025

Choose a reason for hiding this comment

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

And your main instrument view has also the green axis up
mari
The view is changed, but now have all views more consistent with Y axis up

@RichardWaiteSTFC
Copy link
Contributor

I may not have all the background to this, but I agree with @peterfpeterson that the best solution that is general for all instrument is to use the reference frame in the IDF?

There are instances like here

const double beamHeight = 2 * bboxCentre[frame->pointingUp()] + bbox[frame->pointingUp()];

where

 const auto frame = instrument.getReferenceFrame();

But is the problem that you don't have access to the instrument?

@RichardWaiteSTFC
Copy link
Contributor

I note there are couple of other places in the code where a direction for vertical is hard-coded e.g.

V3D up = findPixelPos(bankName, midX, midY + 1) - findPixelPos(bankName, midX, midY);

V3D up = findPixelPos(bankName, midX, midY + 1) - findPixelPos(bankName, midX, midY);

Kernel::V3D Up = V3D(upX, upY, upZ) + CalCenter;

@sf1919
Copy link
Contributor

sf1919 commented Jan 17, 2025

The release note structure for v6.13 has been created. You can now rebase your branch and move the release note in this PR.

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

Successfully merging this pull request may close these issues.

5 participants