Skip to content

Commit

Permalink
get versions from validation header
Browse files Browse the repository at this point in the history
  • Loading branch information
imedan committed Sep 28, 2023
1 parent fd32b6a commit b7334b5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
25 changes: 15 additions & 10 deletions bin/rsValidation_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
import warnings


mugatu_version = mugatu.__version__

plt.rcParams.update({'font.size': 18})
plt.rcParams['savefig.facecolor'] = 'white'

Expand Down Expand Up @@ -336,7 +334,7 @@ def create_summary_dist_plots(valid_apo, valid_lco, designmode):

def write_html_jinja(valid_apo, valid_lco, designmode,
rs_run, mugatu_v, kaiju_v, coordio_v,
path):
fps_calib_v, path):
"""
Write HTML file using jinja
"""
Expand Down Expand Up @@ -440,6 +438,7 @@ def write_html_jinja(valid_apo, valid_lco, designmode,
html_dict['mugatu_v'] = mugatu_v
html_dict['kaiju_v'] = kaiju_v
html_dict['coordio_v'] = coordio_v
html_dict['fps_calib_v'] = fps_calib_v
template = env.get_template('main_validation_page.html')
page = template.render(html_dict)
fp = open('%s/%s_validation.html' % (path, rs_run), 'w')
Expand All @@ -458,16 +457,10 @@ def write_html_jinja(valid_apo, valid_lco, designmode,

parser.add_argument('-p', '--plan', dest='plan',
type=str, help='name of plan', required=True)
parser.add_argument('-k', '--kaiju_v', dest='kaiju_v',
type=str, help='kaiju_v', required=True)
parser.add_argument('-c', '--coordio_v', dest='coordio_v',
type=str, help='coordio_v', required=True)
parser.add_argument('-i','--ignore_prev', help='True if want to ignore previously observed designs in validation',
type=bool, required=False, default=True)
args = parser.parse_args()
plan = args.plan
kaiju_v = args.kaiju_v
coordio_v = args.coordio_v
ignore_prev = args.ignore_prev

targetdb.database.connect_from_parameters(user='sdss_user',
Expand All @@ -490,6 +483,12 @@ def write_html_jinja(valid_apo, valid_lco, designmode,
try:
valid_apo = fits.open(path +
'/rs_%s_apo_design_validation_results.fits' % plan)[1].data
header = fits.open(path +
'/rs_%s_apo_design_validation_results.fits' % plan)[0].header
kaiju_v = header['kaiju_version']
coordio_v = header['coordio_version']
fps_calib_v = header['fps_calibrations_version']
mugatu_version = header['mugatu_version']
# ignore previously observed designs with designid_status != -1
if ignore_prev:
valid_apo = valid_apo[valid_apo['designid_status'] == -1]
Expand All @@ -500,6 +499,12 @@ def write_html_jinja(valid_apo, valid_lco, designmode,
try:
valid_lco = fits.open(path +
'/rs_%s_lco_design_validation_results.fits' % plan)[1].data
header = fits.open(path +
'/rs_%s_lco_design_validation_results.fits' % plan)[0].header
kaiju_v = header['kaiju_version']
coordio_v = header['coordio_version']
fps_calib_v = header['fps_calibrations_version']
mugatu_version = header['mugatu_version']
if ignore_prev:
valid_lco = valid_lco[valid_lco['designid_status'] == -1]
except FileNotFoundError:
Expand All @@ -512,5 +517,5 @@ def write_html_jinja(valid_apo, valid_lco, designmode,
designmode = fits.open(path + '/designmodes_rs_%s.fits' % plan)[1].data

write_html_jinja(valid_apo, valid_lco, designmode,
plan, mugatu_version, kaiju_v, coordio_v,
plan, mugatu_version, kaiju_v, coordio_v, fps_calib_v,
path)
2 changes: 1 addition & 1 deletion python/mugatu/templates/main_validation_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
border:1px solid black;
}
</style>
<body><h1>{{rs_run}} Validation Results</h1><p>Below are links to summaries of each design validation criteria used for the {{rs_run}} run of robostrategy. These designs were validated using v{{mugatu_v}} of mugatu, v{{kaiju_v}} of kaiju and v{{coordio_v}} of coordio.</p>
<body><h1>{{rs_run}} Validation Results</h1><p>Below are links to summaries of each design validation criteria used for the {{rs_run}} run of robostrategy. These designs were validated using v{{mugatu_v}} of mugatu, v{{kaiju_v}} of kaiju, v{{coordio_v}} of coordio and v{{fps_calib_v}} of fps_calibrations.</p>
<h2>Design Validations</h2>
<p><a href="indv_valid/decolide.html">decolide</a>: A check on if the FPS grid was able to be decolided if any collisions existed.</p>
<p><a href="indv_valid/bright_safety.html">bright_safety</a>: A check if any assigned fibers in the grid were too close to a bright neighbor such that the total flux down the fiber would be greater than the bright_limit_targets for the designmode. This check only considers a subset of very bright stars with G < 13 (for BOSS) and H < 7 (for APOGEE) in the FOV.</p>
Expand Down

0 comments on commit b7334b5

Please sign in to comment.