torax.transport_model.tests package

Submodules

torax.transport_model.tests.bohm_gyrobohm_test module

class torax.transport_model.tests.bohm_gyrobohm_test.BohmGyroBohmTest(*args, **kwargs)[source]

Bases: TestCase

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_coeff_multiplier_feature()[source]

Test that modifying coefficients or multipliers equivalently affects outputs.

Verifies that if the product of coefficient and multiplier is held constant— either by changing the coefficient with multipliers left at 1 or by leaving the coefficients at default (1) and scaling the multipliers—the computed transport coefficients (chi_face_ion and chi_face_el) remain identical.

test_raw_bohm_and_gyrobohm_fields()[source]

Test that the raw Bohm and gyro-Bohm fields are computed consistently.

torax.transport_model.tests.pydantic_model_test module

class torax.transport_model.tests.pydantic_model_test.PydanticModelTest(*args, **kwargs)[source]

Bases: TestCase

test_qlknn_defaults()[source]

Tests that correct default values are set for QLKNN.

torax.transport_model.tests.qlknn_model_wrapper_test module

class torax.transport_model.tests.qlknn_model_wrapper_test.QlknnModelWrapperTest(*args, **kwargs)[source]

Bases: TestCase

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_load_default_model(mock_load_default_model)[source]

Tests that the default model is loaded.

test_load_model_from_name(mock_load_model_from_name)[source]

Tests that the model is loaded from the name.

test_load_model_from_path(mock_load_model_from_path)[source]

Tests that the model is loaded from the path.

test_predict_names()[source]

Tests model output names are the TORAX flux names.

test_predict_shape()[source]

Tests model output shape.

torax.transport_model.tests.qlknn_transport_model_test module

class torax.transport_model.tests.qlknn_transport_model_test.QlknnTransportModelTest(*args, **kwargs)[source]

Bases: TestCase

test_clip_inputs()[source]

Tests that the inputs are properly clipped.

test_filter_model_output_etg({'etg': False})

Tests that the model output is properly filtered.

test_filter_model_output_etg_and_itg({'etg': False, 'itg': False})

Tests that the model output is properly filtered.

test_filter_model_output_itg({'itg': False})

Tests that the model output is properly filtered.

test_filter_model_output_tem({'tem': False})

Tests that the model output is properly filtered.

test_get_model_from_name_qlknn10d_fails(mock_qlknn_qlknn10d)[source]

Tests that the model is loaded from the path.

test_get_model_from_path_qlknn10d(mock_qlknn_qlknn10d)[source]

Tests that the model is loaded from the path.

test_get_model_with_name_only(mock_qlknn_model_wrapper)[source]

Tests that the model is loaded from the path.

test_get_model_with_path(mock_qlknn_model_wrapper)[source]

Tests that the model is loaded from the path.

test_get_model_without_path_or_name(mock_qlknn_model_wrapper)[source]

Tests that the model is loaded from the path.

torax.transport_model.tests.qualikiz_based_transport_model_test module

class torax.transport_model.tests.qualikiz_based_transport_model_test.FakeQualikizBasedTransportModel[source]

Bases: QualikizBasedTransportModel

Fake QualikizBasedTransportModel for testing purposes.

prepare_qualikiz_inputs(Zeff_face, nref, transport, geo, core_profiles)[source]

Exposing prepare_qualikiz_inputs for testing.

Parameters:
Return type:

QualikizInputs

class torax.transport_model.tests.qualikiz_based_transport_model_test.QualikizBasedTransportModelConfig(**data)[source]

Bases: TransportBase

Model for the Qualikiz-based transport model.

transport_model

The transport model to use. Hardcoded to ‘qualikiz’.

coll_mult

Collisionality multiplier.

avoid_big_negative_s

Ensure that smag - alpha > -0.2 always, to compensate for no slab modes.

smag_alpha_correction

Reduce magnetic shear by 0.5*alpha to capture main impact of alpha.

q_sawtooth_proxy

If q < 1, modify input q and smag as if q~1 as if there are sawteeth.

DVeff

Effective D / effective V approach for particle transport.

An_min

Minimum |R/Lne| below which effective V is used instead of effective D.

Parameters:

data (Any)

build_transport_model()[source]

Builds a transport model from the config.

Return type:

FakeQualikizBasedTransportModel

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class torax.transport_model.tests.qualikiz_based_transport_model_test.QualikizTransportModelTest(*args, **kwargs)[source]

Bases: TestCase

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_qualikiz_based_transport_model_output_shapes()[source]

Tests that the core transport output has the right shapes.

test_qualikiz_based_transport_model_prepare_qualikiz_inputs_shapes()[source]

Tests that the qualikiz inputs have the expected shapes.

torax.transport_model.tests.qualikiz_transport_model_test module

class torax.transport_model.tests.qualikiz_transport_model_test.QualikizTransportModelTest(*args, **kwargs)[source]

Bases: TestCase

setUp()[source]

Hook method for setting up the test fixture before exercising it.

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test_call()[source]

Tests that the model can be called.

torax.transport_model.tests.quasilinear_transport_model_test module

class torax.transport_model.tests.quasilinear_transport_model_test.FakeQuasilinearTransportModel[source]

Bases: QuasilinearTransportModel

Fake QuasilinearTransportModel for testing purposes.

class torax.transport_model.tests.quasilinear_transport_model_test.QuasilinearTransportConfig(**data)[source]

Bases: TransportBase

QuasilinearTransportConfig for testing purposes.

Parameters:

data (Any)

build_transport_model()[source]

Builds a transport model from the config.

Return type:

FakeQuasilinearTransportModel

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class torax.transport_model.tests.quasilinear_transport_model_test.QuasilinearTransportModelTest(*args, **kwargs)[source]

Bases: TestCase

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_calculate_alpha()[source]

Tests that alpha is calculated correctly.

test_calculate_chiGB()[source]

Tests that chiGB is calculated correctly.

test_calculate_normalized_logarithmic_gradient()[source]

Tests that calculate_normalized_logarithmic_gradient is calculated correctly.

test_quasilinear_transport_model_dveff_DVeff_False(DVeff=False, An_min=0.05, expected_zero_v_face_el=False, expected_zero_d_face_el=False)

Tests that the DVeff approach options behaves as expected.

test_quasilinear_transport_model_dveff_DVeff_True_An_min_greater_than_Ane(DVeff=True, An_min=2.0, expected_zero_v_face_el=False, expected_zero_d_face_el=True)

Tests that the DVeff approach options behaves as expected.

test_quasilinear_transport_model_dveff_DVeff_True_An_min_less_than_Ane(DVeff=True, An_min=0.05, expected_zero_v_face_el=True, expected_zero_d_face_el=False)

Tests that the DVeff approach options behaves as expected.

test_quasilinear_transport_model_output_shapes()[source]

Tests that the core transport output has the right shapes.

torax.transport_model.tests.transport_model_test module

class torax.transport_model.tests.transport_model_test.FakeTransportConfig(**data)[source]

Bases: TransportBase

Fake transport config for a model that always returns zeros.

Parameters:

data (Any)

build_transport_model()[source]

Builds a transport model from the config.

Return type:

FakeTransportModel

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class torax.transport_model.tests.transport_model_test.FakeTransportModel[source]

Bases: TransportModel

Fake TransportModel for testing purposes.

class torax.transport_model.tests.transport_model_test.TransportSmoothingTest(*args, **kwargs)[source]

Bases: TestCase

Tests Gaussian smoothing in the torax.transport_model package.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_smoothing()[source]

Tests that smoothing works as expected.

test_smoothing_everywhere()[source]

Tests that smoothing everywhere works as expected.

Module contents

Transport model tests.