Skip to content
This repository has been archived by the owner on Sep 18, 2023. It is now read-only.

Commit

Permalink
keep up with changes in specwriter callback
Browse files Browse the repository at this point in the history
  • Loading branch information
prjemian committed Feb 23, 2019
1 parent 5ead7ba commit 3af1645
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions ipython_setup/startup/80-callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,29 @@
""")


def spec_comment(comment, doc=None):
# supply our specwriter to the standard routine
APS_filewriters.spec_comment(comment, doc, specwriter)


def newSpecFile(title, scan_id=1):
"""
user choice of the SPEC file name
cleans up title, prepends month and day and appends file extension
"""
global specwriter
mmdd = str(datetime.now()).split()[0][5:].replace("-", "_")
clean = APS_utils.cleanupText(title)
fname = "%s_%s.dat" % (mmdd, clean)
if os.path.exists(fname):
print(f">>> file already exists: {fname} <<<")
specwriter.newfile(fname)
which = "appended"
specwriter.newfile(fname, RE=RE)
handled = "appended"

else:
specwriter.newfile(fname, scan_id=scan_id)
which = "created"
specwriter.newfile(fname, scan_id=scan_id, RE=RE)
handled = "created"

print(f"SPEC file name : {specwriter.spec_filename}")
print(f"File will be {which} at end of next bluesky scan.")
print(f"File will be {handled} at end of next bluesky scan.")

0 comments on commit 3af1645

Please # to comment.