Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions rsstitcher/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@ def compute_radial_profiles(
r_gamma: np.ndarray,
out_r: np.ndarray,
out_gamma: np.ndarray,
positions: pd.DataFrame,
radial_bins: list[tuple[float, float]],
n_decimals: int,
) -> pd.DataFrame:
Expand All @@ -556,8 +557,16 @@ def compute_radial_profiles(
for r_lo, r_hi in radial_bins:
col_name = f"S = {r_lo} to {r_hi} A^-1"
mask = (out_r >= r_lo) & (out_r < r_hi)

n_sector = positions[(positions["R"] >= r_lo) & (positions["R"] < r_hi)]
values, counts = np.unique(
n_sector["Gamma"].to_numpy(), return_counts=True, equal_nan=False
)

if mask.any():
result[col_name] = np.nanmax(r_gamma[mask, :], axis=0)
result[col_name] = (
np.nanmax(r_gamma[mask, :], axis=0)[: len(counts)] / counts
)
else:
result[col_name] = np.full(len(out_gamma), np.nan)

Expand Down Expand Up @@ -740,7 +749,7 @@ def run_experiment(

if radial_bins is not None and len(radial_bins) > 0:
result["radial_profiles"] = compute_radial_profiles(
r_gamma, out_r, out_gamma, radial_bins, n_decimals
r_gamma, out_r, out_gamma, positions, radial_bins, n_decimals
)

return result
Loading