> On 2 Aug, 2016, at 15:31, David Dotson <
dot...@gmail.com> wrote:
>
> You can use the now more-general behavior of the Sim itself to build desired filepaths. In this case, to achieve the same result I would do:
>
> fig.savefig(sim['Structure.MembraneMovement_AA/{}/'.format(chain)][
sim.name + '_timeserieshist.pdf'].abspath)
>
> Basically, you can build any filepath as a Tree or Leaf object using a Sim's `__getitem__` behavior, and calling abspath on one of these objects gives the absolute path to it, whether or not the path points to an existing directory or file, respectively.
>
> Does that help?
Yes, thanks, but I still needed to make sure that the directory exists:
datapath = 'domains/centerofmass/{}/'.format(chain)
sim[datapath].path.mkdir(exist_ok=True)
fig.savefig(sim[datapath][
sim.name + '_timeserieshist.pdf'].abspath)
Is there a more concise way?
--
Oliver Beckstein *
orbe...@gmx.net
skype: orbeckst *
orbe...@gmail.com