Ejemplo n.º 1
0
def test_04():
    """SAS method declaration"""
    mth = Method(
        name="SAS",
        channels=["87Rb"],
        magnetic_flux_density=9.4,  # in T
        rotor_angle=70.12 * np.pi / 180,
        rotor_frequency=1000000000000,
        spectral_dimensions=[
            {
                "count":
                512,
                "spectral_width":
                5e4,  # in Hz
                "events": [
                    {
                        "transition_queries": [{
                            "ch1": {
                                "P": [-1],
                                "D": [0]
                            }
                        }]
                    },
                ],
            },
            MAS_DIM.copy(),
        ],
    )

    assert mth.json() == TESTDATA["SAS"]
    assert Method.parse_dict_with_units(mth.json()) == mth
Ejemplo n.º 2
0
def test_05():
    """Satellite to central correlation method declaration"""
    sp0 = dict(
        count=512,
        spectral_width=5e6,
        events=[{
            "rotor_angle":
            0 * np.pi / 180,
            "transition_queries": [
                {
                    "ch1": {
                        "P": [-1],
                        "D": [2]
                    }
                },
                {
                    "ch1": {
                        "P": [-1],
                        "D": [-2]
                    }
                },
            ],
        }],
    )
    mth = Method(
        name="STMAS",
        channels=["87Rb"],
        magnetic_flux_density=9.4,  # in T
        rotor_frequency=1000000000000,
        spectral_dimensions=[sp0, MAS_DIM.copy()],
    )

    assert mth.json() == TESTDATA["STMAS"]
    assert Method.parse_dict_with_units(TESTDATA["STMAS"]) == mth
Ejemplo n.º 3
0
def test_03():
    """generic method declaration"""
    mth = Method(
        name="generic",
        channels=["87Rb"],
        magnetic_flux_density=9.4,  # in T
        rotor_frequency=1000000000000.0,
        spectral_dimensions=[
            {
                "count": 1024,
                "spectral_width": 5e4,
                "events": [sq_tq]
            },
            {
                "count": 1024,
                "spectral_width": 5e4,
                "events": [sq_tq]
            },
        ],
    )

    assert mth.json() == TESTDATA["generic"]
    assert Method.parse_dict_with_units(mth.json()) == mth
Ejemplo n.º 4
0
def test_methods():
    das = Method(
        name="DAS",
        channels=["87Rb"],
        magnetic_flux_density=4.2,  # in T
        rotor_angle=54.735 * 3.14159 / 180,  # in rads
        rotor_frequency=1000000000000,
        spectral_dimensions=[
            {
                "count":
                256,
                "spectral_width":
                2e4,  # in Hz
                "reference_offset":
                -5e3,  # in Hz
                "label":
                "70.12 dimension",
                "events": [
                    {
                        "fraction": 0.5,
                        "rotor_angle": 70.12 * 3.14159 / 180,  # in rads
                        "transition_queries": [{
                            "ch1": {
                                "P": [-1],
                                "D": [0]
                            }
                        }],
                    },
                    {
                        "fraction": 0.5,
                        "rotor_angle": 30.12 * 3.14159 / 180,  # in rads
                        "transition_queries": [{
                            "ch1": {
                                "P": [-1],
                                "D": [0]
                            }
                        }],
                    },
                ],
            },
            # The last spectral dimension block is the direct-dimension
            {
                "count":
                256,
                "spectral_width":
                3e4,  # in Hz
                "reference_offset":
                -7e3,  # in Hz
                "label":
                "MAS dimension",
                "events": [{
                    "transition_queries": [{
                        "ch1": {
                            "P": [-1],
                            "D": [0]
                        }
                    }]
                }],
            },
        ],
    )

    assert das.affine_matrix is None
    assert das.json() == TESTDATA["DAS"]
    assert Method.parse_dict_with_units(das.json()) == das