Commit 908fae88 authored by myron's avatar myron
Browse files

mechanism to recover used data files

parent c6fc53d0
......@@ -15,6 +15,8 @@ __copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
import numpy as np
import array as arr
import collections
import os
# # try to import the fast PyMCA parsers
# try:
......@@ -59,6 +61,21 @@ SHOW_LOADED_FILES = False # this is useful when you want to take home a limited
# that ones for home. This without having to bring home the
# whole shift
if "SHOW_LOADED_FILES" in os.environ:
SHOW_LOADED_FILES = True
if SHOW_LOADED_FILES :
open("list_of_used_files.txt","w")
def dump_on_file_list(filename):
f = open("list_of_used_files.txt","a")
f.write( filename )
f.close()
def SpecRead(filename,nscan):
"""Parses a SPEC file and returns a specified scan.
......@@ -79,6 +96,9 @@ def SpecRead(filename,nscan):
motors = []
counterss = []
f = open(filename,'r')
if SHOW_LOADED_FILES:
dump_on_file_list(filename)
while True:
line = f.readline()
if not line: break
......@@ -110,6 +130,9 @@ def myEdfRead(filename):
"""
# get some info from header
f = open(filename,'rb').readlines()
if SHOW_LOADED_FILES:
dump_on_file_list(filename)
counter = 0
predata = []
for entry in f:
......@@ -177,6 +200,8 @@ def PyMcaSpecRead(filename,nscan):
Returns data, counter-names, and EDF-files using PyMCA.
"""
sf = SpecIO.Specfile(filename)
if SHOW_LOADED_FILES:
dump_on_file_list(filename)
scan = sf.select(str(nscan))
data = scan.data()
lables = scan.alllabels()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment