Compute one 0th-order center per spectrum from the two-blob model.
Each spectrum has a rank-1 (blue edge, 1206 nm) and rank-2 (red edge,
1892 nm) blob -- the RGS passband's transmission edges, per
doi:10.1051/0004-6361/202555859 (not the previous round-number
placeholders) -- the 0th-order center is their mean centroid.
| Parameters: |
-
filepath
(str or Path -- path to a *_zeroth.csv file)
–
-
sig_max
(float -- centroid uncertainty threshold [mm], see load_spectra., default:
0.05
)
–
|
| Returns: |
-
pd.DataFrame -- one row per spectra_id with cent_y, cent_z, theta, phi.
–
|
Source code in dispcraft/measurement.py
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88 | def zeroth_order_centers(filepath, sig_max=0.05):
"""Compute one 0th-order center per spectrum from the two-blob model.
Each spectrum has a rank-1 (blue edge, 1206 nm) and rank-2 (red edge,
1892 nm) blob -- the RGS passband's transmission edges, per
doi:10.1051/0004-6361/202555859 (not the previous round-number
placeholders) -- the 0th-order center is their mean centroid.
Parameters
----------
filepath : str or Path -- path to a *_zeroth.csv file
sig_max : float -- centroid uncertainty threshold [mm], see load_spectra.
Returns
-------
pd.DataFrame -- one row per spectra_id with cent_y, cent_z, theta, phi.
"""
df = _median_per_rank(load_spectra(filepath, sig_max=sig_max, sig_columns=("sig_y",)))
centers = df.groupby("spectra_id").agg(
cent_y=("cent_y", "mean"),
cent_z=("cent_z", "mean"),
theta=("theta", "first"),
phi=("phi", "first"),
).reset_index()
return centers
|