# Files Generated by MFit Script

This section discusses how the mfit script saves files to disk, if you want to see a full MFit Script example using a MTut Script try Generate multiple data sets and Fit using a Two Compartment Model.

Outputs from an MFit Script called ‘builtin_mtut_example_mfit.pyml’ are as follows:-

    builtin_mtut_example_mfit.pyml_output/
        _temp
        fitpop_*
        compartment_diagram.dot
        compartment_diagram.svg

The ‘_temp’ folder contains the temporary functions generated by PoPy. The ‘compartment_diagram.dot’ file is a Graphviz file used to generate the ‘compartment_diagram.svg’ image file.

The main output of MFit Script are the multiple ‘fitpop_*’ folders. Each of these folders contains the results of fitting the model to a separate synthetic data set.

The input data files are determined by the FILE_PATHS section of the MFit Script. For example the entry:-

    FILE_PATHS:
        input_data_files_glob: builtin_mtut_example_mgen.pyml_output/genpop_*/noisy_sol/synthetic_data.csv

Notice the ‘*’ in the ‘input_data_files_glob’ field, which uses a glob pattern to load multiple data files. Essentially any files matching this pattern, usually generated by a MGen Script, see Files Generated by MGen Script.

The structure of each ‘fitpop_*’ folder is as follows:-

    builtin_mtut_example_mfit.pyml_output/
        fitpop_*/
            sol00/
            sol0/
            sol1/
            solN/
            OBJV_vs_time.csv

This folder structure is very similar to the output of a Fit Script. See Fit Script Outputs for a detailed explanation. The main result of each fit are the final `f[X]` parameter estimates which are store here:-

    builtin_mtut_example_mfit.pyml_output/
        fitpop_*/
            solN/
                fx_params.csv

The ‘fx_params.csv’ contains the fitted `f[X]` which can be compared with the equivalent true `f[X]` values generated by MGen Script, usually located here (see Files Generated by MGen Script):-

    builtin_mtut_example_mgen.pyml_output/
        genpop_*/
            noisy_sol/
                fx_params.csv

The fitted vs true `f[X]` comparison is performed using the MComp Script, see (see Files Generated by MComp Script):

Note the MFit Script has no OUTPUT_SCRIPTS section, so does not generate any child scripts unlike a Fit Script see Files Generated by Fit Script.