.. _files_generated_by_mfit_script:

Files Generated by MFit Script
=================================
    
This section discusses how the mfit script saves files to disk, if you want to see a full :ref:`mfit_script` example using a :ref:`mtut_script` try :ref:`builtin_mtut_example`.
    
Outputs from an :ref:`mfit_script` called 'builtin_mtut_example_mfit.pyml' are as follows:-
    
.. code-block:: console
    
    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 :ref:`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 :ref:`mfit_script`. For example the entry:-
    
.. code-block:: pyml

    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 :ref:`mgen_script`, see :ref:`files_generated_by_mgen_script`.

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

.. code-block:: console

    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 :ref:`fit_script`. See :ref:`fit_script_outputs` for a detailed explanation. The main result of each fit are the final |fx| parameter estimates which are store here:-

.. code-block:: console

    builtin_mtut_example_mfit.pyml_output/
        fitpop_*/
            solN/
                fx_params.csv
               
The 'fx_params.csv' contains the fitted |fx| which can be compared with the equivalent true |fx| values generated by :ref:`mgen_script`, usually located here (see :ref:`files_generated_by_mgen_script`):-

.. code-block:: console

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

The fitted vs true |fx| comparison is performed using the :ref:`mcomp_script`, see (see :ref:`files_generated_by_mcomp_script`):

Note the :ref:`mfit_script` has **no** |output_scripts| section, so does not generate any child scripts unlike a :ref:`fit_script` see :ref:`files_generated_by_fit_script`.
  


