コード例 #1
0
def prepare_data(dataset, prog_args, train=False, pre_process=None):
    '''
    preprocess TU dataset according to DiffPool's paper setting and load dataset into dataloader
    '''
    if train:
        shuffle = True
    else:
        shuffle = False

    if pre_process:
        pre_process(dataset, prog_args)

    # dataset.set_fold(fold)
    return dgl.dataloading.GraphDataLoader(dataset,
                                           batch_size=prog_args.batch_size,
                                           shuffle=shuffle,
                                           num_workers=prog_args.n_worker)
コード例 #2
0
ファイル: train.py プロジェクト: zwcdp/dgl
def prepare_data(dataset, prog_args, train=False, pre_process=None):
    '''
    preprocess TU dataset according to DiffPool's paper setting and load dataset into dataloader
    '''
    if train:
        shuffle = True
    else:
        shuffle = False

    if pre_process:
        pre_process(dataset, prog_args)

    # dataset.set_fold(fold)
    return torch.utils.data.DataLoader(dataset,
                                       batch_size=prog_args.batch_size,
                                       shuffle=shuffle,
                                       collate_fn=collate_fn,
                                       drop_last=True,
                                       num_workers=prog_args.n_worker)
コード例 #3
0
ファイル: exonailer.py プロジェクト: j-faria/exonailer
rv_time_def = 'utc->utc'

################################################

# ---------- DATA PRE-PROCESSING ------------- #

# First, get the transit and RV data:
t_tr,f,f_err,transit_instruments,t_rv,rv,rv_err,rv_instruments = general_utils.read_data(target,mode,transit_time_def,rv_time_def)

# Initialize the parameters:
parameters = general_utils.read_priors(target,transit_instruments,rv_instruments,mode)

# Pre-process the transit data if available:
if mode != 'rvs':
    t_tr,phases,f, f_err = data_utils.pre_process(t_tr,f,f_err,phot_detrend,\
                                                  phot_get_outliers,n_ommit,\
                                                  window,parameters,ld_law, mode)
    if resampling:
        # Define indexes between which data will be resampled:
        idx_resampling = np.where((phases>-phase_max)&(phases<phase_max))[0]
    else:
        idx_resampling = []

# Create results folder if not already created:
if not os.path.exists('results'):
    os.mkdir('results')

# If chains not ran, run the MCMC and save results:
if not os.path.exists('results/'+target+'_'+mode+'_'+phot_noise_model+'_'+ld_law):
    data_utils.exonailer_mcmc_fit(t_tr, f, f_err, transit_instruments, t_rv, rv, rv_err, rv_instruments,\
                                     parameters, ld_law, mode, rv_jitter = rv_jitter, \
コード例 #4
0
################################################

# ---------- DATA PRE-PROCESSING ------------- #

# First, get the transit and RV data:
t_tr, f, f_err, transit_instruments, t_rv, rv, rv_err, rv_instruments = general_utils.read_data(
    target, mode, transit_time_def, rv_time_def)

# Initialize the parameters:
parameters = general_utils.read_priors(target, transit_instruments,
                                       rv_instruments, mode)

# Pre-process the transit data if available:
if mode != 'rvs':
    t_tr,phases,f, f_err = data_utils.pre_process(t_tr,f,f_err,phot_detrend,\
                                                  phot_get_outliers,n_ommit,\
                                                  window,parameters,ld_law, mode)
    if resampling:
        # Define indexes between which data will be resampled:
        idx_resampling = np.where((phases > -phase_max)
                                  & (phases < phase_max))[0]
    else:
        idx_resampling = []

# Create results folder if not already created:
if not os.path.exists('results'):
    os.mkdir('results')

# If chains not ran, run the MCMC and save results:
if not os.path.exists('results/' + target + '_' + mode + '_' +
                      phot_noise_model + '_' + ld_law):
コード例 #5
0
ファイル: exonailer.py プロジェクト: mbadenas/exonailer
################################################

# ---------- DATA PRE-PROCESSING ------------- #

# First, get the transit and RV data:
t_tr, f, f_err, transit_instruments, t_rv, rv, rv_err, rv_instruments = general_utils.read_data(
    options)

# Sort transit data if there is any:
# Initialize the parameters:
parameters = general_utils.read_priors(options['TARGET'], options['MODE'])

# Pre-process the transit data if available:
if options['MODE'] != 'rvs':
    t_tr, phases, f, f_err, transit_instruments = data_utils.pre_process(
        t_tr, f, f_err, options, transit_instruments, parameters)
    idx = np.argsort(t_tr)
    t_tr = t_tr[idx]
    f = f[idx]
    f_err = f_err[idx]
    phases = phases[idx]
    transit_instruments = transit_instruments[idx]
    idx_resampling = {}
    for instrument in options['photometry'].keys():
        idx = np.where(transit_instruments == instrument)[0]
        if options['photometry'][instrument]['RESAMPLING']:
            # Define indexes between which data will be resampled:
            idx_resampling[instrument] = np.where((phases[idx]>-options['photometry'][instrument]['PHASE_MAX_RESAMPLING'])&\
                                         (phases[idx]<options['photometry'][instrument]['PHASE_MAX_RESAMPLING']))[0]
        else:
            idx_resampling[instrument] = []