source: ETALON/BPM/scope_function.py @ 762

Last change on this file since 762 was 762, checked in by moutardier, 6 years ago

Code written by Alexandre Moutardier

File size: 1.1 KB
Line 
1__author__ = 'delerue'
2
3from PIL import Image
4import subprocess
5import time
6import urllib
7from datetime import datetime
8#from sparc_constants import *
9from writeclient import writeclient
10
11global SCOPE_IP
12SCOPE_IP = '10.0.1.112'
13scope_image_url="http://"+SCOPE_IP+"/crt_print.png"
14
15def read_image(image_name_and_path):
16    p = subprocess.Popen(["display",image_name_and_path])
17    print "tic"
18    time.sleep(10)
19    print "toc"
20    p.kill()
21
22
23def read_images_from_scope(nimages):
24    iimage=1
25    subproc=0
26    start_time_str=datetime.now().strftime("%Y%m%d_%H%M%S")
27    for iimage in range(nimages):
28        image_name_and_path=data_dir+"scope_image_"+start_time_str+"_"+str(iimage)+".png"
29        urllib.urlretrieve(scope_image_url,image_name_and_path)
30        if (subproc !=0):
31            subproc.kill()
32        subproc = subprocess.Popen(["display",image_name_and_path])
33        time.sleep(2)
34    time.sleep(10)
35    if (subproc !=0):
36        subproc.kill()
37
38
39def scpi_command(command):
40    reply=writeclient(SCOPE_IP,5025,command+chr(10),1)
41    print "SCPI: ",command," => ", reply
Note: See TracBrowser for help on using the repository browser.