Exemplo n.º 1
0
import numpy as np
import matplotlib.pyplot as plt
from astropy.table import Table
from astropy.time import Time
from ccf2rv import get_object_rv

exclude_orders = [0, 11, 12, 13, 15, 16, 20, 21, 22, 47, 48]
# number of median-absolute devs within an epoch to consider a point discrepant
nMAD_cut = 5

tbl = get_object_rv('Gl514',
                    mask='gl514_neg',
                    method='all',
                    force=True,
                    exclude_orders=exclude_orders,
                    sanitize=True,
                    snr_min=120,
                    weight_type='',
                    bandpass='******',
                    velocity_window=10,
                    do_blacklist=True)

fig, ax = plt.subplots(nrows=2, ncols=1)

ax[0].plot(tbl['RV'], 'g.')
ax[1].plot(tbl['BIS_SLOPE'], 'g.')
tbl['RV'] -= np.nanmedian(tbl['RV'])

plt.plot(tbl['MJDATE'], tbl['RV'], 'g.')
# plt.plot(tbl['MJDATE'],tbl['RV_WAVFP']-tbl['RV_SIMFP'],'r.')
plt.show()
Exemplo n.º 2
0

obj = 'TOI-1452'
# number of median-absolute devs within an epoch to consider a point discrepant
nMAD_cut = 5

# you can give some known bad orders
known_bad = [36]

# get the RMS of errors for the case where not additional order is rejected
tbl1 = get_object_rv(
        obj,
        mask='gl846_neg',
        method='template',
        force=True,
        exclude_orders=known_bad,
        snr_min=20.0,
        sanitize=False,
        weight_type='ccf_depth',
        bandpass='******',
        doplot=False,
        )
ref_rms = np.mean(tbl1['ERROR_RV'])

ERROR_RV = np.zeros(49)

for iord in range(0, 49):
    exclude_orders = np.array(np.unique(np.append(iord, known_bad)), dtype=int)

    print('\nWe try rejecting order[s] : {0}\n'.format(exclude_orders))
    tbl1 = get_object_rv(
            obj,
Exemplo n.º 3
0
from ccf2rv import get_object_rv
from per_epoch_table import per_epoch_table

object = 'K2-33'
exclude_orders = [47]
# number of median-absolute devs within an epoch to consider a point discrepant
nMAD_cut = 5
method = 'template'
mask = 'gl846_neg'

tbl1 = get_object_rv(object,
                     bandpass='******',
                     method=method,
                     dvmax_per_order=10.0,  # large because omewhat fast rot.
                     exclude_orders=exclude_orders,
                     force=True,
                     snr_min=25.0,
                     weight_type='',
                     sanitize=True,
                     doplot=True,
                     mask=mask,
                     do_blacklist=True)


tbl_bin1 = per_epoch_table(tbl1)

fig, ax = plt.subplots(nrows=2, ncols=1, sharex=True)

ax[0].errorbar(tbl1['MJDATE'], tbl1['RV'], yerr=tbl1['ERROR_RV'],
               linestyle="None", fmt='o', alpha=0.2)
ax[0].errorbar(tbl_bin1['MJDATE_MEAN'], tbl_bin1['RV'],
               yerr=tbl_bin1['ERROR_RV'], linestyle="None", fmt='o',
Exemplo n.º 4
0
tbl_cube = fits.getdata(cube_file, ext=1)

files_in_cube = np.array(tbl_cube['Filename'])
for i in range(len(files_in_cube)):
    files_in_cube[i] = files_in_cube[i].split('o')[0]

obj = 'TOI-1278'
mask = 'gl846_neg'
exclude_orders = [-1]
# number of median-absolute devs within an epoch to consider a point discrepant
tbl = get_object_rv(obj,
                    mask=mask,
                    method='template',
                    force=True,
                    exclude_orders=exclude_orders,
                    snr_min=20.0,
                    sanitize=False,
                    dvmax_per_order=3.0,
                    bandpass='******',
                    doplot=True,
                    do_blacklist=True)

fig, ax = plt.subplots(nrows=1, ncols=2, sharex=True, sharey=True)
ax[0].imshow(cube, vmin=0.5, vmax=1.5, aspect='auto')
ax[0].set(title='Before alignment', ylabel='Nth frame', xlabel='pixels')
ax[1].set(title='After alignment', ylabel='Nth frame', xlabel='pixels')

xpix = np.arange(cube.shape[1])
for i in range(cube.shape[0]):

    if np.max(files_in_cube[i] == tbl['ODOMETER']):
ccf_files = sorted(glob.glob(options.pattern))

#[0,11,12,13,15,16,20,21,22,47,48]
exclude_orders = options.exclude_orders.split(",")

for i in range(len(exclude_orders)) :
    exclude_orders[i] = int(exclude_orders[i])

# detect and organize collection of files based on: object, ccfmask, sanitize, and DRS version
ccf_collections = ccf2rv.create_collections(ccf_files, verbose=options.verbose)

save_plots=False
save_csv_table_of_results = False
save_ccf_cube = False
save_weight_table = False

if options.save_all_subproducts :
    if options.plot :
        save_plots=True
    save_csv_table_of_results = True
    save_ccf_cube = True
    save_weight_table = True

for key in ccf_collections["modes"]:
    list_of_files = ccf_collections[key]

    if options.verbose:
        print("Processing collection {0} containing {1} files".format(key, len(list_of_files)))

    tbl = ccf2rv.get_object_rv(list_of_files, collection_key=key, method=options.method, exclude_orders = exclude_orders, snr_min=float(options.min_snr), bandpass = options.bandpass, save_rdb_timeseries = True, save_csv_table_of_results = save_csv_table_of_results, save_ccf_cube = save_ccf_cube, save_weight_table = save_weight_table, doplot=options.plot, showplots=options.plot, saveplots=save_plots, verbose=options.verbose)