.. _files_generated_by_sim_script:

Files Generated by Sim Script
==============================
        
This section discusses how the :ref:`sim_script` saves files to disk. Typically a :ref:`sim_script` is created in a sub folder as a child script of a :ref:`fit_script` or :ref:`gen_script`.

Here we assume that the :ref:`sim_script` was created by a :ref:`fit_script` parent. Similar to the :ref:`fit_script` described in :ref:`files_generated_by_fit_script`.
    
When a :ref:`sim_script` is run, folders will be created on disk (within the same folder as the script) as follows:-
    
.. code-block:: console

    _temp
    dense
    observed_data
    
Here '_temp' is a folder used by |popy| to write temporary python functions and 'dense' contains the final plots.

'observed_data' is a |sol| folder that only contains original input data from the :ref:`sim_script`, for example, as specified in the 'input_data_file' field:-

.. code-block:: pyml

    FILE_PATHS:
        input_data_file: ..\gen\synthetic_data.csv

Here, the 'observed_data' folder contains a copy of the 'synthetic_data.csv' generated by the :ref:`gen_script`. The other folders generated by the :ref:`sim_script` are named after the |sols| loaded in by the 'solutions' section of the :ref:`sim_script` section, for example:-

.. code-block:: pyml

    FILE_PATHS:
        solutions: 
            initial: ..\fit\sol00\solution.pyml
            final: ..\fit\solN\solution.pyml       
        
 
Therefore |sol| folders 'initial' and 'final' will be created and will contain simulated |pk| data using the original |sol| folders from the **fit** output above.
        
The :ref:`sim_script` generates |sx| state values and noiseless |px| predictions at regular, dense time intervals (1.0 hours). These files are also saved as comma separated value \.csv files (one per individual) in:-

.. code-block:: console

    initial/
        pred_1.csv
        ...
        pred_50.csv
        sx_1.csv
        ...
        sx_50.csv
                
And similarly in the 'final' |sol| folder. Here the :ref:`sim_script` is effectively re-creating the original initial |fx| solution and final |fx| solution, but sampling more time points, to generate smoother |pk| curves.

The sim script also outputs a :ref:`grph_script` that plots the 'initial', 'final' and 'observed_data' solutions on one graph, with one plot per individual in the 'dense' folder:-

.. code-block:: console

    dense/
        DV_CENTRAL,DV_CENTRAL,DV_CENTRAL_wrt_TIME_spag_graphs/
            000000.svg
            ...
            000049.svg

