Closed calum-chamberlain closed 5 years ago
it looks very good. isn't it better write os.makedirs in _finalise_figure() for one time and remove it from all other functions? (i wrote it please see) And instead of make & update "plot_kwargs" update main "kwargs"? in this way user can define kwargs and update inside code, both of user kwargs and plot_kwargs will be use, and kwargs can pass from function to another inside function.
So the way you have it seems confusing to me:
savefile
to either of these two plots it gets used as a directory name and the actual filename is changed. This is different to every other plotting function there, so seems like a bad ideasavefile
in the normal way (like "directory/filename.format") then a directory with a .format is created. This is strangeplotdir
kwarg to the plotting functions, but this isn't actually used by the plotting functions as far as I can tell.The way I would like it to work is:
Hi, dear Chamberlain. answer to 3) with this method in _finalise_figure()
if save:
if '/' in savefile:
plotdir = '/'.join(savefile.split('/')[:-1])
if not os.path.isdir(plotdir):
os.makedirs(plotdir)
savefile split with '/' and result for "directory/filename.format" is not ".format". it is only "directory".
but let's move on. Please tell me how can i edit #329 like things you would like?
While that is true for all other functions, this section:
plotname = '{}_SNR.png'.format(signal[0].stats.starttime)
if "savefile" in kwargs.keys():
savefile = "{}/{}".format(kwargs.get("savefile"), plotname)
takes a users savefile
and adds an additional filename on the end, so the savefile
passed to _finalise_figure
is not the same as passed in.
RE what to do about #329: As I said, if this PR gets the result you were after (being able to pass a plotdir
argument to key functions and making some small changes to figure format) then I would close #329 and I will merge this PR later today.
What does this PR do?
Adds a standardised
plotdir
argument to:core.template_gen.template_gen
,core.matched_filter.match_filter.match_filter
,core.matched_filter.family.lag_calc
core.matched_filter.party.lag_calc
core.matched_filter.template.construct
core.matched_filter.template.detect
core.matched_filter.tribe.detect
core.matched_filter.tribe.client_detect
core.matched_filter.tribe.construct
This also adds some of the minor changes in #329.
Why was it initiated? Any relevant Issues?
329
PR Checklist
develop
base branch selected?CHANGES.md
.- [ ] First time contributors have added your name toCONTRIBUTORS.md
.