modosaic.services.experiment¶
modosaic.services.experiment ¶
ExperimentService ¶
ExperimentService(root='experiments', experiment_name=None)
Persist generated artifacts below one experiment directory.
Attributes:
| Name | Type | Description |
|---|---|---|
experiment_path |
Path
|
Directory where this run writes artifacts. |
Initialize an experiment folder.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
str | Path
|
Parent directory for experiments. |
'experiments'
|
experiment_name
|
str | None
|
Optional run directory name. A timestamp is used when omitted. |
None
|
Source code in modosaic/services/experiment.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | |
save_array_artifact ¶
save_array_artifact(relative_path, array)
Save a NumPy array with numpy.save.
Source code in modosaic/services/experiment.py
94 95 96 97 98 99 100 101 | |
save_array_collection_artifact ¶
save_array_collection_artifact(relative_path, arrays)
Save an array collection with numpy.savez.
Source code in modosaic/services/experiment.py
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | |
save_artifact ¶
save_artifact(artifact)
Save one artifact using its declared kind.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
artifact
|
ExperimentArtifact[Any]
|
Artifact to persist. |
required |
Returns:
| Type | Description |
|---|---|
Path
|
Path written to disk. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the artifact kind is unsupported. |
Source code in modosaic/services/experiment.py
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 | |
save_artifacts ¶
save_artifacts(artifacts)
Save many artifacts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
artifacts
|
Iterable[ExperimentArtifact[Any]]
|
Artifact objects to persist. |
required |
Returns:
| Type | Description |
|---|---|
list[Path]
|
Paths written to disk. |
Source code in modosaic/services/experiment.py
43 44 45 46 47 48 49 50 51 52 53 54 55 | |
save_bytes_artifact ¶
save_bytes_artifact(relative_path, payload)
Save raw bytes below the experiment directory.
Source code in modosaic/services/experiment.py
138 139 140 141 142 143 144 | |
save_depth ¶
save_depth(depth, depth_img)
Save legacy depth array and preview image artifacts.
Source code in modosaic/services/experiment.py
150 151 152 153 154 155 156 157 | |
save_image_artifact ¶
save_image_artifact(relative_path, image)
Save a PIL image below the experiment directory.
Source code in modosaic/services/experiment.py
119 120 121 122 123 124 125 | |
save_json_artifact ¶
save_json_artifact(relative_path, payload)
Save a JSON-serializable payload below the experiment directory.
Source code in modosaic/services/experiment.py
127 128 129 130 131 132 133 134 135 136 | |
save_normals ¶
save_normals(normals, normal_img)
Save legacy normals array and preview image artifacts.
Source code in modosaic/services/experiment.py
159 160 161 162 163 164 165 166 | |
save_segmentation_masks ¶
save_segmentation_masks(segmentation_masks, segmentation_masks_img)
Save legacy segmentation mask arrays and preview image artifacts.
Source code in modosaic/services/experiment.py
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | |
save_text ¶
save_text(text_caption)
Save a legacy caption artifact under text/result.txt.
Source code in modosaic/services/experiment.py
146 147 148 | |
save_text_artifact ¶
save_text_artifact(relative_path, text)
Save UTF-8 text below the experiment directory.
Source code in modosaic/services/experiment.py
86 87 88 89 90 91 92 | |