Create new datatype when saving CartesianPoint to HDF5 using LegendHDF5IO#560
Create new datatype when saving CartesianPoint to HDF5 using LegendHDF5IO#560fhagemann merged 39 commits intoJuliaPhysics:mainfrom
CartesianPoint to HDF5 using LegendHDF5IO#560Conversation
fhagemann
left a comment
There was a problem hiding this comment.
Thanks so much for taking care of this!!
I would like to have tests to ensure that creating events/charge clouds with units actually works as intended. It looks, for example, that the number of charges in an NBodyChargeCloud are not passed further down.
Can you create tests for each of the functions that you modified/added?
And unrelated, but we should have tests for EVERY function/method that involves CartesianPoint or CylindricalPoint to ensure that there are no bugs after having merged #489 !
|
I implemented the suggestions and also added a fix to |
c1ccfd0 to
fa9ea25
Compare
7aed281 to
be4ec17
Compare
|
With my latest commit be4ec17, we should now be able to write/read Tests failing are unrelated, same issue as before (with the documentation and Geant4 tests expecting |
|
I also reverted two of your commits to see if going back to |
This should be fixed now after reverting the changes made to the Geant4-Table pos column
|
I pushed my requested changes. Maybe the most consistent way to proceed would be to also strip the units of |
|
Yes, in principle, before this PR |
|
Didn't we want to leave units out for now? |
That’s the question: |
|
Sounds good. |
|
@claudiaalvgar: could you remove the units from the |
|
Yes, I can add this but I still have the question if the code in Event.jl will stay as it is, if we should delete the changes to account for the units or if there are more changes to implement given this comment:
|
I don't see why not. Many (all?) methods use
Ideally, all changes should still work, if we use values without units. I would keep the changes, but maybe restrict the type
If the event locations are of type |
|
My question is: Should this be deleted |
|
We can define If we can leave the code as is, it will be easier to support points with eltypes having units in the future, because the majority of the required code modifications should already be there. But maybe @oschulz has an opinion on this (?) |
663332c to
ddaa78c
Compare
|
I think I implemented the changes suggested. The modification in |
CartesianPoint and CylindricalPoint with units
…uliaPhysics#560) * Function to define CylindricalPoint with units * Allow NBodyChargeCloud to receive CylindricalPoint in Floats and with units and CartesianPoint with units * Use the defined function to_internal_point to convert Points to Cartesian when passed to Events * Fix manual with new behaviour * convert CartesianPoint to SVector to be returned from run_geant4_simulation fixes bug * add test for bug found * pass N and unify functions * restrict Unitful.Quantity * implemented suggestions * export to_internal_point function * Add tests for new NBodyChargeCloud functions * comment erro line * add test * unify functions, just 1 function failed * add functions to to_internal_units * added suggested changes * delete export to_internal_point * delete ucovert * Add `LegendHDF5IO` support for `Cartesian/CylindricalPoint` * Revert "comment erro line" This reverts commit 178caea. * Revert "convert CartesianPoint to SVector to be returned from run_geant4_simulation fixes bug" This reverts commit cc73fea. * put back Cylindrical test with units * change CylindricalPoint function and delete function to_internal_units(p::SVector{3, <:Unitful.Quantity}) * Update stripping units of `CylindricalPoint` * Add tests for units/type promotion of `CylindricalPoint` * convert cluster_radius to internal units * Add CartesianPoint constructor to avoid units * uncomment tests * remove units from test * add back units to pos * add tests * remove units * account for suggestions * Suggested changes and fix doc without units * No need to deal with units, the plot recipe will deal with this * Strip position units in `simulate_waveforms` further down * Add test for different types of `pos` in `simulate_waveforms` * Ensure cluster radius is charge clustering has correct units * Avoid converting `CartesianPoint` to `SVector` when writing to HDF5 --------- Co-authored-by: Felix Hagemann <hagemann@berkeley.edu>
CartesianPoint and CylindricalPoint with unitsCartesianPoint to HDF5 using LegendHDF5IO
This PR allows for
CartesianPointandCylindricalPointwith and without units from #489 to be passed toEventandNBodyChargeCloud( issue in #183 ). Test code and modes allowed: