Ticket #3051 (closed: fixed)
Have a look at the usage of floats in Nexus file writing
Reported by: | Stuart Campbell | Owned by: | Janik Zikovsky |
---|---|---|---|
Priority: | minor | Milestone: | Release 2.0 |
Component: | Mantid | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Tester: | Jose Borreguero |
Description
In some of the Nexus writers that save events (e.g. SaveNexusProcessed) there are places where the following sort of thing occurs
if (weights) weights[i] = it->weight();
where weights is a float array and weight() returns a double.
I am presuming that they are floats as the NeXus file contains FLOAT32. Is there a good reason why we don't just write the double to the file rather than convert to a float ?
I have (to get rid of the warnings) just added a static_cast<float>() for the moment as I didn't want to change too much without asking you first.
I have marked the code with FIXMEs - but one of the places is line ~284 in SaveNexusProcessed.cpp
Change History
comment:2 Changed 9 years ago by Janik Zikovsky
- Milestone changed from Iteration 29 to Iteration 30
Moved my tickets that won't get finished by iteration 29
comment:3 Changed 9 years ago by Nick Draper
- Milestone changed from Iteration 30 to Iteration 31
Bulk move of tickets to iteration 31 at the iteration 30 code freeze
comment:5 Changed 9 years ago by Janik Zikovsky
Events have their weight as a float (which is returned as a double because I think that was more convenient for other operations, avoiding warnings) and then re-converted to float for saving (to save some space). Therefore there is no real loss of information.
comment:6 Changed 9 years ago by Janik Zikovsky
- Status changed from accepted to verify
- Resolution set to fixed
In [14921]:
line 570 in SaveToSNSHistogramNexus.cpp