Browse Source

Revert "Changed to be Py3.5 compatible"

This reverts commit 698603c079.
Benito Marcote 4 years ago
  1. 29


@ -28,14 +28,9 @@ optional parameters:
be <experiment>.vex
Version: 1.1
Version: 1.0
Date: May 2018
Written by Benito Marcote (
version 1.1 changes
- Formatted strings f'..{}..' changed to '..{}..'.format() to make the code compatible with Py3.5
(the one available in ee).
import sys
@ -92,12 +87,12 @@ assert args.firstscan <= args.lastscan
vexfile = vex.Vex(args.experiment, vexfile=args.vexfile)
if verbose:
print('{} has been read'.format(args.vexfile))
print(f'{args.vexfile} has been read')
# Updating experiment name
vexfile['GLOBAL']['EXPER'].value = args.experiment.upper()
if verbose:
print('$GLOBAL>$EXPER updated to{}'.format(args.experiment.upper()))
print(f'$GLOBAL>$EXPER updated to {args.experiment.upper()}')
oldexpname = [i for i in vexfile['EXPER'].keys() if 'comment' not in i]
if len(oldexpname) != 1:
@ -106,25 +101,25 @@ if len(oldexpname) != 1:
oldexpname = oldexpname[0]
vexfile['EXPER'][oldexpname].name = args.experiment.upper()
if verbose:
print('$EXPER>def {} updated to {}'.format(oldexpname, args.experiment.upper()))
print(f'$EXPER>def {oldexpname} updated to {args.experiment.upper()}')
vexfile['EXPER'][oldexpname]['exper_name'].value = args.experiment.upper()
if verbose:
print('$EXPER>exper_name updated to {}'.format(args.experiment.upper()))
print(f'$EXPER>exper_name updated to {args.experiment.upper()}')
descr = vexfile['EXPER'][oldexpname]['exper_description'].value
if len(descr) > 1:
if '"e-EVN' in descr[0]:
descr[1] = ' {}"'.format(args.experiment.upper())
descr[1] = f' {args.experiment.upper()}"'
vexfile['EXPER'][oldexpname]['exper_description'].value = descr
if verbose:
print('$EXPER>exper_description updated to contain only {}'.format(args.experiment.upper()))
print(f'$EXPER>exper_description updated to contain only {args.experiment.upper()}')
vexfile['EXPER'][oldexpname]['PI_name'].value = '"{}"'.format(args.piname)
vexfile['EXPER'][oldexpname]['PI_name'].value = f'"{args.piname}"'
if verbose:
print('EXPER>PI_name updated to {}'.format(args.piname))
print(f'EXPER>PI_name updated to {args.piname}')
# Keep sources that should be included
@ -138,7 +133,7 @@ for a_scan in allscans:
if (scannumber < args.firstscan) or (scannumber > args.lastscan):
del vexfile['SCHED'][a_scan]
if verbose:
print('Scan {} has been removed'.format(a_scan))
print(f'Scan {a_scan} has been removed')
# Double checking (in case the key exists, otherwise is within the 'start' key
@ -156,13 +151,13 @@ for a_scan in allscans:
for a_source in allsources.difference(sources):
del vexfile['SOURCE'][a_source]
if verbose:
print('Source {} has been removed'.format(a_source))
print(f'Source {a_source} has been removed')
# Write the VEX info to a file
if verbose:
print('File {} has been written'.format(outputfile))
print(f'File {outputfile} has been written')