def all_clean_phot(obj): try: tno = parsers.ossos_discoveries(single_object=obj, no_nt_and_u=False)[0] except: return [], [], [] # print len(tno.orbit.observations) # consider only the cleanest photometry: nothing with involvement or other weirdness tnoobs = [] for n in tno.orbit.observations: if isinstance(n.comment, TNOdbComment): if n.comment.photometry_note == 'Y' and (n.comment.mpc_note == ' ' or n.comment.mpc_note == ''): tnoobs.append(n) if len(tnoobs) > 0: # there better be some observations that are untainted tno_mags = [n.comment.mag for n in tnoobs] mag_dates = [n.date.jd for n in tnoobs] mag_err = [n.comment.mag_uncertainty for n in tnoobs] return tno_mags, mag_err, mag_dates else: print('no unflagged photometry exists for {}'.format(obj)) return [], [], []
def all_clean_phot(obj): try: tno = parsers.ossos_discoveries(single_object=obj, no_nt_and_u=False)[0] except: return [], [], [] # print len(tno.orbit.observations) # consider only the cleanest photometry: nothing with involvement or other weirdness tnoobs = [] for n in tno.orbit.observations: if isinstance(n.comment, TNOdbComment): if n.comment.photometry_note == 'Y' and (n.comment.mpc_note == ' ' or n.comment.mpc_note == ''): tnoobs.append(n) if len(tnoobs) > 0: # there better be some observations that are untainted tno_mags = [n.comment.mag for n in tnoobs] mag_dates = [n.date.jd for n in tnoobs] mag_err = [n.comment.mag_uncertainty for n in tnoobs] return tno_mags, mag_err, mag_dates else: print 'no unflagged photometry exists for {}'.format(obj) return [], [], []
plt.figure() plt.errorbar(mag_dates, tno_mags, yerr=mag_err, fmt='.', ) plt.gca().invert_yaxis() plt.title(obj) plt.draw() plt.show() if __name__ == '__main__': obj = sys.argv[1] plot_all_obs_single_object(obj) fig, ax = plt.subplots(1, 1, figsize=(35, 10)) variation = [] objects = parsers.ossos_discoveries() labels = [] for tno in objects: # [n for n in objects if n.name in parameters.COLOSSOS]: tno_mags, mag_err, mag_dates = all_clean_phot(obj) if len(tno_mags) > 0: tnomax = max(tno_mags) tnomin = min(tno_mags) variation.append(tno_mags) html = '<table><tr><th>Name</th><td>{:}</td></tr></table>'.format(tno.name) # '<tr><th>Dist</th><td>{:.2f}</td></tr>' \ # '<tr><th>Peri</th><td>{:.2f}</td></tr> labels.append(tno.name) else: print(("{} has no clean observations.\n".format(tno.name))) # points = ax.errorbar(range(0, len(labels)), variation, fmt='.', ecolor='b')
plt.figure() plt.errorbar(mag_dates, tno_mags, yerr=mag_err, fmt='.', ) plt.gca().invert_yaxis() plt.title(obj) plt.draw() plt.show() if __name__ == '__main__': obj = sys.argv[1] plot_all_obs_single_object(obj) fig, ax = plt.subplots(1, 1, figsize=(35, 10)) variation = [] objects = parsers.ossos_discoveries() labels = [] for tno in objects: # [n for n in objects if n.name in parameters.COLOSSOS]: tno_mags, mag_err, mag_dates = all_clean_phot(obj) if len(tno_mags) > 0: tnomax = max(tno_mags) tnomin = min(tno_mags) variation.append(tno_mags) html = '<table><tr><th>Name</th><td>{:}</td></tr></table>'.format(tno.name) # '<tr><th>Dist</th><td>{:.2f}</td></tr>' \ # '<tr><th>Peri</th><td>{:.2f}</td></tr> labels.append(tno.name) else: print("{} has no clean observations.\n".format(tno.name)) # points = ax.errorbar(range(0, len(labels)), variation, fmt='.', ecolor='b')