def test_generateInitXYZUVW(): """Check that the mean of initial xyzuvw of stars matches that of the initialising component""" starcounts = (int(1e6), ) sd = SynthData(pars=PARS[:1], starcounts=starcounts, Components=COMPONENTS) sd.generate_all_init_cartesian() comp = SphereComponent(PARS[0]) init_xyzuvw = sd.extract_data_as_array([dim + '0' for dim in 'xyzuvw']) assert np.allclose(comp.get_mean(), np.mean(init_xyzuvw, axis=0), atol=0.1)
def test_generateInitXYZUVW(): """Check that the mean of initial xyzuvw of stars matches that of the initialising component""" starcounts = (int(1e6),) sd = SynthData(pars=PARS[:1], starcounts=starcounts, Components=COMPONENTS) sd.generate_all_init_cartesian() comp = SphereComponent(PARS[0]) init_xyzuvw = sd.extract_data_as_array([dim + '0' for dim in 'xyzuvw']) assert np.allclose(comp.get_mean(), np.mean(init_xyzuvw, axis=0), atol=0.1)
def test_projectStars(): """Check that the mean of stars after projection matches the mean of the component after projection""" starcounts = (int(1e3),) sd = SynthData(pars=PARS[:1], starcounts=starcounts, Components=COMPONENTS) sd.generate_all_init_cartesian() sd.project_stars() comp_mean_now, comp_covmatrix_now = \ sd.components[0].get_currentday_projection() final_xyzuvw = sd.extract_data_as_array([dim + '_now' for dim in 'xzyuvw']) assert np.allclose(comp_mean_now, final_xyzuvw.mean(axis=0), atol=1.)