Changeset 766 in ETALON


Ignore:
Timestamp:
May 24, 2018, 4:02:37 PM (6 years ago)
Author:
moutardier
Message:

creation de fonction premettant de lire l'oscillo et d'ecrire dans un fichier text, puis de bouger le moteur

Location:
BPM
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • BPM/initialise_motors.py

    r765 r766  
    77
    88from bpm_constants import *
    9 
     9from scope_function import *
    1010
    1111VERBOSE_DEFAULT=0
     
    218218    return ret
    219219
     220def position_test_horizontal():
     221    print('write OK if the zero possition sting is at maxima rigth or NO if it isn\'t')
     222    x = raw_input()
     223
     224    while not (x == 'OK' or x == 'NO'):
     225        print('you must check that the string won\'t touch the BPM, hence that te sting is at maxima right when you look from motor side at position 0, and then write OK \n or write NO')
     226        x = raw_input()
     227
     228    if (x == 'NO'):
     229        print('Please don\'t forbid to move BPM at maxima right when you look from motor side befor to shut down the motor')
     230        exit()
     231   
     232    else:
     233        motor_enable(1)
     234        move_motor_absolute(1,5000,400000)
     235        while motor_get(1, 'status') != 'READY':
     236            time.sleep(1)
     237        print('verification of position')
     238        time.sleep(5)
     239        move_motor_absolute(1,5000,0)
     240        while motor_get(1, 'status') != 'READY':
     241            time.sleep(1)
     242    motor_disable(1)
     243
     244def horizontal_aquisition(begin,end,pas,fichier):
     245        for i in range(begin, end+1,pas):
     246                move_motor_absolute(1,5000,i)
     247                while motor_get(1, 'status') != 'READY':
     248                        time.sleep(1)
     249                time.sleep(1)
     250                read_scope_and_write(i, fichier)
     251        time.sleep(1)
     252        move_motor_absolute(1,5000,begin)
     253        while motor_get(1, 'status') != 'READY':
     254                time.sleep(1)
     255        time.sleep(1)
     256        motor_disable(1)
     257
     258
     259
     260
     261
     262
     263
     264
     265
     266
     267
     268
     269
     270
     271
     272
     273
     274
     275
     276
     277
    220278#controller_hello()
    221279#move_motor_relative(1,1000,-1000)
  • BPM/scope_function.py

    r765 r766  
    4646    writeclient(SCOPE_IP,5025,command+chr(10),1)
    4747    print "SCPI: ",command
     48
     49def turn_on():
     50        scpi_command('CHAN1:STAT ON \nCHAN1:STAT?')
     51        scpi_command('CHAN2:STAT ON \nCHAN2:STAT?')
     52        scpi_command('CHAN3:STAT ON \nCHAN1:STAT?')
     53        scpi_command('CHAN4:STAT ON \nCHAN2:STAT?')
     54        scpi_command('CURS1:STAT ON \nCURS1:STAT?')
     55
     56def turn_off():
     57        scpi_command('CURS1:STAT OFF \nCURS1:STAT?')
     58        scpi_command('CHAN1:STAT OFF \nCHAN1:STAT?')
     59        scpi_command('CHAN2:STAT OFF \nCHAN2:STAT?')
     60        scpi_command('CHAN3:STAT OFF \nCHAN2:STAT?')
     61        scpi_command('CHAN4:STAT OFF \nCHAN2:STAT?')
     62
     63
     64def read_scope_and_write(position, fichier):
     65        fichier.write(str(position)+'\n')       
     66        for i in range(4):
     67                scpi_command('CURS1:SOUR CH'+str(i+1)+' \n CURS1:SOUR?')
     68                valeur = scpi_query('CURS1:FUNC UPE \n CURS:RES?')
     69                fichier.write(valeur)
     70
     71
     72
     73
     74
Note: See TracChangeset for help on using the changeset viewer.