Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Subaru-PFS/drp_qa
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0c884edd3486c4aa60917b916f0d6497b42cb253
Choose a base ref
..
head repository: Subaru-PFS/drp_qa
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: cf4f3d1f4033e8aa46e23d04328614cc68106e06
Choose a head ref
17 changes: 11 additions & 6 deletions python/pfs/drp/qa/dmCombinedResiduals.py
Original file line number Diff line number Diff line change
@@ -176,7 +176,7 @@ def get_ccd(dm: DetectorMap) -> str:

def make_report(
residual_stats: pd.DataFrame,
arc_data: pd.DataFrame,
residual_data: pd.DataFrame,
detectorMaps: Dict[str, DetectorMap],
run_name: str,
log: object,
@@ -219,13 +219,13 @@ def make_report(
# Add the 2D residual plot.
arm = ccd[0]
spec = int(ccd[1])
data = arc_data.query(f"arm == '{arm}' and spectrograph == {spec}")
plot_data = residual_data.query(f"arm == '{arm}' and spectrograph == {spec}")

# If we are doing a combined report we want to get the mean across visits.
grouped = data[plot_cols].groupby(["status", "isLine", "fiberId", "y"])
data = grouped.mean().reset_index()
grouped = plot_data[plot_cols].groupby(["status", "isLine", "fiberId", "y"])
plot_data = grouped.mean().reset_index()

residFig = plot_detectormap_residuals(data, visit_stats, detectorMaps[str(ccd)])
residFig = plot_detectormap_residuals(plot_data, visit_stats, detectorMaps[str(ccd)])
residFig.suptitle(f"DetectorMap Residuals - Median of all visits - {ccd}", weight="bold")
pdf.append(residFig, dpi=150)

@@ -426,6 +426,8 @@ def plot_visits(
metricData = plotData.copy()
if metric == "spatial":
metricData = metricData.query("description == 'Trace'")
else:
metricData = metricData.query("description != 'Trace'")

for desc, grp in metricData.groupby("description"):
grpPlotData = grp.copy()
@@ -462,6 +464,10 @@ def plot_visits(
ax.axvline(0, c="k", ls="-", alpha=0.75)
ax.set_title(f"{metric}")
ax.set_xlabel("pix")

leg = ax.legend(loc="upper right", shadow=True)
leg.set_zorder(1000)

if spatialRange is not None and metric == "spatial":
ax.set_xlim(-spatialRange, spatialRange)
if wavelengthRange is not None and metric == "wavelength":
@@ -487,7 +493,6 @@ def plot_visits(
ax0.invert_yaxis()

fig.suptitle("RESERVED median and 1-sigma weighted errors", fontsize="small")
fig.legend()

return fig

Loading