.. _files_generated_by_mgen_script:

Files Generated by MGen Script
=================================
    
This section discusses how the mgen script saves files to disk, if you want to see a full :ref:`mgen_script` example using a :ref:`mtut_script` try :ref:`builtin_mtut_example`.
    
Outputs from an :ref:`mgen_script` called 'builtin_mtut_example_mgen.pyml' are as follows:-
    
.. code-block:: console
    
    builtin_mtut_example_mgen.pyml_output/
        _temp
        genpop_*
        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:`mgen_script` are the multiple 'genpop_*' folders. Each of these folders contains the current sampled |fx| values and the synthetic data generated from the |fx| and the model. 

Note the number of 'genpop_*' folders created by the :ref:`mgen_script` is determined by the 'n_pop_samples' in the  :ref:`mgen-output_options_spec` section:-

.. code-block:: pyml

    OUTPUT_OPTIONS: {n_pop_samples: 30}

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

.. code-block:: console

    builtin_mtut_example_mgen.pyml_output/
        genpop_*/
            clean_sol/
            noisy_sol/
            dupe_covars_data.csv
            gen_fx_params.txt
            
Here the 'gen_fx_params.txt' is a human readable text file containing the |fx| values for this population. The 'dupe_covars_data.csv' is an intermediate file used by |popy| when constructing a new data set. The 'clean_sol' folder contains a |sol| with no noise added. The 'noisy_sol' contains as |sol| with measurement noise added. For example the 'noisy_sol' folder contains these files:-

.. code-block:: console

    builtin_mtut_example_mgen.pyml_output/
        genpop_*/
            noisy_sol/
                fx_params.csv
                mx_params.csv
                rx_params.csv
                solution.pyml
                sx_params.csv
                synthetic_data.csv
               
Here the key file is 'synthetic_data.csv', which is the full synthetic data file generated for this population. 

The other files represent intermediate variables for each time point, see :ref:`files_generated_by_sim_script` for more information.

.. comment
   need to write the sim_outputs.rst file and describe solutions properly within that file.


Note the :ref:`mgen_script` has **no** |output_scripts| section, so does not generate any child scripts unlike a :ref:`gen_script` see :ref:`files_generated_by_gen_script`.
  


