Skip to content

Commit

Permalink
[#897] Fixed camera order for geometry matrix concatenation + inversi…
Browse files Browse the repository at this point in the history
…ons input
  • Loading branch information
dvezinet committed Feb 5, 2024
1 parent 8c917a6 commit 595a90e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
4 changes: 3 additions & 1 deletion tofu/data/_class09_GeometryMatrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,14 @@ def add_geometry_matrix(
def get_geometry_matrix_concatenated(
self,
key=None,
key_cam=None,
):
""" Assemble the geometry matrix """

return _compute._concatenate(
coll=self,
key=key,
key_cam=key_cam,
)

# -----------------
Expand Down Expand Up @@ -147,4 +149,4 @@ def plot_geometry_matrix(
fs=fs,
dcolorbar=dcolorbar,
dleg=dleg,
)
)
12 changes: 10 additions & 2 deletions tofu/data/_class10_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def _compute_check(
)

key_diag = coll.dobj['geom matrix'][key_matrix]['diagnostic']
# key_cam = coll.dobj['geom matrix'][key_matrix]['camera']
key_cam = coll.dobj['geom matrix'][key_matrix]['camera']

keybs = coll.dobj['geom matrix'][key_matrix]['bsplines']
deg = coll.dobj['bsplines'][keybs]['deg']
Expand All @@ -82,7 +82,10 @@ def _compute_check(
mtype = coll.dobj[coll._which_mesh][keym]['type']

# matrix itself
matrix, ref, dind = coll.get_geometry_matrix_concatenated(key_matrix)
matrix, ref, dind = coll.get_geometry_matrix_concatenated(
key_matrix,
key_cam=key_cam,
)
lkmat = coll.dobj['geom matrix'][key_matrix]['data']
units_gmat = coll.ddata[lkmat[0]]['units']
nchan, nbs = matrix.shape[-2:]
Expand All @@ -98,6 +101,7 @@ def _compute_check(
coll=coll,
key_diag=key_diag,
key_data=key_data,
key_cam=key_cam,
)

# sigma
Expand Down Expand Up @@ -479,12 +483,14 @@ def _check_data(
coll=None,
key_diag=None,
key_data=None,
key_cam=None,
):

# load ddata from key_data
ddata = coll.get_diagnostic_data_concatenated(
key=key_diag,
key_data=key_data,
key_cam=key_cam,
flat=True,
)

Expand All @@ -501,6 +507,7 @@ def _check_sigma(
coll=None,
key_diag=None,
key_sigma=None,
key_cam=None,
sigma=None,
ddata=None,
nchan=None,
Expand Down Expand Up @@ -537,6 +544,7 @@ def _check_sigma(
coll=coll,
key=key_diag,
key_data=key_sigma,
key_cam=key_cam,
flat=True,
)

Expand Down
11 changes: 10 additions & 1 deletion tofu/data/_class9_compute.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,7 @@ def _store(
def _concatenate(
coll=None,
key=None,
key_cam=None,
):

# ------------
Expand All @@ -491,11 +492,19 @@ def _concatenate(
allowed=lok,
)

key_cam0 = coll.dobj['geom matrix'][key]['camera']
key_cam = ds._generic_check._check_var_iter(
key_cam, 'key_cam',
default=key_cam0,
types=(list, tuple),
types_iter=str,
allowed=key_cam0,
)

# -----------
# concatenate

key_data = coll.dobj['geom matrix'][key]['data']
key_cam = coll.dobj['geom matrix'][key]['camera']
axis = coll.dobj['geom matrix'][key]['axis_chan']

ref = list(coll.ddata[key_data[0]]['ref'])
Expand Down

0 comments on commit 595a90e

Please sign in to comment.