def test_convolutional_model_top_hat_kernel_eccentric(self): """ Test ck-motion w/ top hat kernel for eccentric orbit. """ # Arbitrary circular orbit. windy_star.configure_params( period=1000, eccentricity=0.9, rv_semi_amplitude=50, argument_of_periastron=270, rv_offset=0, ionisation_radius=50, photospheric_radius=5, stellar_radius_a=1, wind_velocity_a=500) windy_star.configure_epochs( epochs=np.linspace(0, 2, 1000)) windy_star.configure_kernel( kernel_mode='TopHat') res_df = windy_star.convolutional_model_centroid_velocity # Sanity checks. self.assertNotAlmostEqual( res_df['ConvolvedVelocity'].max(), 50, places=0, msg='Convolutional velocity unexpected max value.') self.assertNotAlmostEqual( res_df['ConvolvedVelocity'].min(), -50, places=0, msg='Convolutional velocity unexpected min value.') self.assertNotAlmostEqual( res_df['ConvolvedVelocity'].iloc[0], 0, places=0, msg='Convolutional velocity unexpected value at phase 0.') self.assertNotAlmostEqual( res_df['ConvolvedVelocity'].iloc[124], 50, places=0, msg='Convolutional velocity unexpected value at phase 0.25') self.assertNotAlmostEqual( res_df['ConvolvedVelocity'].iloc[249], 0, places=0, msg='Convolutional velocity unexpected value at phase 0.5') self.assertNotAlmostEqual( res_df['ConvolvedVelocity'].iloc[374], -50, places=0, msg='Convolutional velocity unexpected value at phase 0.75')
def test_convolutional_model_log_gaussain_kernel_circular(self): """ Test ck-motion w/ log gaussian kernel for circular orbit. """ # Arbitrary circular orbit. windy_star.configure_params( period=1000, eccentricity=0, rv_semi_amplitude=50, argument_of_periastron=270, rv_offset=0, log_sigma_time=0.5, mean_emissivity=30, stellar_radius_a=1, wind_velocity_a=500) windy_star.configure_epochs( epochs=np.linspace(0, 2, 1000)) windy_star.configure_kernel( kernel_mode='LogGaussian') res_df = windy_star.convolutional_model_centroid_velocity # Sanity checks. self.assertNotAlmostEqual( res_df['ConvolvedVelocity'].max(), 50, places=0, msg='Convolutional velocity unexpected max value.') self.assertNotAlmostEqual( res_df['ConvolvedVelocity'].min(), -50, places=0, msg='Convolutional velocity unexpected min value.') self.assertNotAlmostEqual( res_df['ConvolvedVelocity'].iloc[0], 0, places=0, msg='Convolutional velocity unexpected value at phase 0.') self.assertNotAlmostEqual( res_df['ConvolvedVelocity'].iloc[124], 50, places=0, msg='Convolutional velocity unexpected value at phase 0.25') self.assertNotAlmostEqual( res_df['ConvolvedVelocity'].iloc[249], 0, places=0, msg='Convolutional velocity unexpected value at phase 0.5') self.assertNotAlmostEqual( res_df['ConvolvedVelocity'].iloc[374], -50, places=0, msg='Convolutional velocity unexpected value at phase 0.75')
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
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 # Plot. fig = plt.figure(figsize=(15, 6)) ax1 = fig.add_subplot(1, 1, 1) ax1.scatter(obs['Phase'], obs['Velocity'], s=2, c='#000000') ax1.plot(res_df['Phase'], res_df['ConvolvedVelocity'], linewidth=2) ax1.set_xlabel('Orbital Phase $\phi$', fontsize=14) ax1.set_ylabel('Velocity / $\\rm{km\,s^{-1}}$', fontsize=14) plt.tight_layout() plt.show()