Skip to content

Commit

Permalink
Merge pull request #751 from lnls-sirius/change-sofb
Browse files Browse the repository at this point in the history
change SOFB to create folders recursively to save RefOrb and ORM
  • Loading branch information
fernandohds564 authored Oct 28, 2021
2 parents ad5538d + 4773386 commit 11d3626
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions siriuspy/siriuspy/opticscorr/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def get_config_name(self):
with open(self.fname, 'r') as fil:
config_name = fil.read().strip('\n')
else:
_os.makedirs(self.fpath, exist_ok=True)
config_name = get_default_config_name(self.acc, self.opticsparam)
with open(self.fname, 'w+') as fil:
fil.write(config_name)
Expand Down
1 change: 1 addition & 0 deletions siriuspy/siriuspy/posang/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def get_config_name(self):
with open(self.fname, 'r') as fil:
config_name = fil.read().strip('\n')
else:
_os.makedirs(self.fpath, exist_ok=True)
config_name = get_default_config_name(self.tl, self.corrs_type)
with open(self.fname, 'w+') as fil:
fil.write(config_name)
Expand Down
3 changes: 1 addition & 2 deletions siriuspy/siriuspy/sofb/matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,5 @@ def _load_respmat(self):

def _save_respmat(self, mat):
path = _os.path.split(self._csorb.respmat_fname)[0]
if not _os.path.isdir(path):
_os.mkdir(path)
_os.makedirs(path, exist_ok=True)
_np.savetxt(self._csorb.respmat_fname, mat)
3 changes: 1 addition & 2 deletions siriuspy/siriuspy/sofb/orbit.py
Original file line number Diff line number Diff line change
Expand Up @@ -878,8 +878,7 @@ def _save_ref_orbits(self):
orbs = _np.array([refx, refy]).T
try:
path = _os.path.split(self._csorb.ref_orb_fname)[0]
if not _os.path.isdir(path):
_os.mkdir(path)
_os.makedirs(path, exist_ok=True)
_np.savetxt(self._csorb.ref_orb_fname, orbs)
except FileNotFoundError:
msg = 'WARN: Could not save reference orbit in file.'
Expand Down

0 comments on commit 11d3626

Please sign in to comment.