seidart.routines.prjbuild module¶
- seidart.routines.prjbuild.generate_template(nmats, dim=2, **kwargs)¶
Generate a JSON-serialisable project-file template.
- Parameters:
nmats (int) – Number of unique material IDs in the domain.
dim (float) – Dimensionality of the simulation (2, 2.5, or 3). Defaults to 2.
kwargs – Optional key=value overrides applied after the template is built. Keys use underscore notation (e.g.
Domain_nx=200).
- seidart.routines.prjbuild.image2int(imfilename: str) Tuple[ndarray, ndarray]¶
Converts an image file to a 2D array of integer values representing unique RGB combinations and returns the unique RGB values.
- Parameters:
imfilename (str) – The path to the image file.
- Returns:
A tuple containing the 2D array of integer values and the array of unique RGB values.
- Return type:
Tuple[np.ndarray, np.ndarray]
- seidart.routines.prjbuild.prjbuild(image_file: str, outputjson: str) None¶
Generates a project file (.prj) based on an input image file. This file contains domain parameters, material parameters, attenuation parameters, seismic parameters, and electromagnetic parameters derived from the image.
- Parameters:
image_file (str) – The path to the input image file.
outputjson (str) – The path where the project file is to be saved.
- seidart.routines.prjbuild.update_json(template, updates)¶
Apply field updates to a generated project template.
Update keys may use dotted paths, underscore-separated paths, or tuple paths that identify a section, material/model id, and field name.
- Parameters:
template (dict) – Project-template dictionary to update in place.
updates (dict) – Mapping from update paths to replacement values.
- Returns:
Updated project-template dictionary.
- Return type:
dict
updates = { ("Materials", 0, "rgb"): "255/0/0", "Domain.nx": 800, "Electromagnetic_0_Conductivity_0_s11": 0.002, } updated_template = update_json(template, updates)