diff --git a/python/lsst/production/tools/htmlUtils.py b/python/lsst/production/tools/htmlUtils.py
index 2790064..2c65222 100644
--- a/python/lsst/production/tools/htmlUtils.py
+++ b/python/lsst/production/tools/htmlUtils.py
@@ -29,16 +29,14 @@ def mk_table_value(row, metric_defs, val_col_name, sig_col_name):
Parameters
----------
- t : `astropy.table.Table`
- Table of metrics
+ row : `astropy.table.Table`
+ A row of the metric table
metric_defs : `dict`
A dictionary of metrics and their thresholds
val_col_name : `str`
The name of the metric column
sig_col_name : `str`
The associated sigma column
- n : `n`
- The row number
Returns
-------
@@ -206,15 +204,13 @@ def mk_summary_plot_cell(tract):
return (plot_str,)
-def mk_patch_num_cell(t, n, bands):
+def mk_patch_num_cell(row, bands):
"""Make patch number cell content
Parameters
----------
- t : `astropy.table.Table`
- Table of metrics
- n : `n`
- The row number
+ row : `astropy.table.Table`
+ A row of the metric table
bands : `list`
A list of the bands the metrics are in
@@ -227,25 +223,26 @@ def mk_patch_num_cell(t, n, bands):
for band in ["u", "g", "r", "i", "z", "y"]:
if band in bands:
patch_col = "coaddPatchCount_" + band + "_patchCount"
- patch_str += "" + band + ": " + str(int(t[patch_col][n])) + "
\n"
+ if patch_col in row.columns:
+ patch_str += "" + band + ": " + str(int(row[patch_col])) + "
\n"
+ else:
+ patch_str += "-"
return (patch_str,)
-def mk_shape_cols(t, metric_defs, n, bands, cols):
+def mk_shape_cols(row, metric_defs, bands, cols):
"""Make shape column cell contents
Parameters
----------
- t : `astropy.table.Table`
- Table of metrics
+ row : `astropy.table.Table`
+ A row from the metric table
metric_defs : `dict`
A dictionary of metrics and their thresholds
- n : `n`
- The row number
bands : `list`
A list of the bands the metrics are in
- cols : `list`
+ cols : `list`0
A list of columns to format
Returns
@@ -264,7 +261,7 @@ def mk_shape_cols(t, metric_defs, n, bands, cols):
val_col_name = col + "_" + band + "_" + sn + "_median"
sig_col_name = col + "_" + band + "_" + sn + "_sigmaMad"
val_str, sig_str, bad_val, link, debug_group = mk_table_value(
- t[n], metric_defs, val_col_name, sig_col_name
+ row, metric_defs, val_col_name, sig_col_name
)
num_bad += bad_val
shape_str += (
@@ -277,17 +274,15 @@ def mk_shape_cols(t, metric_defs, n, bands, cols):
return shape_strs
-def mk_stellar_locus_cols(t, metric_defs, n, cols):
+def mk_stellar_locus_cols(row, metric_defs, cols):
"""Make stellar locus column cell contents
Parameters
----------
- t : `astropy.table.Table`
- Table of metrics
+ row : `astropy.table.Table`
+ A row from the metric table
metric_defs : `dict`
A dictionary of metrics and their thresholds
- n : `n`
- The row number
cols : `list`
A list of the columns to format
@@ -307,19 +302,11 @@ def mk_stellar_locus_cols(t, metric_defs, n, cols):
val_col_name = col + flux1 + "_" + col + "_" + flux + "_median"
sig_col_name = col + flux1 + "_" + col + "_" + flux + "_sigmaMAD"
val_str, sig_str, bad_val, link, debug_group = mk_table_value(
- t[n], metric_defs, val_col_name, sig_col_name
+ row, metric_defs, val_col_name, sig_col_name
)
if val_str is None:
continue
- row_str += (
- ""
- + flux
- + "
Med: "
- + val_str
- + " σ: "
- + sig_str
- + "
"
- )
+ row_str += f"{flux}
Med: {val_str} σ: {sig_str}
"
row_str += "
\n"
num_bad += bad_val
if debug_group is not None:
@@ -329,17 +316,15 @@ def mk_stellar_locus_cols(t, metric_defs, n, cols):
return row_strs
-def mk_num_inputs_cell(t, metric_defs, n, bands):
+def mk_num_inputs_cell(row, metric_defs, bands):
"""Format the number of inputs cell
Parameters
----------
- t : `astropy.table.Table`
- Table of metrics
+ row : `astropy.table.Table`
+ A row from the table of metrics
metric_defs : `dict`
A dictionary of metrics and their thresholds
- n : `n`
- The row number
bands : `list`
A list of the bands the metrics are in
@@ -356,7 +341,7 @@ def mk_num_inputs_cell(t, metric_defs, n, bands):
sig_col_name = "coaddInputCount_" + band + "_inputCount_sigmaMad"
val_str, sig_str, _, _, _ = mk_table_value(
- t[n], metric_defs, val_col_name, sig_col_name
+ row, metric_defs, val_col_name, sig_col_name
)
row_str += "" + band + ":" + val_str + " σ "
row_str += sig_str + "
\n"
@@ -364,13 +349,13 @@ def mk_num_inputs_cell(t, metric_defs, n, bands):
return (row_str,)
-def mk_photom_cols(t, metric_defs, n, bands, cols):
+def mk_photom_cols(row, metric_defs, bands, cols):
"""Make photometry column cell contents
Parameters
----------
- t : `astropy.table.Table`
- Table of metrics
+ row : `astropy.table.Table`
+ A row from the table of metrics
metric_defs : `dict`
A dictionary of metrics and their thresholds
n : `n`
@@ -396,7 +381,7 @@ def mk_photom_cols(t, metric_defs, n, bands, cols):
val_col_name = col + "_" + band + "_" + part + "_median"
sig_col_name = col + "_" + band + "_" + part + "_sigmaMad"
val_str, sig_str, bad_val, link, debug_group = mk_table_value(
- t[n], metric_defs, val_col_name, sig_col_name
+ row, metric_defs, val_col_name, sig_col_name
)
else:
val_str = None
@@ -413,17 +398,15 @@ def mk_photom_cols(t, metric_defs, n, bands, cols):
return row_strs
-def mk_sky_cols(t, metric_defs, n, bands, cols):
+def mk_sky_cols(row, metric_defs, bands, cols):
"""Make sky column cell content
Parameters
----------
- t : `astropy.table.Table`
- Table of metrics
+ row : `astropy.table.Table`
+ A row from the table of metrics
metric_defs : `dict`
A dictionary of metrics and their thresholds
- n : `n`
- The row number
bands : `list`
A list of the bands the metrics are in
cols : `list`
@@ -445,22 +428,14 @@ def mk_sky_cols(t, metric_defs, n, bands, cols):
val_col_name = col + "_" + band + "_" + stat + "Sky"
sig_col_name = col + "_" + band + "_" + dev + "Sky"
val_str, sig_str, bad_val, link, debug_group = mk_table_value(
- t[n], metric_defs, val_col_name, sig_col_name
+ row, metric_defs, val_col_name, sig_col_name
)
else:
val_str = None
if val_str is None:
continue
- row_str += (
- ""
- + band
- + ": "
- + val_str
- + " σ: "
- + sig_str
- + "
\n"
- )
+ row_str += f"{band}: {val_str} σ: {sig_str}
\n"
num_bad += bad_val
if debug_group is not None:
debug_group_all = debug_group
diff --git a/python/lsst/production/tools/tractTable.py b/python/lsst/production/tools/tractTable.py
index b306c0a..0310aff 100644
--- a/python/lsst/production/tools/tractTable.py
+++ b/python/lsst/production/tools/tractTable.py
@@ -169,18 +169,19 @@ def collection(repo, collection):
row_list = []
row_list.append(mk_tract_cell(tract))
+ row = t[n]
# Add a summary plot in the i band of the tract
row_list.append(mk_summary_plot_cell(tract))
# Add the number of patches
- row_list.append(mk_patch_num_cell(t, n, bands))
+ row_list.append(mk_patch_num_cell(row, bands))
# Add the number of inputs
- row_list.append(mk_num_inputs_cell(t, metric_defs, n, bands))
+ row_list.append(mk_num_inputs_cell(row, metric_defs, bands))
num_bad = 0
cell_vals = []
# Get the number of failed values and prep cell contents
for cell_val, bad_val, link, debug_group in mk_shape_cols(
- t, metric_defs, n, bands, col_dict["shape_cols"]
+ row, metric_defs, bands, col_dict["shape_cols"]
):
cell_vals.append((cell_val, link, debug_group))
if bad_val is not None:
@@ -188,7 +189,7 @@ def collection(repo, collection):
# Make the cell details for the stellar locus columns
for cell_val, bad_val, link, debug_group in mk_stellar_locus_cols(
- t, metric_defs, n, col_dict["stellar_locus_cols"]
+ row, metric_defs, col_dict["stellar_locus_cols"]
):
cell_vals.append((cell_val, link, debug_group))
if bad_val is not None:
@@ -196,7 +197,7 @@ def collection(repo, collection):
# Make the cell contents for the photometry columns
for cell_val, bad_val, link, debug_group in mk_photom_cols(
- t, metric_defs, n, bands, col_dict["photom_cols"]
+ row, metric_defs, bands, col_dict["photom_cols"]
):
cell_vals.append((cell_val, link, debug_group))
if bad_val is not None:
@@ -204,7 +205,7 @@ def collection(repo, collection):
# Make the cell contents for the sky columns
for cell_val, bad_val, link, debug_group in mk_sky_cols(
- t, metric_defs, n, bands, col_dict["sky_cols"]
+ row, metric_defs, bands, col_dict["sky_cols"]
):
cell_vals.append((cell_val, link, debug_group))
if bad_val is not None: