diff --git a/Software/AutomatedMeasurements/ElectronicMonkeyCCEScan.py b/Software/AutomatedMeasurements/ElectronicMonkeyCCEScan.py index ec604eb..5ffbef1 100644 --- a/Software/AutomatedMeasurements/ElectronicMonkeyCCEScan.py +++ b/Software/AutomatedMeasurements/ElectronicMonkeyCCEScan.py @@ -54,6 +54,10 @@ import numpy as np +import sys +sys.path.insert(0,'../Tools') +from SendEmail import * + parser = argparse.ArgumentParser(description='Define the parameters of the automated measurement for CCE scan.') parser.add_argument('--s',help='type of sensor') @@ -154,15 +158,24 @@ subprocess.call(command,shell=True) # Perform the measurement. +daqx = 0. +daqpar = 0. for pospar in np.linspace(firstpar,lastpar,(lastpar-firstpar)/steppar+1) : + daqx = 0. + daqpar = daqpar+1. # If the measurement is of type "CCEDelayScan" we need a different configuration file for each value of the delay. All these files are in "CCEDelayScanConfig" folder. if (measurement == "CCEDelayScan") : configlas = config+"/CCEDelayScanConfig/"+"CCEDelayScanConfig"+str(int(pospar))+"ns" - + else : + configlas = configped + for posx in range(firstx,lastx+stepx,stepx) : + daqx = daqx+1. + status = 100*((daqx-1)+(daqpar-1)*stepsx)/(stepsx*stepspar) print 'Value of the parameter identifying the measurement: %i steps' % pospar print 'Position along x: %i steps' % posx print 'Position along z: %i steps' % z + print 'Status: %.2f %% completed' % status if (measurement == "CCEBiasVoltageScan") : filename = folder+"/"+sensor+"/"+measurement+"/"+str(yyyymmdd)+"-"+str(int(pospar))+"V"+"-216-"+str(posx)+"x-"+str(z)+"z-las.ali" @@ -213,3 +226,11 @@ time.sleep(1) print 'End of the measurement!' + +# Send email. +sender = 'federica.lionetto@cern.ch' +receiver = 'federica.lionetto@cern.ch' +# receiver = 'philipp.gloor@gmail.com' +message = 'End of the measurement! Go to switch off the stepper motors ;)' +subject = 'End of the measurement!' +send_email(sender,receiver,message,subject) diff --git a/Software/AutomatedMeasurements/ElectronicMonkeyFocusing.py b/Software/AutomatedMeasurements/ElectronicMonkeyFocusing.py index e41968e..981f964 100644 --- a/Software/AutomatedMeasurements/ElectronicMonkeyFocusing.py +++ b/Software/AutomatedMeasurements/ElectronicMonkeyFocusing.py @@ -47,6 +47,10 @@ import time +import sys +sys.path.insert(0,'../Tools') +from SendEmail import * + parser = argparse.ArgumentParser(description='Define the parameters of the automated measurement for focusing.') parser.add_argument('--s',help='type of sensor') @@ -143,10 +147,17 @@ subprocess.call(command,shell=True) # Perform the measurement. +daqx = 0. +daqz = 0. for posz in range(firstz,lastz+stepz,stepz) : + daqx = 0. + daqz = daqz+1. for posx in range(firstx,lastx+stepx,stepx) : + daqx = daqx+1. + status = 100.*((daqx-1)+(daqz-1)*stepsx)/(stepsx*stepsz) print 'Position along x: %i steps' % posx print 'Position along z: %i steps' % posz + print 'Status: %.2f %% completed' % status if (measurement == "CCEBiasVoltageScan") : filename = folder+"/"+sensor+"/"+measurement+"/"+str(yyyymmdd)+"-"+par+"V"+"-216-"+str(posx)+"x-"+str(posz)+"z-las.ali" @@ -208,3 +219,11 @@ time.sleep(1) print 'End of the measurement!' + +# Send email. +sender = 'federica.lionetto@cern.ch' +receiver = 'federica.lionetto@cern.ch' +# receiver = 'philipp.gloor@gmail.com' +message = 'End of the measurement! Go to switch off the stepper motors ;)' +subject = 'End of the measurement!' +send_email(sender,receiver,message,subject) diff --git a/Software/Tools/SendEmail.py b/Software/Tools/SendEmail.py new file mode 100644 index 0000000..614322f --- /dev/null +++ b/Software/Tools/SendEmail.py @@ -0,0 +1,17 @@ +import smtplib +from email.mime.text import MIMEText as text + +def send_email(sender,receiver,message,subject) : + sender = sender + receiver = receiver + m = text(message) + m['Subject'] = subject + m['From'] = sender + m['To'] = receiver + + try : + smtpObj = smtplib.SMTP('localhost') + smtpObj.sendmail(sender, receiver, str(m)) + print "Successfully sent email." + except SMTPException : + print "Error! Unable to send email..." diff --git a/Software/Tools/SendEmail.pyc b/Software/Tools/SendEmail.pyc new file mode 100644 index 0000000..ea7d424 --- /dev/null +++ b/Software/Tools/SendEmail.pyc Binary files differ