Exemplo n.º 1
0
    def test_software_rotvel_alignment_GAS(self):
        print(f"{' SOFTWARE TEST ':*^60}")
        data_required = {
            'partType0':
            ['mass', 'coordinates', 'velocity', 'temperature', 'sphdensity'],
            'partType1': ['mass', 'coordinates', 'velocity'],
            'partType4': ['mass', 'coordinates', 'velocity'],
            'partType5': ['mass', 'coordinates', 'velocity']
        }

        for sim in ['celr_e', 'celr_b', 'macsis']:

            cluster = Cluster(simulation_name=sim,
                              clusterID=0,
                              redshift='z000p000',
                              comovingframe=False,
                              requires=data_required)

            # cluster.info()

            print(f"\n {sim}{' | halo 0 | z=0 ':-^60}")
            pec_velocity = cluster.group_zero_momentum_frame()
            ang_momentum = cluster.group_angular_momentum()
            angle = cluster.angle_between_vectors(pec_velocity, ang_momentum)
            print(f"pec_velocity = {pec_velocity}")
            print(f"ang_momentum = {ang_momentum}")
            print(f"angle = {angle}")
Exemplo n.º 2
0
            ang_momentum = ang_momenta[1]
        elif align == 'stars' or align == '4':
            ang_momentum = ang_momenta[4]
        elif align == 'black_holes' or align == '5':
            ang_momentum = ang_momenta[5]

        z_axis_unit_vector = [0, 0, 1]
        rot_matrix = cluster.rotation_matrix_from_vectors(
            ang_momentum, z_axis_unit_vector)
        coords = cluster.apply_rotation_matrix(rot_matrix, coords)
        vel = cluster.apply_rotation_matrix(rot_matrix, vel)

        return coords, vel


if __name__ == "__main__":

    from visualisation.rendering import plot_angularmomentum_vectors

    cluster = Cluster(clusterID=0, redshift=0.)
    angmom, masses = cluster.group_angular_momentum(out_allPartTypes=True)
    m = angular_momentum_PartType_alignment_matrix(cluster)
    print(m)
    plot_angularmomentum_vectors(
        angmom,
        axes=None,
        plot_unitSphere=False,
        normalise_length=False,
        make_all_unitary=False,
    )
    plt.show()