From 053b6673157f63391a6015e4250c3dbba3080a82 Mon Sep 17 00:00:00 2001 From: Jean Connelly Date: Fri, 7 Jun 2019 14:09:59 -0400 Subject: [PATCH 1/2] Improve names in proseco arg hash --- starcheck/src/lib/Ska/Starcheck/Obsid.pm | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/starcheck/src/lib/Ska/Starcheck/Obsid.pm b/starcheck/src/lib/Ska/Starcheck/Obsid.pm index df9fb1b6..1b76de59 100644 --- a/starcheck/src/lib/Ska/Starcheck/Obsid.pm +++ b/starcheck/src/lib/Ska/Starcheck/Obsid.pm @@ -2941,19 +2941,21 @@ sub proseco_args{ %proseco_args = ( obsid => $self->{obsid}, date => $targ_cmd->{stop_date}, - q1 => 0 + $targ_cmd->{q1}, q2 => 0 + $targ_cmd->{q2}, q3 => 0 + $targ_cmd->{q3}, q4 =>0 + $targ_cmd->{q4}, + att => [0 + $targ_cmd->{q1}, 0 + $targ_cmd->{q2}, 0 + $targ_cmd->{q3}, 0 + $targ_cmd->{q4}], man_angle => 0 + $targ_cmd->{angle}, - detector => $si, offset=> 0 + $offset, - dither_acq_y => $self->{dither_acq}->{ampl_y}, - dither_acq_z => $self->{dither_acq}->{ampl_p}, - dither_guide_y => $self->{dither_guide}->{ampl_y}, - dither_guide_z => $self->{dither_guide}->{ampl_p}, + detector => $si, + sim_offset => 0 + $offset, + dither_acq => [$self->{dither_acq}->{ampl_y}, $self->{dither_acq}->{ampl_p}], + dither_guide => [$self->{dither_guide}->{ampl_y}, $self->{dither_guide}->{ampl_p}], t_ccd_acq => $self->{ccd_temp_acq}, t_ccd_guide => $self->{ccd_temp}, - acq_ids => \@acq_ids, - halfwidths => \@halfwidths, + include_ids_acq => \@acq_ids, + n_acq => scalar(@acq_ids), + include_halfws_acq => \@halfwidths, + include_ids_guide => \@gui_ids, + n_guide => scalar(@gui_ids), fid_ids => \@fid_ids, - guide_ids => \@gui_ids, + n_fid => scalar(@fid_ids), acq_indexes => \@acq_indexes); return \%proseco_args From f25266880d510ed9504e2b3da2bdd103ff4b8e65 Mon Sep 17 00:00:00 2001 From: Jean Connelly Date: Fri, 7 Jun 2019 14:10:29 -0400 Subject: [PATCH 2/2] Use new names and get_aca_catalog in proseco_probs --- starcheck/src/lib/Ska/Starcheck/Obsid.pm | 26 ++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/starcheck/src/lib/Ska/Starcheck/Obsid.pm b/starcheck/src/lib/Ska/Starcheck/Obsid.pm index 1b76de59..49895c7d 100644 --- a/starcheck/src/lib/Ska/Starcheck/Obsid.pm +++ b/starcheck/src/lib/Ska/Starcheck/Obsid.pm @@ -2828,7 +2828,8 @@ sub set_ccd_temps{ use Inline Python => q{ -from proseco.acq import get_acq_catalog +from proseco.catalog import get_aca_catalog + def proseco_probs(kwargs): """ @@ -2856,15 +2857,24 @@ def proseco_probs(kwargs): """ kw = de_bytestr(kwargs) - kw['t_ccd_acq'] = get_effective_t_ccd(kw['t_ccd_acq']) - acq_cat = get_acq_catalog(obsid=0, att=Quaternion.normalize([kw['q1'], kw['q2'], kw['q3'], kw['q4']]), - n_acq=len(kw['acq_ids']), man_angle=kw['man_angle'], t_ccd=kw['t_ccd_acq'], - date=kw['date'], dither=(kw['dither_acq_y'], kw['dither_acq_z']), - detector=kw['detector'], sim_offset=kw['offset'], - include_ids=kw['acq_ids'], include_halfws=kw['halfwidths']) + args = dict(obsid=0, + att=Quaternion.normalize(kw['att']), + date=kw['date'], + n_acq=kw['n_acq'], + man_angle=kw['man_angle'], + t_ccd_acq=kw['t_ccd_acq'], + t_ccd_guide=kw['t_ccd_guide'], + dither_acq=ACABox(kw['dither_acq']), + dither_guide=ACABox(kw['dither_guide']), + include_ids_acq=kw['include_ids_acq'], + include_halfws_acq=kw['include_halfws_acq'], + detector=kw['detector'], sim_offset=kw['sim_offset'], + n_fid=0, n_guide=0, focus_offset=0) + aca = get_aca_catalog(**args) + acq_cat = aca.acqs # Assign the proseco probabilities back into an array. - p_acqs = [float(acq_cat['p_acq'][acq_cat['id'] == acq_id][0]) for acq_id in kw['acq_ids']] + p_acqs = [float(acq_cat['p_acq'][acq_cat['id'] == acq_id][0]) for acq_id in kw['include_ids_acq']] return p_acqs, float(-np.log10(acq_cat.calc_p_safe())), float(np.sum(p_acqs)) };