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

Error under data/_class8_los_angles at dphi when compute_vos_from_los=True #984

Open
cjperks7 opened this issue Nov 12, 2024 · 0 comments
Open

Comments

@cjperks7
Copy link
Collaborator

Could definitely be user error, but I get this error message when I try to build a diagnostic with compute_vos_from_los=True. I've already checked before this that my local install of tofu is up-to-date with git and am at version 1.8.1.

If it's something wrong with my code then the script can be found under _build_diag under:
https://github.com/cjperks7/cmp_tofu_xicsrt/blob/master/setup/_build_tofu.py
with dsub['method'] == 'zoom' for the sub-camera options

Things seem to look fine when compute_vos_from_los=False and I took a look at things with coll.plot_diagnostic(). A .npz file for this Collection object was sent in a private message

Thanks for the help!

File ~/cmp_tofu_xicsrt/setup/_build_tofu.py:214, in _build_diag(dap, dcry, dmat, dcam, lamb0, subcam, doptics)
    208     coll.add_camera_2d(
    209         key = cam_label,
    210         dgeom = dcam 
    211         )
    213 # Builds diagnostic
--> 214 coll.add_diagnostic(
    215     key = diag_label,
    216     doptics = {cam_label: [cry_label, ap_label]},
    217     compute = True, # compute LOS
    218     compute_vos_from_los = True,
    219     convex = True,
    220     config = tf.load_config('SPARC-V0')
    221     )
    223 # Output
    224 return coll

File ~/tofu/tofu/data/_class08_Diagnostic.py:107, in Diagnostic.add_diagnostic(self, key, doptics, etendue, config, length, reflections_nb, reflections_type, key_nseg, compute, add_points, convex, rocking_curve_fw, compute_vos_from_los, verb, **kwdargs)
    105 computable = any([len(v0['optics']) > 0 for v0 in dopt.values()])
    106 if compute is True and computable:
--> 107     self.compute_diagnostic_etendue_los(
    108         key=key,
    109         analytical=True,
    110         numerical=False,
    111         res=None,
    112         check=False,
    113         # los
    114         config=config,
    115         length=length,
    116         reflections_nb=reflections_nb,
    117         reflections_type=reflections_type,
    118         key_nseg=key_nseg,
    119         # equivalent aperture
    120         add_points=add_points,
    121         convex=convex,
    122         # spectro-only
    123         rocking_curve_fw=rocking_curve_fw,
    124         # bool
    125         compute_vos_from_los=compute_vos_from_los,
    126         verb=verb,
    127         plot=False,
    128         store='analytical',
    129     )

File ~/tofu/tofu/data/_class08_Diagnostic.py:285, in Diagnostic.compute_diagnostic_etendue_los(self, key, analytical, numerical, res, check, margin_par, margin_perp, ind_ap_lim_spectral, rocking_curve_fw, rocking_curve_max, add_points, convex, config, length, reflections_nb, reflections_type, key_nseg, compute_vos_from_los, verb, plot, store, debug)
    280 c0 = (
    281     any([np.any(np.isfinite(v0['los_x'])) for v0 in dcompute.values()])
    282     and store
    283 )
    284 if c0:
--> 285     _los_angles.compute_los_angles(
    286         coll=self,
    287         key=key,
    288         # los
    289         config=config,
    290         length=length,
    291         reflections_nb=reflections_nb,
    292         reflections_type=reflections_type,
    293         key_nseg=key_nseg,
    294         dcompute=dcompute,
    295         compute_vos_from_los=compute_vos_from_los,
    296     )

File ~/tofu/tofu/data/_class8_los_angles.py:106, in compute_los_angles(coll, key, dcompute, config, length, reflections_nb, reflections_type, key_nseg, res, compute_vos_from_los, **kwdargs)
    103     if ii == 0:
    104         print(f"\tComputing vos from los for diag '{key}'")
--> 106     _vos_from_los(
    107         coll=coll,
    108         key=key,
    109         key_cam=key_cam,
    110         v0=v0,
    111         config=config,
    112         res=res,
    113     )
    115 # ----------------------------------------
    116 # for spectro => estimate angle variations
    118 if v0['spectro'] is True:

File ~/tofu/tofu/data/_class8_los_angles.py:323, in _vos_from_los(coll, key, key_cam, v0, config, res)
    321 if phimax - phimin > np.pi:
    322     phimin, phimax = phimax, phimin + 2.*np.pi
--> 323 dphi[0, ind] = phimin
    324 dphi[1, ind] = phimax
    326 # -----------
    327 # poly_cross

IndexError: index 10 is out of bounds for axis 1 with size 10

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

No branches or pull requests

2 participants