Skip to content

Commit

Permalink
split obsids_fail into obsids_fail + obsids_suspect
Browse files Browse the repository at this point in the history
  • Loading branch information
javierggt committed Feb 10, 2021
1 parent 6e8eb83 commit cae70ae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 4 additions & 3 deletions agasc/supplement/magnitudes/mag_estimate.py
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,7 @@ def get_agasc_id_stats(agasc_id, obs_status_override=None, tstop=None):
'color': np.nan,
'n_obsids': 0,
'n_obsids_fail': 0,
'n_obsids_suspect': 0,
'n_obsids_ok': 0,
'n_no_track': 0,
'n': 0,
Expand Down Expand Up @@ -869,13 +870,14 @@ def get_agasc_id_stats(agasc_id, obs_status_override=None, tstop=None):
logger.debug(f' Error in get_agasc_id_stats({agasc_id=}, obsid={o["obsid"]}): {e}')
failures.append(dict(e))

result['n_obsids_fail'] = len(failures)

stats = Table(stats)
stats['w'] = np.nan
stats['mean_corrected'] = np.nan
stats['weighted_mean'] = np.nan

result['n_obsids_fail'] = np.sum(stats['obs_fail'])
result['n_obsids_suspect'] = np.sum(stats['obs_suspect'])

if not np.any(~excluded_obs):
logger.debug(' Skipping star in get_agasc_id_stats({agasc_id=}).'
' All observations are flagged as not good.')
Expand Down Expand Up @@ -917,7 +919,6 @@ def get_agasc_id_stats(agasc_id, obs_status_override=None, tstop=None):
'mag_obs_err': min_mag_obs_err,
'color': star['COLOR1'],
'n_obsids': n_obsids,
'n_obsids_fail': len(failures),
'n_obsids_ok': np.sum(stats['obs_ok']),
'n_no_track': np.sum((~stats['obs_ok'])) + np.sum(stats['f_ok'][stats['obs_ok']] < 0.3),
'n': len(ok),
Expand Down
6 changes: 4 additions & 2 deletions agasc/supplement/magnitudes/mag_estimate_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ def single_star_html(self, agasc_id, directory,
o.sort(keys=['mp_starcat_time'])
s = self.agasc_stats[self.agasc_stats['agasc_id'] == agasc_id][0]
s = {k: s[k] for k in s.colnames}
s['n_obs_bad'] = s['n_obsids'] - s['n_obsids_ok'] - s['n_obsids_fail']
s['n_obs_bad'] = \
s['n_obsids'] - s['n_obsids_ok'] - s['n_obsids_fail'] - s['n_obsids_suspect']
s['last_obs'] = ':'.join(o[-1]['mp_starcat_time'].split(':')[:4])

# OBSIDs can be repeated
Expand Down Expand Up @@ -161,7 +162,8 @@ def multi_star_html(self, sections=None, updated_stars=None, fails=(),

# add some extra fields
if len(agasc_stats):
agasc_stats['n_obs_bad_fail'] = agasc_stats['n_obsids_fail']
agasc_stats['n_obs_bad_fail'] = \
agasc_stats['n_obsids_fail'] + agasc_stats['n_obsids_suspect']
agasc_stats['n_obs_bad'] = agasc_stats['n_obsids'] - agasc_stats['n_obsids_ok']
agasc_stats['flag'] = ' '
agasc_stats['flag'][:] = ''
Expand Down

0 comments on commit cae70ae

Please sign in to comment.