From 31e2da1978326517d0c6007a0518f2f3f0d9e810 Mon Sep 17 00:00:00 2001
From: Mark Driver <mdd31@alumni.cam.ac.uk>
Date: Wed, 19 Feb 2020 12:19:41 +0000
Subject: [PATCH] doc update.

---
 phasecalculator/phasecalculatorcli.py | 150 +++++++++++++++++++++++++-
 1 file changed, 145 insertions(+), 5 deletions(-)

diff --git a/phasecalculator/phasecalculatorcli.py b/phasecalculator/phasecalculatorcli.py
index 63065f0..71e549f 100755
--- a/phasecalculator/phasecalculatorcli.py
+++ b/phasecalculator/phasecalculatorcli.py
@@ -35,6 +35,14 @@ LOGGER.setLevel(logging.WARN)
 
 
 def main():
+    """Main function run when program called.
+
+    Returns
+    -------
+    None
+        Process result.
+
+    """
     # Create parser
     parser = create_phasecalculator_argparser()
     # parse args
@@ -42,14 +50,51 @@ def main():
     return process_args(args)
 
 def process_args(args):
+    """Process CLI Arguments.
+
+    Parameters
+    ----------
+    args : argparse.Namespace
+        Arguments from reading command line.
+
+    Returns
+    -------
+    None
+        Process result.
+
+    """
     return args.func(args)
 
 def process_inputgen(args):
+    """Process arguments to run input file creation for phase calculation.
+
+    Parameters
+    ----------
+    args : argparse.Namespace
+        Arguments from reading command line.
+
+    Returns
+    -------
+    None.
+
+    """
     output_filename = args.filename
     system_collection = create_system_collection(args)
     sysproc.write_system_collection_file(system_collection, output_filename)
 
 def process_phasecalculator(args):
+    """Process arguments to run phase calculation.
+
+    Parameters
+    ----------
+    args : argparse.Namespace
+        Arguments from reading command line.
+
+    Returns
+    -------
+    None.
+
+    """
     xml_filename = args.file
     system_collection = read_calculator_xml(xml_filename)
     if args.memreq is not None:
@@ -58,6 +103,19 @@ def process_phasecalculator(args):
         run_system_collection(system_collection)
 
 def create_system_collection(args):
+    """Create SystemCollection from input arguments
+
+    Parameters
+    ----------
+    args : argparse.Namespace
+        Arguments from argparse read of command line input.
+
+    Returns
+    -------
+    SystemCollection
+        SystemCollection.
+
+    """
     phases = read_phasecsv(args.phases)
     jar_path = args.jar
     scratch_dir = args.scratch
@@ -72,22 +130,105 @@ def create_system_collection(args):
     return SystemCollection([system])
     
 def create_output_inf(fgip_output, similarity_output, similarity_output_type, vle_output):
+    """Create OutputInformation
+
+    Parameters
+    ----------
+    fgip_output : bool
+        FGIP output result.
+    similarity_output : bool
+        Similarity output result.
+    similarity_output_type : str
+        Output type, see schema for restriction.
+    vle_output : bool
+        VLE output result.
+
+    Returns
+    -------
+    OutputInformation
+        Output information for calculation.
+
+    """
     return OutputInformation(fgip_output, similarity_output, similarity_output_type, vle_output)
 
 def create_runtime_inf(jar_path, scratch_dir, output_dir):
+    """Create RuntimeInformation
+
+    Parameters
+    ----------
+    jar_path : str
+        Jar file location.
+    scratch_dir : str
+        Scratch directory path.
+    output_dir : str
+        Output directory path.
+
+    Returns
+    -------
+    RuntimeInformation
+        Runtime information for calculation.
+
+    """
     return RuntimeInformation(jar_path, scratch_dir, output_dir)
     
 def read_calculator_xml(xml_filename):
+    """Read SystemCollection XML.
+
+    Parameters
+    ----------
+    xml_filename : str
+        filename for SystemCollection XML.
+
+    Returns
+    -------
+    SystemCollection
+        System collection for calculations to run.
+
+    """
     return sysproc.read_system_collection_file(xml_filename)
 
 def read_phasecsv(csv_filename):
+    """Read CSV file containing phase infomration and create Phases object.
+
+    Parameters
+    ----------
+    csv_filename : str
+        phase information CSV file.
+
+    Returns
+    -------
+    Phases
+        Phases representation of information.
+
+    """
     return csvconv.convert_csv_file_to_phases(csv_filename)
 
 def run_system_collection(system_collection, **kwargs):
+    """Run all systems in collection.
+
+    Parameters
+    ----------
+    system_collection : SystemCollection
+        system collection.
+    memory_req : str, optional
+        Memory settings for jar executable. The default is None.
+
+    Returns
+    -------
+    None.
+
+    """
     for system_info in system_collection.system_list:
         phasecrun.run_all_analysis(system_info, **kwargs)
 
 def create_phasecalculator_argparser():
+    """Create Argument parser for Phasecalculator module.
+
+    Returns
+    -------
+    ArgumentParser
+
+    """
     description = """Phase Calculator provides methods to perform FGIP,
 similarity and VLE analysis for solvents."""
     epilog = """Example usage"""
@@ -96,19 +237,18 @@ similarity and VLE analysis for solvents."""
                                              conflict_handler='resolve',
                                              formatter_class=argparse.ArgumentDefaultsHelpFormatter)
     subparsers = phase_argparser.add_subparsers(title="commands", dest="command")
-    
-    
+
     calc_description = """Calculation runner based on input System XML."""
     calc_epilog = """"""
-    
+
     calc_argparser = subparsers.add_parser("calculate", description=calc_description,
                                              epilog=calc_epilog,
                                            help="calculate phase properties.",
                                            formatter_class=argparse.ArgumentDefaultsHelpFormatter)
     calc_argparser.add_argument("-i", "-f","--file", type=str, required=True,
-                                help="")
+                                help="filename for SystemCollectionXML")
     calc_argparser.add_argument("--memreq", type=str, default=None,
-                                help="")
+                                help="memory specifier for jar call. Defaults to system default.")
     calc_argparser.set_defaults(func=process_phasecalculator)
     
     inpgen_description = """Input SystemCollection XML generation."""
-- 
GitLab