Skip to content

Commit

Permalink
Merge pull request #124 from eflewis312/master
Browse files Browse the repository at this point in the history
  • Loading branch information
devanshkv authored Jan 23, 2024
2 parents 120f46c + 6e2d0cc commit ba89e23
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
11 changes: 10 additions & 1 deletion bin/your_h5plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@
matplotlib.use("Agg")


def mapper(save, detrend_ft, publication, mad_filter, out_dir, h5_file):
def mapper(save, detrend_ft, publication, mad_filter, dpi, out_dir, h5_file):
# maps the variables so the function will be imap friendly
plot_h5(
h5_file=h5_file,
save=save,
detrend_ft=detrend_ft,
publication=publication,
mad_filter=mad_filter,
dpi=dpi,
outdir=out_dir,
)

Expand Down Expand Up @@ -66,6 +67,13 @@ def mapper(save, detrend_ft, publication, mad_filter, out_dir, h5_file):
default=None,
required=False,
)
parser.add_argument(
"--dpi",
help="DPI of resulting PNG file (default: 300)",
type=int,
default=300,
required=False,
)
parser.add_argument(
"-mad",
"--mad_filter",
Expand Down Expand Up @@ -129,6 +137,7 @@ def mapper(save, detrend_ft, publication, mad_filter, out_dir, h5_file):
values.no_detrend_ft,
values.publish,
values.mad_filter,
values.dpi,
values.out_dir,
)

Expand Down
4 changes: 3 additions & 1 deletion your/utils/plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def plot_h5(
detrend_ft=True,
publication=False,
mad_filter=False,
dpi=300,
outdir=None,
):
"""
Expand All @@ -31,6 +32,7 @@ def plot_h5(
save (bool): Save the file as a png
detrend_ft (bool): detrend the frequency time plot
publication (bool): make publication quality plot
dpi (int): DPI of output png (default: 300)
outdir (str): Path to the save the files into.
Returns:
Expand Down Expand Up @@ -122,7 +124,7 @@ def plot_h5(
filename = outdir + os.path.basename(h5_file)[:-3] + ".png"
else:
filename = h5_file[:-3] + ".png"
plt.savefig(filename, bbox_inches="tight", dpi=300)
plt.savefig(filename, bbox_inches="tight", dpi=dpi)
else:
plt.close()

Expand Down

0 comments on commit ba89e23

Please sign in to comment.