folder_output_handler
The folder output handler.
This module defines the FolderOutputHandler class, which is responsible for
writing samples to a folder structure. It's used by the Flux and Slurm job managers.
FolderOutputHandler
Bases: BaseOutputHandler
Output handler for writing samples to a folder.
Attributes:
| Name | Type | Description |
|---|---|---|
settings_class |
The settings class for this output handler. |
|
supported_kwargs |
The full set of supported keyword arguments for the |
|
required_kwargs |
The set of required keyword arguments for the |
Methods:
| Name | Description |
|---|---|
write |
Writes samples to a folder structure. |
Source code in src/mada_tools/simulation/simutils/samples/output/folder_output_handler.py
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 120 121 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 | |
write(samples, parameter_names=None, **kwargs)
Creates a folder structure for each sample, writes the parameters to individual files,
and dumps all RunInstances to a JSON file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
samples
|
ndarray
|
A list of samples, where each sample is a list of floats. |
required |
parameter_names
|
List[str] | None
|
List of parameter names. |
None
|
**kwargs
|
Dict[str, Any]
|
Additional keyword arguments for output configuration. |
{}
|
Returns:
| Type | Description |
|---|---|
SampleOutputResult
|
A |
Source code in src/mada_tools/simulation/simutils/samples/output/folder_output_handler.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 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 | |
FolderOutputSettings
dataclass
Bases: BaseSettings
A class to encapsulate the settings for how to output samples to a directory structure.
This class is implemented to follow the common architecture used throughout the sample generation and output handling of the job management system. If more settings are needed, they can be added here easily.
Dataclasses like this help with type checking and setting defaults.
Attributes:
| Name | Type | Description |
|---|---|---|
output_dir |
str
|
Directory where samples will be saved (for folder mode). |
param_file |
str
|
File name for each parameter set (for folder mode). |
Methods:
| Name | Description |
|---|---|
validate |
Validates the input settings. |
__str__ |
Returns a string representation of the settings. |
__repr__ |
Returns a detailed string representation of the settings. |
Source code in src/mada_tools/simulation/simutils/samples/output/folder_output_handler.py
validate()
Validates the input settings.