def test_make_interpolation(self): """ Test Keplerian circular orbit model. """ # Instantiate emissivity object in setup mode. emissivity_setup = Emissivity(setup_mode=True) emissivity_setup.rt_results_db = 'test_jar/mock_rt_results.db' emissivity_setup.rt_results_table = 'mock_data' # Setup spectral line and wind velocity profile. emissivity_setup.set_spectral_line(line=3) emissivity_setup.set_wind_velocity_profile( wind_velocity_solution='beta_1', initial_velocity=20, stellar_radius=50, sonic_radius=60) # Build interpolation object. Mdot = 5e-4 Vinf = 500 Time = np.linspace(0, 1000, 10) emissivity_setup.build_static_interpolation_object(Mdot, Vinf, Time)
def test_convolutional_model_rt_interp_kernel_eccentric(self): """ Test ck-motion w/ RT interp kernel for eccentric orbit. """ # Arbitrary eccentric orbit. emissivity = Emissivity(setup_mode=False, pickle_dir='test_jar') windy_star.configure_params( period=2022.7, eccentricity=0.9, rv_semi_amplitude=100, argument_of_periastron=270, rv_offset=0, m_dot_a=5e-4, wind_velocity_a=500) windy_star.configure_epochs(epochs=np.linspace(0, 2, 1000)) windy_star.configure_kernel(kernel_mode='RTInterp', kernel_line=3, interp_dims='Grid', emissivity_interpolators=emissivity) res_df = windy_star.convolutional_model_centroid_velocity
from ckm.core.motion import windy_star from ckm.radiative.emissivity import Emissivity from ckm.core.utils import unpickle_observations # Setup OBSERVATIONS = ['emission_line_fits_1.p', 'emission_line_fits_2.p'] # Load observations. obs = unpickle_observations(OBSERVATIONS_PATH, OBSERVATIONS, time_of_periastron=2555555, period=1000, n_periods=2) # Load interpolation objects. emissivity = Emissivity(setup_mode=False, pickle_dir='interp_jar/rt_code_v1') # Configure params and epochs and kernel. windy_star.configure_params(period=1000, eccentricity=0.7, rv_semi_amplitude=60, argument_of_periastron=250, rv_offset=-20) windy_star.configure_epochs(epochs=np.linspace(0, 2, 1000)) windy_star.configure_kernel(kernel_mode='RTInterp', kernel_line=4, interp_dims='Point', emissivity_interpolators=emissivity) # Calculate centroid velocity of convolved/time averaged Keplerian orbit res_df = windy_star.convolutional_model_centroid_velocity
print('Convergence stats: mean tau={} <? threshold N/50={}'.format( convergence['mean_tau'], convergence['threshold'])) # Optimized parameter results taken to be 50th percentile. # Errors, 16th - 84th percentiles. param_labels = [ 'TimeOfPeriastron', 'Eccentricity', 'RVSemiAmplitude', 'ArgumentOfPeriastron' ] percentiles = calc_mcmc_chain_percentiles(sample_chain, param_labels) print(percentiles['16th_percentile'], '\n') print(percentiles['Median'], '\n') print(percentiles['84th_percentile']) # Load interpolation objects. emissivity = Emissivity(setup_mode=False, pickle_dir=INTERP_PICKLE) # Iterate observed spectral lines. fig = plt.figure(figsize=(20, 10)) line_index = 1 for line, data in observations.items(): print('Line {}.'.format(line_index)) ax = fig.add_subplot(2, math.ceil(len(observations) / 2), line_index) markers, caps, bars = ax.errorbar(data['Phase'], data['Velocity'] + systemic[line_index - 1], yerr=None, color='#000000', fmt='o', markersize='1',
# Grid parameterisations: must be evenly spaced and correspond # to available param space output from radiative transfer. N.B # limiting times provides a kernel size which ensures complete # overlap in the convolution's valid mode for a given # number/fraction of signal/periods. Mdot = 1e-5 Vinf = 1300 Time = np.linspace(0, 10, 100) # Iterate spectral lines. spectral_lines = [1, 2] for line in spectral_lines: # Instantiate emissivity object in setup mode. # N.B see line_label for verbose transition name. emissivity_setup = Emissivity(setup_mode=True) emissivity_setup.rt_results_db = RT_DB_PATH emissivity_setup.rt_results_table = RT_TABLE # Setup spectral line and wind velocity profile. emissivity_setup.set_spectral_line(line) emissivity_setup.set_wind_velocity_profile( wind_velocity_solution=WIND_VELOCITY_SOL, initial_velocity=INITIAL_VELOCITY, stellar_radius=STELLAR_RADIUS, sonic_radius=SONIC_RADIUS) # Build interpolation object. emissivity_setup.build_static_interpolation_object(Mdot, Vinf, Time) # Write interpolation object to disk.