Пример #1
0
observation_fields = np.int64(galah_param['sobject_id'] / 1000.)
all_observation_fields = np.unique(observation_fields)

selected_observation_fields = all_observation_fields
get_fields = len(selected_observation_fields)

C_LIGHT = 299792458  # m/s

wvl_min = 6479
wvl_max = 6520

print 'Reading resampled GALAH spectra'
spectra_file_csv = 'galah_dr52_ccd3_6475_6745_interpolated_wvlstep_0.06_spline_observed.csv'
# parse resampling settings from filename
csv_param = CollectionParameters(spectra_file_csv)
ccd = csv_param.get_ccd()
wvl_start, wvl_end = csv_param.get_wvl_range()
wvl_values = csv_param.get_wvl_values()

# determine the data range to be read and read it
idx_read = np.where(np.logical_and(wvl_values > wvl_min, wvl_values < wvl_max))
# alternative and much faster way
spectral_data = pd.read_csv(galah_data_dir + spectra_file_csv,
                            sep=',',
                            header=None,
                            na_values='nan',
                            usecols=idx_read[0]).values
spectal_data_size = np.shape(spectral_data)
print spectal_data_size
wvl_read = wvl_values[idx_read]
spectra_filtering_std = 2.5
plot_graphs = False
plot_include_all_spectra = False

print 'Reading data sets'
galah_data_input = '/home/klemen/GALAH_data/'
galah_data_output = '/home/klemen/GALAH_data/'
galah_param = Table.read(galah_data_input+'sobject_iraf_52_reduced.csv')

spectra_file = 'galah_dr52_ccd3_6475_6745_interpolated_wvlstep_0.06_spline_restframe.csv'

# parse resampling settings from filename
csv_param = CollectionParameters(spectra_file)
wvl_values = csv_param.get_wvl_values()
wvl_limits = csv_param.get_wvl_range()
ccd_number = int(csv_param.get_ccd())

# determine csv outputs
suffix = '_teff_{:.0f}_logg_{:1.2f}_feh_{:1.2f}'.format(TEFF_SPAN, LOGG_SPAN, FEH_SPAN)
if snr_limits:
    suffix += '_snr_{:3.0f}'.format(snr_limits[ccd_number - 1])
if spectra_selection:
    suffix += '_best_{:3.0f}'.format(n_spectra_selection_max)
if median_correction:
    suffix += '_medianshift'
if spectra_filtering:
    suffix += '_std_{:1.1f}'.format(spectra_filtering_std)
# final output csv file
txt_out_spectra = spectra_file[:-4] + suffix + '.csv'

# change to output directory