Пример #1
0
    def test__extracted_fits_from_instance_and_line_ci(self, dataset_line_7,
                                                       mask_1d_7_unmasked,
                                                       traps_x1, ccd,
                                                       clocker_1d):

        model = af.CollectionPriorModel(
            cti=af.Model(ac.CTI1D, traps=traps_x1, ccd=ccd),
            hyper_noise=af.Model(ac.ci.HyperCINoiseCollection),
        )

        masked_line_ci = dataset_line_7.apply_mask(mask=mask_1d_7_unmasked)

        post_cti_data = clocker_1d.add_cti(data=masked_line_ci.pre_cti_data,
                                           trap_list=traps_x1,
                                           ccd=ccd)

        analysis = ac.AnalysisDatasetLine(dataset_line=masked_line_ci,
                                          clocker=clocker_1d)

        instance = model.instance_from_unit_vector([])

        fit_analysis = analysis.fit_from_instance(instance=instance)

        fit = ac.FitDatasetLine(dataset_line=masked_line_ci,
                                post_cti_data=post_cti_data)

        assert fit.dataset.data.shape == (7, )
        assert fit_analysis.log_likelihood == pytest.approx(fit.log_likelihood)
Пример #2
0
    def test__make_result__result_line_is_returned(self, dataset_line_7,
                                                   pre_cti_data_7, traps_x1,
                                                   ccd, clocker_1d):
        model = af.CollectionPriorModel(
            cti=af.Model(ac.CTI1D, traps=traps_x1, ccd=ccd),
            hyper_noise=af.Model(ac.ci.HyperCINoiseCollection),
        )

        analysis = ac.AnalysisDatasetLine(dataset_line=dataset_line_7,
                                          clocker=clocker_1d)

        search = mock.MockSearch(name="test_search")

        result = search.fit(model=model, analysis=analysis)

        assert isinstance(result, ResultDatasetLine)
Пример #3
0
    def test__log_likelihood_via_analysis__matches_manual_fit(
            self, dataset_line_7, pre_cti_data_7, traps_x1, ccd, clocker_1d):

        model = af.CollectionPriorModel(
            cti=af.Model(ac.CTI1D, traps=traps_x1, ccd=ccd),
            hyper_noise=af.Model(ac.ci.HyperCINoiseCollection),
        )

        analysis = ac.AnalysisDatasetLine(dataset_line=dataset_line_7,
                                          clocker=clocker_1d)

        instance = model.instance_from_unit_vector([])

        log_likelihood_via_analysis = analysis.log_likelihood_function(
            instance=instance)

        post_cti_data = clocker_1d.add_cti(data=pre_cti_data_7.native,
                                           trap_list=traps_x1,
                                           ccd=ccd)

        fit = ac.FitDatasetLine(dataset_line=analysis.dataset_line,
                                post_cti_data=post_cti_data)

        assert fit.log_likelihood == log_likelihood_via_analysis
Пример #4
0
The `name` and `path_prefix` below specify the path where results ae stored in the output folder:  

 `/autocti_workspace/output/line/species[x2]`.
"""
search = af.DynestyStatic(path_prefix=path.join("line", dataset_name),
                          name="species[x1]",
                          nlive=50)
"""
__Analysis__

The `AnalysisDatasetLine` object defines the `log_likelihood_function` used by the non-linear search to fit the model 
to the `DatasetLine`dataset.
"""
analysis_list = [
    ac.AnalysisDatasetLine(dataset_line=dataset_line, clocker=clocker)
    for dataset_line in dataset_line_list
]
analysis = analysis_list[0] + analysis_list[1] + analysis_list[
    2] + analysis_list[3]
"""
__Model-Fit__

We can now begin the model-fit by passing the model and analysis object to the search, which performs a non-linear
search to find which models fit the data with the highest likelihood.

Checkout the folder `autocti_workspace/output/line/species[x2]` for live outputs of the results of the fit, 
including on-the-fly visualization of the best fit model!
"""
result_list = search.fit(model=model, analysis=analysis)
"""