Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates for osx compat #302

Merged
merged 5 commits into from
Jun 11, 2019
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions sandbox_starcheck
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/bash

DIR=`dirname $0`
export PYTHONHOME=$SKA_ARCH_OS
export PYTHONHOME=$SKA
export PYTHONPATH=$DIR:$PYTHONPATH
PERL_INLINE_DIRECTORY=`/bin/mktemp -d -t starcheck_inline.XXXXXX` || exit 1
PERL_INLINE_DIRECTORY=`mktemp -d -t starcheck_inline.XXXXXX` || exit 1
export PERL_INLINE_DIRECTORY
perl -I ${DIR}/starcheck/src/lib ${DIR}/starcheck/src/starcheck.pl "$@"
SC_STATUS=$?
Expand Down
22 changes: 14 additions & 8 deletions starcheck/calc_ccd_temps.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def get_options():

def get_ccd_temps(oflsdir, outdir='out',
json_obsids=sys.stdin,
model_spec=None, char_file=None, orlist=None,
model_spec=None, char_file=None, orlist=None, use_maude=0,
verbose=1, **kwargs):
"""
Using the cmds and cmd_states sybase databases, available telemetry, and
Expand All @@ -112,23 +112,30 @@ def get_ccd_temps(oflsdir, outdir='out',
:param json_obsids: file-like object or string containing JSON of
starcheck Obsid objects
:param model_spec: xija ACA model specification
:param use_maude: if 1, use maude to fetch recent AACCCDPT data
:param verbose: Verbosity (0=quiet, 1=normal, 2=debug)
:returns: JSON dictionary of labeled dwell intervals with max temperatures
"""
if not os.path.exists(outdir):
os.mkdir(outdir)

if use_maude == 1:
fetch.data_source.set('maude allow_subset=False')

config_logging(outdir, verbose)

# Store info relevant to processing for use in outputs
proc = {'run_user': os.environ['USER'],
'run_time': time.ctime(),
'errors': []}
'errors': [],
'use_maude': use_maude,
}
logger.info('##############################'
'#######################################')
logger.info('# %s run at %s by %s'
% (TASK_NAME, proc['run_time'], proc['run_user']))
logger.info('# {} version = {}'.format(TASK_NAME, VERSION))
logger.info('# Fetch data sources set to {}'.format(fetch.data_source.sources()))
logger.info('###############################'
'######################################\n')

Expand All @@ -153,10 +160,10 @@ def get_ccd_temps(oflsdir, outdir='out',
proc['datestart'] = DateTime(tstart).date
proc['datestop'] = DateTime(tstop).date

# Get temperature telemetry for 30 days prior to min(tstart, NOW)
# Get temperature telemetry for 7 days prior to min(tstart, NOW)
tlm = get_telem_values(min(tstart, tnow),
['aacccdpt', 'pitch'],
days=30)
['aacccdpt'],
jeanconn marked this conversation as resolved.
Show resolved Hide resolved
days=7)
jeanconn marked this conversation as resolved.
Show resolved Hide resolved

states = get_week_states(tstart, tstop, bs_cmds, tlm)
# if the last obsid interval extends over the end of states
Expand Down Expand Up @@ -368,8 +375,7 @@ def mock_telem_predict(states):

tlm = fetch.MSIDset(['aacccdpt'],
states[0]['tstart'],
states[-1]['tstart'],
stat='5min')
states[-1]['tstart'])
temps = {'aca': tlm['aacccdpt'].vals}
return tlm['aacccdpt'].times, tlm['aacccdpt'].vals

Expand Down Expand Up @@ -404,7 +410,7 @@ def get_telem_values(tstart, msids, days=7, name_map={}):
start = DateTime(tstart - days * 86400).date
stop = DateTime(tstart).date
logger.info('Fetching telemetry between %s and %s' % (start, stop))
msidset = fetch.MSIDset(msids, start, stop, stat='5min')
msidset = fetch.MSIDset(msids, start, stop)
jeanconn marked this conversation as resolved.
Show resolved Hide resolved
start = max(x.times[0] for x in msidset.values())
stop = min(x.times[-1] for x in msidset.values())
msidset.interpolate(328.0, start, stop + 1) # 328 for '5min' stat
Expand Down
3 changes: 1 addition & 2 deletions starcheck/src/lib/Ska/Starcheck/Dark_Cal_Checker.pm
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ sub new{

# Set Defaults
my $SKA = $ENV{SKA} || '/proj/sot/ska';
my $DarkCal_Data = "$ENV{SKA_DATA}/starcheck" || "$SKA/data/starcheck";
my $DarkCal_Share = "$ENV{SKA_SHARE}/starcheck" || "$SKA/share/starcheck";
my $DarkCal_Data = "${SKA}/data/starcheck";

my %par = (
dir => '.',
Expand Down
4 changes: 2 additions & 2 deletions starcheck/src/starcheck
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
# Unset PYTHONPATH because custom PYTHONPATH should never be allowed
# for flight starcheck
unset PYTHONPATH
export PYTHONHOME=$SKA_ARCH_OS
PERL_INLINE_DIRECTORY=`/bin/mktemp -d -t starcheck_inline.XXXXXX` || exit 1
export PYTHONHOME=$SKA
PERL_INLINE_DIRECTORY=`mktemp -d -t starcheck_inline.XXXXXX` || exit 1
export PERL_INLINE_DIRECTORY
STARCHECK=`python -c 'import starcheck; print(starcheck.__path__[0])'`
perl -I ${STARCHECK}/src/lib ${STARCHECK}/src/starcheck.pl "$@"
Expand Down
9 changes: 7 additions & 2 deletions starcheck/src/starcheck.pl
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
html => 1,
text => 1,
yaml => 1,
maude => 0,
agasc_file => "${SKA}/data/agasc/agasc1p7.h5",
config_file => "characteristics.yaml",
fid_char => "fid_CHARACTERISTICS",
Expand All @@ -137,6 +138,7 @@
'dir=s',
'out=s',
'plot!',
'maude!',
'html!',
'text!',
'yaml!',
Expand Down Expand Up @@ -596,6 +598,7 @@ sub json_obsids{
model_spec => "$Starcheck_Data/aca_spec.json",
char_file => "$Starcheck_Data/characteristics.yaml",
orlist => $or_file,
use_maude => $par{maude},
});
# convert back from JSON outside
$obsid_temps = JSON::from_json($json_obsid_temps);
Expand Down Expand Up @@ -1311,12 +1314,14 @@ =head1 OPTIONS

Specify directory which contains starcheck data files including agasc.bad and fid characteristics. Default is SKA/data/starcheck.

Specify YAML configuration file in starcheck data directory. Default is SKA/data/starcheck/characteristics.yaml

=item B<-config_file <config file>>

Specify YAML configuration file in starcheck data directory. Default is SKA/data/starcheck/characteristics.yaml

=item B<-maude>

Set to use MAUDE (instead of CXC Eng Archive) to fetch recent AACCCDPT data for ACA thermal model run

=back

=head1 DESCRIPTION
Expand Down