Automatic launchers and runs

Run class

twissed.Run(projectname, id, directory='/mnt/c/Minenna/Programmation/Twissed/doc/source', source=None, **kwargs)[source]

Run class.

Create a run from given scripts. The run will be created in the folder /directory/Run_id.

Main function are addfile and save. Each script added with addfile will be save in a pandas dataframe named df_ini_id.csv.

Usage

# Initiate new run
run = twissed.Run('twissed Run',
                directory=os.getcwd(),
                id=0,
                # Add to dict:
                author='Damien',
                description='Run for test')

# Add file to run
filename = "run.sh"
filepath = os.path.join(directory, "run_fbpic_topaze.sh")
run.addfile(filename,
            filepath,
            # Add to dict:
            accronyme="Skytest",
            slurm_n_core=20,
            slurm_T_cputime=84000,
            scriptpath = os.path.join(run.folderpath, "script_fbpic.py"))

# Add file to run
filename = "script_fbpic.py"
filepath = os.path.join(directory, "script_fbpic.py")
run.addfile(filename,
            filepath,
            # Add to dict:
            a0 = 1.3,
            w0 = 20.9e-6,
            taua = 2.5e-14,
            zfoc = 3.6e-03,
            z0 = -30.6*1e-6,
            )

# Create df_ini_00000000.csv file
run.save()

Get data from Run

Read data from run

twissed.getdatafromrun(path: str = '/mnt/c/Minenna/Programmation/Twissed/doc/source', timestep: int = -1, source: str = None, species: str = 'electrons') DataFrame[source]

Create df_end_id.csv file.

Parameters:
  • path (str, optional) – Path to run. Defaults to os.getcwd().

  • timestep (int, optional) – Step time wanted. Defaults to -1 (last one).

  • source (str, optional) – Set the source of the simulation. If None, will try to find the source from the df_ini_***.csv file. Defaults to None.

  • species (str, optional) – Name of the beam species. Defaults to “electrons”

Returns:

Pandas dataframe with the dict from Step.

Return type:

pd.DataFrame

Classic launcher

twissed.Launcher()[source]

Main launcher class

Genetic Algorithm launcher

twissed.LauncherGA(FIRSTID, POP_SIZE, nInputs, path='/mnt/c/Minenna/Programmation/Twissed/doc/source')[source]

Launcher for genetic algorithm