Feature/misalign coils#13
Conversation
…tialized to 0 so everything should be backward compatible. r0 shifts the coil in r, so we can simulated uncertered coils. The implementation is straight forward since we evaluate B(r-r0). In addition alpha does a tilt, by rotating from a primed lab/simulation frame to the unprimed frame that is aligned wiht the coil. The rotation has to work on the (z',r')->(z,r) vector and the resulting field has to be rotated in opposite direction (Bz, Brho) -> (Bz', Brho'). These modifications allow for studing misalignment of coils.
| @@ -62,6 +67,13 @@ def evaluate_B(self, pos, derivatives=False): | |||
|
|
|||
| Bz[...] = C/(2*alpha**2*beta)*((a**2 - r**2)*E_k2 + alpha**2*K_k2) | |||
|
|
|||
There was a problem hiding this comment.
Could gate the new raw arrays by if self.alpha!=0: Saves some time and memory. Unfortunately, CRESana has a big memory footprint already if it is run with a long trajectory. If I recall correctly it does not directly matter with the current setups that I use because the B_field evaluation is done with the Interpolation function. Without the interpolation function the line B_raw=np.empty_like(pos) will create a new array of size n_samples*n_antennas during the simulation.
MCFlowMace
left a comment
There was a problem hiding this comment.
It looks straightforward to me. But I think the field would not be rotationally symmetric anymore, right? Some parts of the trajectory simulation needs the assumption of rotational symmetry. I suggest we add a warning with the python warnings package to the coil class if the new parameters are used that tells that it might be incompatible for the simulation. Here is an example where I use the warnings package for a deprecation warning https://github.com/MCFlowMace/CRESana/blob/feature/misalign_coils/cresana/trap.py#L321
Should be a different warning type.
Also it would be nice if the visualization of the setup, from here
https://github.com/MCFlowMace/CRESana/blob/feature/misalign_coils/cresana/bfield.py#L455
would be compatible with this change. I suggest to move the calculation of the line of a coil to the Coil class itself and add a function that can be used in visualize to ask for the line.
…ry. Move calculation of path in Coil class and call it while plotting.
…a into feature/misalign_coils
|
I implemented all three suggestions, ready for re-review |
|
I just looked at the visualization of a coil with r offset and a rotation angle using the |
Implement rotation in (r,z) and shift in r for misalignment studies.