Skip to content

Commit

Permalink
Merge pull request #310 from sot/get_aca_catalog
Browse files Browse the repository at this point in the history
Replace get_acq_catalog with get_aca_catalog and cleanup
  • Loading branch information
jeanconn authored Jun 10, 2019
2 parents acd9ab5 + f252668 commit bf81e04
Showing 1 changed file with 29 additions and 17 deletions.
46 changes: 29 additions & 17 deletions starcheck/src/lib/Ska/Starcheck/Obsid.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down Expand Up @@ -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))
};
Expand Down Expand Up @@ -2941,19 +2951,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
Expand Down

0 comments on commit bf81e04

Please sign in to comment.