Skip to content

Commit 8a0798d

Browse files
committed
Add nominal debugging option
1 parent 9141c75 commit 8a0798d

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

mosden/countrate.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@ def sample_parameter(val: ufloat, dist: str) -> float:
159159
return np.random.normal(val.n, val.s)
160160
elif dist == 'uniform':
161161
return np.random.uniform(val.n - val.s, val.n + val.s)
162+
elif dist == 'nominal':
163+
return val.n
162164
else:
163165
raise NotImplementedError(f'{dist} sampling not implemented')
164166

mosden/groupfit.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,11 @@ def _nonlinear_least_squares(self,
715715
self.post_data['concMC'] = list()
716716
for post_data_vals in post_data_save:
717717
for key in self.post_data.keys():
718-
self.post_data[key].append(post_data_vals[key])
718+
try:
719+
self.post_data[key].append(post_data_vals[key])
720+
except KeyError:
721+
# Running with pre-existing post data
722+
pass
719723
self.save_postproc()
720724

721725
yields = np.zeros((self.num_groups, self.MC_samples))

mosden/postprocessing.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,12 @@ def _chart_form(self, name: str, data: dict, cbar_label: str, vmin: float=1e-1,
252252
continue
253253
vmin_use = 10 ** np.floor(np.log10(vmin))
254254
vmax_use = 10 ** np.ceil(np.log10(vmax))
255+
if vmin_use == vmax_use:
256+
if vmin_use == 0.0:
257+
vmin_use = 0.1
258+
vmax_use = 1.0
259+
vmin_use = 0.1 * vmin_use
260+
vmax_use = 10 * vmax_use
255261
norm = LogNorm(vmin=vmin_use, vmax=vmax_use)
256262
plt.scatter(N, Z, c=C, norm=norm, marker="s", s=60)
257263
plt.set_cmap('viridis')

mosden/templates/input_schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@
335335
"sample_func": {
336336
"type": "string",
337337
"description": "The function type to use for randomly sampling data",
338-
"enum": ["normal", "uniform"]
338+
"enum": ["normal", "uniform", "nominal"]
339339
},
340340
"initial_params": {
341341
"type": "object",

0 commit comments

Comments
 (0)