posydon.unit_tests.popsyn

posydon.unit_tests.popsyn.test_star_formation_history

Unit tests for posydon/popsyn/star_formation_history.py

class posydon.unit_tests.popsyn.test_star_formation_history.TestChruslinska21[source]

Bases: object

Tests for the Chruslinska21 SFH model with mocked data loading.

chruslinska_model(mock_chruslinska_data)[source]

Create a Chruslinska21 model instance with mocked data.

mock_chruslinska_data(monkeypatch)[source]

Create mock data for the Chruslinska21 class.

test_csfrd_calculation(chruslinska_model, mock_chruslinska_data)[source]

Test the CSFRD method.

test_foh_to_z_conversion(chruslinska_model)[source]

Test the _FOH_to_Z method for all scaling options.

test_fsfr_calculation(chruslinska_model)[source]

Test the fSFR method.

test_init_parameters()[source]

Test that initialization validates required parameters.

test_mean_metallicity(chruslinska_model, mock_chruslinska_data)[source]

Test the mean_metallicity method.

class posydon.unit_tests.popsyn.test_star_formation_history.TestFujimoto24[source]

Bases: object

Tests for the Fujimoto24 SFH model

test_init_parameters()[source]

Test that initialization sets the correct CSFRD parameters

class posydon.unit_tests.popsyn.test_star_formation_history.TestGetSFHModel[source]

Bases: object

Tests for the get_SFH_model function.

test_chruslinska_model(monkeypatch)[source]

Test that get_SFH_model returns Chruslinska21 instance.

test_illustris_tng_model(monkeypatch)[source]

Test that get_SFH_model returns IllustrisTNG instance.

test_invalid_model()[source]

Test that get_SFH_model raises an error for an invalid model.

test_returns_correct_instance()[source]

Test that get_SFH_model returns the correct instance for each model.

test_zavala_model(monkeypatch)[source]

Test that get_SFH_model returns Zavala21 instance.

class posydon.unit_tests.popsyn.test_star_formation_history.TestIllustrisTNG[source]

Bases: object

Tests for the IllustrisTNG SFH model with mocked data loading.

illustris_model(monkeypatch, mock_illustris_data)[source]

Create an IllustrisTNG model instance with mocked data.

mock_illustris_data()[source]

Create mock data for the IllustrisTNG class.

test_csfrd_calculation(illustris_model, mock_illustris_data)[source]

Test the CSFRD method.

test_fsfr_calculation(illustris_model)[source]

Test the fSFR method.

test_init_parameters(illustris_model, mock_illustris_data)[source]

Test that initialization sets the parameters correctly.

test_mean_metallicity(illustris_model, mock_illustris_data)[source]

Test the mean_metallicity method.

class posydon.unit_tests.popsyn.test_star_formation_history.TestMadauBase[source]

Bases: object

Test class for MadauBase

ConcreteMadau(e_CSFRD_params)[source]
e_CSFRD_params()[source]
test_csfrd(ConcreteMadau, e_CSFRD_params)[source]

Test the CSFRD method

test_fsfr(ConcreteMadau)[source]

Test the fSFR method

test_init_requires_sigma(ConcreteMadau)[source]

Test that MadauBase requires a sigma parameter

test_init_sets_csfrd_params_to_none(ConcreteMadau, e_CSFRD_params)[source]

Test that CSFRD_params is not set to None initially

test_mean_metallicity(ConcreteMadau)[source]

Test the mean_metallicity method

test_std_log_metallicity_dist(ConcreteMadau)[source]

Test the std_log_metallicity_dist method with different sigma values

class posydon.unit_tests.popsyn.test_star_formation_history.TestMadauDickinson14[source]

Bases: object

Tests for the MadauDickinson14 SFH model

test_csfrd_calculation()[source]

Test that CSFRD calculations match expected values

test_init_parameters()[source]

Test that initialization sets the correct CSFRD parameters

class posydon.unit_tests.popsyn.test_star_formation_history.TestMadauFragos17[source]

Bases: object

Tests for the MadauFragos17 SFH model

test_init_parameters()[source]

Test that initialization sets the correct CSFRD parameters

class posydon.unit_tests.popsyn.test_star_formation_history.TestNeijssel19[source]

Bases: object

Tests for the Neijssel19 SFH model

test_fsfr_with_lognormal()[source]

Test the overridden fSFR method which uses a ln-normal distribution

test_init_parameters()[source]

Test that initialization sets the correct CSFRD parameters

test_mean_metallicity()[source]

Test the overridden mean_metallicity method

class posydon.unit_tests.popsyn.test_star_formation_history.TestSFHBase[source]

Bases: object

ConcreteSFH()[source]

Create a concrete subclass of SFHBase for testing.

test_abstract_methods()[source]

Test that abstract methods must be implemented.

test_call_method()[source]

Test the __call__ method.

test_distribute_cdf(ConcreteSFH, model_dict, normalise, met_edges, expected, warning)[source]

Test the _distribute_cdf method with various scenarios.

test_distribute_cdf_invalid(ConcreteSFH)[source]

Test the _distribute_cdf method with invalid inputs.

test_init_attributes(ConcreteSFH)[source]

Test that the initialization sets attributes correctly.

test_validation(ConcreteSFH, model_dict, error_msg)[source]
class posydon.unit_tests.popsyn.test_star_formation_history.TestSFR_per_met_at_z[source]

Bases: object

Tests for SFR_per_met_at_z function.

test_SFR_per_met_at_z(monkeypatch)[source]

Test that SFR_per_met_at_z correctly calls the model.

class posydon.unit_tests.popsyn.test_star_formation_history.TestZavala21[source]

Bases: object

Tests for the Zavala21 SFH model with mocked data loading.

mock_zavala_data(monkeypatch)[source]

Create mock data for the Zavala21 class.

test_csfrd_max_model(mock_zavala_data)[source]

Test the CSFRD method with max sub-model.

test_csfrd_min_model(mock_zavala_data)[source]

Test the CSFRD method with min sub-model.

test_fsfr_calculation(mock_zavala_data)[source]

Test the fSFR method which is inherited from MadauBase.

test_init_parameters(mock_zavala_data)[source]

Test that initialization validates and sets parameters correctly.