Skip to content
Snippets Groups Projects
Commit df2666e0 authored by jmcchesn's avatar jmcchesn
Browse files

Update iexcode/instruments/AD_utilities.py

parent 72c9f0b9
No related branches found
No related tags found
No related merge requests found
...@@ -8,8 +8,7 @@ work in progress need to redo ...@@ -8,8 +8,7 @@ work in progress need to redo
############################################################################################################## ##############################################################################################################
import datetime import datetime
import re import re
from os import listdir,mkdir,chown,system,chmod from os import listdir,mkdir,chown,system,chmod,path
from os.path import join, isfile, exists, dirname
from time import sleep from time import sleep
from epics import caget, caput from epics import caget, caput
...@@ -35,7 +34,7 @@ def AD_CurrentDirectory(ADplugin): ...@@ -35,7 +34,7 @@ def AD_CurrentDirectory(ADplugin):
else: else:
Dir = SubDir Dir = SubDir
SubDir=[] SubDir=[]
FilePath=join(Dir,*SubDir,'') FilePath=path.join(Dir,*SubDir,'')
return FilePath return FilePath
def AD_prefix(ADplugin): def AD_prefix(ADplugin):
...@@ -74,7 +73,8 @@ def AD_SaveFileSetup(ADplugin,mda,**kwargs): ...@@ -74,7 +73,8 @@ def AD_SaveFileSetup(ADplugin,mda,**kwargs):
FileTemplate="%s%s_%4.4d."+ext; format for filename first %s = filepath, second %s = prefix FileTemplate="%s%s_%4.4d."+ext; format for filename first %s = filepath, second %s = prefix
""" """
kwargs.setdefault("userpath",dirname(mda.filepath())) fp=path.dirname(mda.filepath())
kwargs.setdefault("userpath",fp)
kwargs.setdefault("subfolder",ADplugin.split(":")[-2][:-1]) kwargs.setdefault("subfolder",ADplugin.split(":")[-2][:-1])
kwargs.setdefault("prefix",ADplugin.split(":")[-2][:-1]) kwargs.setdefault("prefix",ADplugin.split(":")[-2][:-1])
...@@ -87,9 +87,9 @@ def AD_SaveFileSetup(ADplugin,mda,**kwargs): ...@@ -87,9 +87,9 @@ def AD_SaveFileSetup(ADplugin,mda,**kwargs):
if kwargs['debug']: if kwargs['debug']:
print("kwargs: ",kwargs) print("kwargs: ",kwargs)
fpath=join(kwargs['userpath'],kwargs['subfolder'],'') fpath=path.join(kwargs['userpath'],kwargs['subfolder'],'')
print("\nFolder: " + fpath) print("\nFolder: " + fpath)
if not (exists(fpath)): if not (path.exists(fpath)):
fileNumber=1 fileNumber=1
else: else:
fileNumber=get_next_fileNumber(fpath,kwargs["prefix"]) fileNumber=get_next_fileNumber(fpath,kwargs["prefix"])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment