.. _files_generated_by_gen_script:

Files Generated by Gen Script
=============================
    
This section discusses how the :ref:`gen_script` saves files to disk, you can see an example in :ref:`builtin_gen_example`. After running a gen script, named 'my_gen_script.pyml', using the command:-

.. code-block:: console

    $ popy_run my_gen_script.pyml
    
the output folder 'my_gen_script.pyml_output' will be created as follows:-
    
.. code-block:: console

    my_gen_script.pyml_output/
        gen/
        sim/
        sum/

where 

* **gen** contains the results of running the :ref:`gen_script`
* **sim** contains the results of running :ref:`sim_script` to create smoother profile curves and 
* **sum** is a html summary of the generated data.

The :ref:`gen_script` also creates a log file **my_gen_script.pyml.run.main.log** that stores the output to the command prompt.


Gen Folder Output
~~~~~~~~~~~~~~~~~~

The gen folder has the following contents:-

.. code-block:: console

    builtin_gen_example_gen.pyml_output/
        gen/
            _temp/
            clean_sol/
            noisy_sol/
            compartment_diagram.dot
            compartment_diagram.svg
            dupe_covars_data.csv
            synthetic_data.csv
 
Here '_temp' is a temporary folder used by |popy|. The file 'dupe_covars_data.csv' is an intermediate file. 
  
A compartment diagram is created in .svg format. The .dot file is the |graphviz| file, used to create the .svg file. You can see an example compartment diagram in :numref:`fig_two_comp_depot_diagram_gen`.

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_gen_example_gen.pyml_output/
        gen/
            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.

Note the 'synthetic_data.csv' file is also output to this location, for easier access:-

.. code-block:: console
    
    builtin_gen_example_gen.pyml_output/
        gen/
            synthetic_data.csv

It is the main data file created by the :ref:`gen_script`.    

Naming of child scripts
~~~~~~~~~~~~~~~~~~~~~~~~

Each child script file name is based on the following entry, in the parent :ref:`gen_script`:-

.. code-block:: pyml

    DESCRIPTION: {name: <gen_name>}
    
This naming convention for output folders and generated scripts is followed by all :ref:`script_formats` in |popy|.


Gen Sim Folder Output
~~~~~~~~~~~~~~~~~~~~~~

The :ref:`gen_script` creates the following :ref:`sim_script`:-

.. code-block:: console

    my_gen_script.pyml_output/
        sim/    
            <gen_name>_sim.pyml
            
This :ref:`sim_script` plots smooth |pk| curves to visualise the |fx| parameters sampled by the :ref:`gen_script`. See :ref:`files_generated_by_sim_script` for more details.
            
Gen Sum Folder Output
~~~~~~~~~~~~~~~~~~~~~~

The :ref:`gen_script` creates the following :ref:`gensum_script`:-

.. code-block:: console

    my_gen_script.pyml_output/
        sum/
            <gen_name>_gensum.pyml
  
The :ref:`gensum_script` creates html output that summaries the **gen** and **sim** folders. See :ref:`files_generated_by_gensum_script` for more details.
  

