Skip to content

Commit 713f6a0

Browse files
committed
Updates defaults for process map and comments out tqdm description.
1 parent 9910c6f commit 713f6a0

3 files changed

Lines changed: 20 additions & 15 deletions

File tree

src/am/simulator/tool/process_map/models/process_map.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ def run(self, num_proc: int = 1):
6262
if num_proc <= 1:
6363

6464
# Iterates through points z (inner) -> y (middle) -> x (outer)
65-
for data_point in tqdm(_data_points, desc="Running Process Map"):
65+
# for data_point in tqdm(_data_points, desc="Running Process Map"):
66+
for data_point in tqdm(_data_points):
6667
# Copies build parameters to a new object to pass as overrides.
6768
modified_build_parameters = deepcopy(self.build_parameters)
6869

@@ -104,7 +105,7 @@ def run(self, num_proc: int = 1):
104105
for future in tqdm(
105106
as_completed(futures),
106107
total=len(futures),
107-
desc="Running Process Map",
108+
# desc="Running Process Map", # Causes invalid json warning in claude-desktop
108109
):
109110
result = (
110111
future.result()
@@ -337,10 +338,10 @@ def plot(
337338
max_z_value_magnitude = _plot_data.axes[2][-1].magnitude
338339

339340
# z is often layer height or hatch spacing
340-
z_values = _plot_data.axes[2]
341-
z_values.reverse()
341+
# Use reversed() to avoid mutating the original list
342+
z_values = list(reversed(_plot_data.axes[2]))
342343

343-
z_units = f"{_plot_data.axes[2][0].units:~}"
344+
z_units = _plot_data.axes[2][0].units
344345
z_label = _plot_data.parameter_names[2].replace("_", " ").title()
345346

346347
for z_idx, z_value in enumerate(z_values):
@@ -359,14 +360,17 @@ def plot(
359360
layer_cmap = get_colormap_segment(position, cmap)
360361

361362
# Plotting
362-
data_2d = data[:, :, -z_idx]
363+
# Use -(z_idx + 1) since -0 equals 0, not -1
364+
data_2d = data[:, :, -(z_idx + 1)]
363365
# Mask all the False values so only True (1) areas are drawn
364366
data_2d_masked = np.ma.masked_where(
365367
~np.array(data_2d, dtype=bool), data_2d
366368
)
367369
ax.imshow(
368370
data_2d_masked,
369371
cmap=layer_cmap,
372+
vmin=0,
373+
vmax=2,
370374
aspect="auto",
371375
origin="lower",
372376
extent=extent,

src/am/simulator/tool/process_map/models/process_map_parameter_range.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
"beam_power": {
99
"start": (100, "watts"),
1010
"stop": (1000, "watts"),
11-
"step": (100, "watts"),
11+
"step": (25, "watts"),
1212
},
1313
"scan_velocity": {
1414
"start": (100, "millimeter / second"),
1515
"stop": (2000, "millimeter / second"),
16-
"step": (100, "millimeter / second"),
16+
"step": (25, "millimeter / second"),
1717
},
1818
"layer_height": {
19-
"start": (25, "microns"),
19+
"start": (50, "microns"),
2020
"stop": (100, "microns"),
2121
"step": (25, "microns"),
2222
},

src/am/simulator/tool/process_map/utils/parameter_ranges.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,22 +115,23 @@ def inputs_to_parameter_ranges(*input_tuples: ProcessMapParameterRangeInputTuple
115115
"""
116116
parameter_ranges = []
117117

118+
# Should be just "beam_power", "scan_velocity", and "layer_height"
119+
keys = list(DEFAULTS.keys())[:3]
120+
118121
# If no parameters provided, use defaults in order
119122
if all(all(v is None for v in param) for param in input_tuples):
120123

121-
# Should be just "beam_power", "scan_velocity", and "layer_height"
122-
keys = list(DEFAULTS.keys())[:3]
123-
124124
for key in keys:
125125
parameter_range = ProcessMapParameterRange(name=key)
126126
parameter_ranges.append(parameter_range)
127127

128128
return parameter_ranges
129129

130-
for shorthand, name, range_values, units in input_tuples:
130+
for index, (shorthand, name, range_values, units) in enumerate(input_tuples):
131131
parameter_range = parse_options(shorthand, name, range_values, units)
132132

133-
if parameter_range is not None:
134-
parameter_ranges.append(parameter_range)
133+
if parameter_range is None:
134+
parameter_range = ProcessMapParameterRange(name=keys[index])
135+
parameter_ranges.append(parameter_range)
135136

136137
return parameter_ranges

0 commit comments

Comments
 (0)