Skip to content

Commit

Permalink
series images
Browse files Browse the repository at this point in the history
  • Loading branch information
blleng committed Sep 10, 2024
1 parent ec35b11 commit 177ecd8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/convert_emd/drawing.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ def convert_emd(file_name, data, output_type, scale_bar, sb_color, sb_x_start, s
else:
cmp = "gray"
size_x, size_y = emdfun.get_size(frame)
split_frame = emdfun.series_images(frame)
split_unit = frame["axes"][0]["units"]
for i in range(frame["axes"][0]["size"]):
frame["data"][i] = emdfun.contrast_stretch(frame["data"][i], stretch)
plt.figure(figsize=(size_x/100, size_y/100), facecolor="black")
Expand All @@ -95,9 +97,9 @@ def convert_emd(file_name, data, output_type, scale_bar, sb_color, sb_x_start, s
plt.margins = (0, 0)
plt.axis("off")
if scale_bar == True:
plt.savefig(output_name + title + "_" + str(i) + sb_text + output_type)
plt.savefig(output_name + title + "_" + split_frame + split_unit + "_" + sb_text + output_type)
else:
plt.savefig(output_name + title + "_" + str(i) + output_type)
plt.savefig(output_name + title + "_" + split_frame + split_unit + output_type)
plt.close()

if overlay:
Expand Down
6 changes: 6 additions & 0 deletions src/convert_emd/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ def signal3d_to_1d_data(frame):
y_data = frame["data"].sum(axis=(0, 1))
return np.asarray([x_data, y_data]).transpose()

def series_images(frame):
offset = frame["axes"][0]["offset"]
scale = frame["axes"][0]["scale"]
size = frame["axes"][0]["size"]
return np.arange(offset, scale*size+offset, scale)

def write_signal1d(file, data):
return np.savetxt(file, data, delimiter="\t")

Expand Down

0 comments on commit 177ecd8

Please sign in to comment.