Python API
All public packages, functions and classes are available in this module.
Functions:
Data classes:
Plotting:
Job(path, *, cfg)
Parameters:
-
path
(Path
) –Directory for simulation or model run.
-
cfg
(Optional[Config]
) –Duqtools config, defaults to global config if unspecified.
Source code in duqtools/models/_job.py
50 51 52 53 54 55 56 57 58 59 60 61 |
|
has_status: bool
property
Return true if a status file exists.
has_submit_script: bool
property
Return true if directory has submit script.
in_file: Path
property
Return path to the input file for the job.
is_completed: bool
property
Return true if the job has been completed succesfully.
is_done: bool
property
Return true if the job is done (completed or failed).
is_failed: bool
property
Return true if the job has failed.
is_running: bool
property
Return true if the job is running.
is_submitted: bool
property
Return true if the job has been submitted.
lockfile: Path
property
Return the path of the lockfile.
out_file: Path
property
Return path to the output file for the job.
status_file: Path
property
Return the path of the status file.
status_symbol
property
One letter status symbol.
submit_script: Path
property
Return the path of the submit script.
start()
Submit job and return generate that raises StopIteration when done.
Source code in duqtools/models/_job.py
165 166 167 168 169 170 171 172 |
|
status()
Return the status of the job.
Source code in duqtools/models/_job.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
|
status_symbol_help()
staticmethod
Return help string for status codes.
Source code in duqtools/models/_job.py
67 68 69 70 |
|
submit()
Submit job.
Source code in duqtools/models/_job.py
157 158 159 160 161 162 163 |
|
wait_until_done(time_step=1.0)
Submit task and wait until done.
Parameters:
-
time_step
(float
, default:1.0
) –Time in seconds step between status updates.
Source code in duqtools/models/_job.py
174 175 176 177 178 179 180 181 182 183 |
|
Run
Bases: BaseModel
Dataclass describing a run.
Runs
Bases: RootModel
Dataclass describing a collection of runs.
alt_errorband_chart(source, *, x, y, z='time')
Generate an altair errorband plot from a dataframe.
Parameters:
-
source
(DataFrame
) –Input dataframe
-
x
(str
) –X-value to plot, corresponds to a column in the source data
-
y
(str
) –Y-value to plot, corresponds to a column in the source data
-
z
(str
, default:'time'
) –Slider variable (time), corresponds to a column in the source data
Returns:
-
Chart
–Return an altair chart.
Source code in duqtools/_plot_utils.py
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
|
alt_line_chart(source, *, x, y, z='time', std=False)
Generate an altair line chart from a dataframe.
Parameters:
-
source
(DataFrame
) –Input dataframe
-
x
(str
) –X-value to plot, corresponds to a column in the source data
-
y
(str
) –Y-value to plot, corresponds to a column in the source data
-
z
(str
, default:'time'
) –Slider variable (time), corresponds to a column in the source data
-
std
(bool
, default:False
) –Plot the error bound from {x}_error_upper in the plot as well
Returns:
-
Chart
–Return an altair chart.
Source code in duqtools/_plot_utils.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
|
create(config, **kwargs)
Wrapper around create for python api.
Source code in duqtools/create.py
302 303 304 305 306 307 308 309 310 311 312 313 |
|
duqmap(function, *, runs=None, **kwargs)
Duqmap is a mapping function which can be used to map a user defined
function function
over either the runs created by duqtools, or the runs
specified by the user in runs
.
An important gotcha is that when Paths
are used to define the runs, duqtools
does not know how to associate the corresponding ImasHandles, as that information
is not available. So when using it in this way, it is not possible to provide a
function which takes an ImasHandle
as input.
Parameters:
-
function
(Callable[[Run | ImasHandle], Any]
) –function which is called for each run, specified either by
runs
, or implicitly by any availableruns.yaml
-
runs
(Optional[List[Run | Path]]
, default:None
) –A list of runs over which to operate the function
-
kwargs
–optional arguments that need to be passed to each
function
that you provide
Returns:
-
List[Any]:
–A list of anything that your function returns
Source code in duqtools/duqmap.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
|
get_status(config, **kwargs)
Wrapper around status for python api.
Source code in duqtools/status.py
222 223 224 225 |
|
recreate(config, runs, **kwargs)
Wrapper around create for python api.
Source code in duqtools/create.py
357 358 359 360 361 362 363 364 365 366 367 368 369 |
|
submit(config, **kwargs)
Wrapper around submit for python api.
Source code in duqtools/submit.py
273 274 275 276 |
|