Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/jade/post/manipulate_tally.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,22 @@ def condense_groups(
"""
tally["abs err"] = tally["Error"] * tally["Value"]
# this divides the entries in coarse energy bins

tally["coarse_bin"] = pd.cut(tally[group_column], bins=bins, right=False)
tally = tally.drop(columns=[group_column])
tally[group_column] = tally["coarse_bin"].apply(
lambda x: f"{x.left:g} - {x.right:g}"
lambda x: f"{x.left:g} - {x.right:g}" if pd.notna(x) else np.nan
)
'''
labels = [f"{bins[i]:g} - {bins[i+1]:g}" for i in range(len(bins) - 1)]

tally[group_column] = pd.cut(
tally[group_column],
bins=bins,
right=False,
labels=labels,
)
'''
del tally["coarse_bin"]
grouped = tally.groupby(group_column, observed=False).agg(
{"Value": "sum", "abs err": lambda x: math.sqrt((x**2).sum())}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,12 @@ Reaction rate:
Tritium activity:
concat_option: no_action
84:
- [mass, {}]
- [scale, {'factor': 2.57042574E+07}]
- [replace, {'column': 'Cells', 'values': *depth_h3}]

Tritium activity Pellet:
concat_option: no_action
84:
- [mass, {}]
- [scale, {'factor': 2.57042574E+07}]
- [add_column_with_dict, {'ref_column': 'Cells', 'values': *depth_h3d, new_columns: [ 'Distance','Pellet']}]
- [replace, {'column': 'Cells', 'values': *depth_h3}]