Workspace

class comokit4py.Workspace(gama: comokit4py.Gama, explorationPlan: comokit4py.GamaExploration, workspaceDirectory: str, rebuildWorkspace: bool = False)

Bases: object

Constructor for Workspace object

Parameters
  • gama (Gama) – Gama object for launching exploration

  • explorationPlan (GamaExploration) – GamaExploration object to know what to launch

  • workspaceDirectory (str) – Directory path when everything will be store

  • _edf (bool) – (Optional) toto

  • _sbatch (dict) – (Generated) toto

  • _processedOutputVariable (dict) – (Generated) toto

Returns

Workspace object

__init__(gama: comokit4py.Gama, explorationPlan: comokit4py.GamaExploration, workspaceDirectory: str, rebuildWorkspace: bool = False)

Constructor for Workspace object

Parameters
  • gama (Gama) – Gama object for launching exploration

  • explorationPlan (GamaExploration) – GamaExploration object to know what to launch

  • workspaceDirectory (str) – Directory path when everything will be store

  • rebuildWorkspace (bool) – (Optional) Destroy and rebuild folder architecture [Default: False]

Returns

Workspace object

generateCsv(output: Optional[list] = None, outputCsvFileName: str = 'out')bool

Turn COMOKIT’s raw output CSV into compiled csv file

Parameters
  • output (list) – (Optional) Output list of raw processed data [Default re-process data]

  • outputCsvFileName (str) – (Optional) Name of the png file name (extension automatic) [Default = ‘out’]

Returns

Bool if csv file saved

generateNeededForExploration()None

Create all XML files for running GAMA headless

Returns

None

generatePng(title: str = '', output: Optional[list] = None, outputPngFileName: list = 'out')bool

Turn COMOKIT’s raw output CSV into a png graphs

Parameters
  • title (str) – (Optional) Output in png title [Default Disable]

  • output (list) – (Optional) Output list of raw processed data [Default re-process data]

  • outputPngFileName (list) – (Optional) Name of the png file name (extension automatic) [Default = ‘out’]

Returns

Bool if png file saved

getEdfBool()bool
prepareProcessedOutput(displayStep: int = 24, median: bool = False, quartile: bool = False, startDate: Optional[list] = None, startPolicyDate: Optional[list] = None, endPolicyDate: Optional[list] = None, cores: int = 2, stepTo: int = 1, output_name: list = ['Susceptible', 'Recovered', 'Presymptomatic', 'Asymptomatic', 'Symptomatic', 'Need hospital', 'Need ICU', 'Death'], output_color: list = ['g', 'b', 'olive', 'lightgreen', 'y', 'orange', 'r', 'm'])None

Prepare private variables for following functions generating CSV or PNG output files

Parameters
  • displayStep (int) – (Optional) Output list of raw processed data [Default re-process data]

  • median (bool) – (Optional) Display median curve in graph [Default False]

  • quartile (bool) – (Optional) Display quartile curves in graph (override median option) [Default False]

  • startDate (list[3]) – (Optional) Set starting real date in PNG x axis [Default None]

  • startPolicyDate (list[3]) – (Optional) Set starting policy grey area in PNG (needs startDate and endPolicyDate) [Default None]

  • endPolicyDate (list[3]) – (Optional) Set starting policy grey area in PNG (needs –startDate and –startPolicy) [Default toto]

  • cores (int) – (Optional) Number of core to use [Default Max number of cores available]

  • stepTo (int) – (Optional) Compile several steps in one [Default 1 => Disable]

  • output_name (list) – (Optional) List of outputed graphs [Default [“Susceptible”, “Recovered”, “Presymptomatic”, “Asymptomatic”, “Symptomatic”, “Need hospital”, “Need ICU”, “Death”] ]

  • output_color (list) – (Optional) Colors of outputed graphs [Default [“g”, “b”, “olive”, “lightgreen”, “y”, “orange”, “r”, “m”]]

Warning

Date parameter should follow this form : [YYYY, MM, DD] (list of int)

⚠️ Changing value of output_name and output_color may break following self.generateCsv() and self.generatePng() functions ⚠️

Returns

None

prepareSBatch(jobTimeout: int, core: int, nodes: int = 1, submission: int = 1, maxSubmission: int = 6, delay: int = 0)None

Create all needed structures and files to launch SLURM sbatch job

Parameters
  • jobTimeout (int) – Limit hour for SLURM job

  • core (int) – Number of cores used per node

  • nodes (int) – (Optional) Number of nodes used by SLURM [Default = 1]

  • submission (int) – (Optional) Total of submission on SLURM [Default = 1]

  • maxSubmission (int) – (Optional) Max number of active submission on SLURM [Default = 6]

  • delay (int) – (Optional) Delay in between launching headless (ex. 2s, 3m, 4h, 5d) [Default = 0]

Returns

None

rawOutputProcessing()list

Compiled COMOKIT’s raw output CSV into saveable list

Returns

Python list of post-processed COMOKIT explored data

rebuildWorkspace()None

Destroy and rebuild folder architecture

Returns

None

runGamaHeadless(log: bool = True, logFileName: str = 'out.log', cores: int = 1)None

Create all needed structures and files to launch SLURM sbatch job

Parameters
  • log (bool) – (Optional) Log slurm output in file [Default = True]

  • logFileName (str) – (Optional) Name of the log file [Default = ‘out.log’]

  • core (int) – (Optional) Number of cores allowed to GAMA [Default = 1]

Returns

None

runSlurm(log: bool = True, logFileName: str = 'out.log')None

Create all needed structures and files to launch SLURM sbatch job

Parameters
  • log (bool) – (Optional) Log slurm output in file [Default = True]

  • logFileName (str) – (Optional) Name of the log file [Default = ‘out.log’]

Returns

None

setEdfBool(edf: bool)None
toggleEdfBool()None
verifyAll(slurm: bool = False)bool

Check if everything (GAMA, Java, Slurm?) is installed and usable

Parameters

slurm (bool) – (Optional) Check also for SLURM

Returns

Bool if everything is ready

verifyGama()bool

Check if GAMA is ready to use in this workspace

Returns

Bool if everything is ready

verifyJavaVersion()bool

Check if the good Java is installed and usable

Returns

Bool if everything is ready

verifySlurm()bool

Check if the slurm is installed and usable

Returns

Bool if everything is ready