Skip to content

Commit

Permalink
Respond to comments
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewfullard committed Jan 13, 2025
1 parent e6b2f23 commit 9938e6f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 16 deletions.
8 changes: 8 additions & 0 deletions docs/workflows/v_inner_solver_workflow.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@
"config = Configuration.from_yaml('../tardis_example.yml')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This code modifies the TARDIS example configuration to include convergence information for the inner boundary velocity solver.\n",
"Note that the number of shells is increased and the starting velocity is reduced to provide more granularity and a wider search window, respectively."
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down
32 changes: 16 additions & 16 deletions tardis/workflows/v_inner_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,38 +112,38 @@ def get_convergence_estimates(self, transport_state):

return estimates

def reproject(self, a1, m1, a2, m2):
def reproject(self, array_one, mask_one, array_two, mask_two):
"""Reprojects two sub_arrays defined by a set of masks onto an array where the masks of both objects are true
let A1, A2 be arrays of size gemetry.no_of_shells and
a1 = A1[m1],
a2 = A2[m2]
a1 = A1[mask_one],
a2 = A2[mask_two]
find a1*, a2* s.t.
a1* = A1[m1 & m2],
a2* = A2[m1 & m2]
a1* = A1[mask_one & mask_two],
a2* = A2[mask_one & mask_two]
this is equivalent to
a1* = A1[m1][m2[m1]] = a1[m2[m1]],
a2* = A2[m2][m1[m2]] = a2[m1[m2]]
a1* = A1[mask_one][mask_two[mask_one]] = a1[mask_two[mask_one]],
a2* = A2[mask_two][mask_one[mask_two]] = a2[mask_one[mask_two]]
Parameters
----------
a1 : np.ndarray
array1 : np.ndarray
A sub array of an array with the shape of a geometry property
m1 : np.ndarray(bool)
mask_one : np.ndarray(bool)
Mask such that the parrent array accessed at this mask gives a1
a2 : np.ndarray
array_two : np.ndarray
A sub array of an array with the shape of a geometry property
m2 : np.ndarray(bool)
mask_two : np.ndarray(bool)
Mask such that the parrent array accessed at this mask gives a2
Returns
-------
a1*
reprojection of a1 onto m1 & m2
a2*
reprojection of a2 onto m1 & m2
array_one*
reprojection of array_one onto mask_one & mask_two
array_two*
reprojection of array_two onto mask_one & mask_two
"""
return a1[m2[m1]], a2[m1[m2]]
return array_one[mask_two[mask_one]], array_two[mask_one[mask_two]]

def print_mask(self, mask):
return "".join([{True: "-", False: "X"}[m] for m in mask]).join("[]")
Expand Down

0 comments on commit 9938e6f

Please sign in to comment.