Beispiel #1
0
#   <http://www.gnu.org/licenses/>.
#
#######################################################################

# std lib imports
import os.path

# third party imports

# local imports
from simplepl.simple_pl_parser import SimplePLParser
from simplepl.utils import open_dialog, open_multiple_dialog, dir_dialog
print 'Select files from which to remove the system response...'
filenames = open_multiple_dialog('*.*')
print filenames
print 'Select the system response file to open...'
sysres_filename = open_dialog('*.*')
print sysres_filename
print 'Select the directory in which to save the system response removed files...'
sysresrem_dir = dir_dialog()
print sysresrem_dir

for filename in filenames:
    parser = SimplePLParser(filename, sysres_filename)
    parser.parse()
    path, pathless_filename = os.path.split(filename)
    sysresrem_filename = os.path.join(sysresrem_dir, pathless_filename)
    with open(sysresrem_filename, 'w') as f:
        f.write('Wavelength\tSysResRem\n')
        for i in xrange(len(parser.wavelength)):
            f.write('%.1f\t%E\n'%(parser.wavelength[i], parser.sysresrem[i]))
Beispiel #2
0
# std lib imports
import os.path

# third party imports

# local imports
from simplepl.simple_pl_parser import SimplePLParser
from simplepl.utils import open_dialog, open_multiple_dialog, save_dialog
print 'Select the PL files to import...'
pl_filepaths = open_multiple_dialog('*.*')
if not pl_filepaths:
    raise ValueError('no PL files selected')
print pl_filepaths
print 'Select the system response file to use (if any)...'
sysres_filepath = open_dialog('*.*')
print sysres_filepath
print 'Select where to save the vsz file...'
save_filepath = save_dialog('*.*')
if not save_filepath:
    raise ValueError('no save path selected')
if not save_filepath.endswith('.vsz'):
    save_filepath += '.vsz'
print save_filepath

# tokenize the filenames
l_tokens = []
for pl_filepath in pl_filepaths:
    dirpath, filename = os.path.split(pl_filepath)
    root, ext = os.path.splitext(filename)
    l_tokens.append(root.split())