-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
38 changed files
with
5,277 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from MySQLdb import * | ||
from ftplib import FTP | ||
|
||
|
||
id_r = 2 | ||
number_of_cores = 8 | ||
#simion_dir = '"C:\\Program Files (x86)\\SIMION 8.0\\mystuff\\' | ||
simion_dir = '"C:\\Program Files\\SIMION-8.1\\mystuff\\' | ||
|
||
while True: | ||
ftp = FTP('130.92.145.79') | ||
ftp.login('R','optimizer') | ||
break | ||
|
||
print 'connected to FTP server' | ||
ftp.retrbinary('RETR calculate_R_2.py', open('calculate_R_2.py','wb').write) | ||
ftp.retrbinary('RETR calculate_R_functions.py', open('calculate_R_functions.py', 'wb').write) | ||
ftp.retrbinary('RETR calculate_target_function.py', open('calculate_target_function.py', 'wb').write) | ||
|
||
execfile('calculate_R_2.py') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import os, sys | ||
import time | ||
from ftplib import FTP | ||
from calculate_R_functions import * | ||
from calculate_target_function import calculate_target_function | ||
|
||
|
||
os.system('del batchfile_log.log') | ||
os.system('del geometry_particle_history.log') | ||
os.system('del tf_control_file.txt') | ||
os.system('del tf_control.txt') | ||
|
||
loop_counter = 0 | ||
while True: | ||
############################################################################## | ||
# GET ALL INFOS FROM DATABASE # | ||
############################################################################## | ||
|
||
os.system('del optimizer_*_data.txt') | ||
refiner_list, gemfile_exists,gemfile_name,iob_filename = get_simion_files_2() | ||
|
||
# reserve jobs | ||
X, volt_iteration = get_algo_param_3(id_r,number_of_cores) | ||
|
||
if volt_iteration == 1 or loop_counter == 0: | ||
print 'First voltage iteration!' | ||
if gemfile_exists: | ||
print 'found gemfile: %s' % gemfile_name | ||
pa_name = gemfile_name.split('.')[0] + '.pa#' | ||
os.system('simion gem2pa %s %s'%(gemfile_name, pa_name)) | ||
print 'converted gemfile to pa...' | ||
print 'simion gem2pa %s %s'%(gemfile_name, pa_name) | ||
|
||
for filename in refiner_list: | ||
print 'simion --nogui --noprompt refine ' + simion_dir + filename[:-1] + '#"' | ||
#os.system('simion --nogui --noprompt refine ' + simion_dir + filename[:-1] + '#"') | ||
loop_counter += 1 | ||
############################################################################## | ||
# FASTADJUST AN FLY IONS # | ||
############################################################################## | ||
|
||
|
||
print 'FAST ADJUSTING ADJUSTABLE VOLTAGES AND FLY EM' | ||
#fastadjust_adj_voltages_and_fly_ions_2(X,iob_filename) | ||
for i in range(len(X)): | ||
fastadjust_adj_voltages_and_fly_ions_2(X[i],iob_filename,i) | ||
os.system('START /B simion --default-num-particles=60001 --nogui --noprompt lua start_simion_session_' + str(i) + '.lua >>nul') | ||
time.sleep(0.2) | ||
|
||
print 'waiting for simulations to end...' | ||
while True: | ||
sum_flags = 0 | ||
for i in range(len(X)): | ||
try: | ||
f = open('finished_' + str(i) + '.txt') | ||
sum_flags += int(f.readline()[0]) | ||
except: | ||
pass | ||
#print 'could not load : ' + 'finished_' + str(i) + '.txt' | ||
if sum_flags == len(X): | ||
break | ||
time.sleep(0.2) | ||
|
||
for i in range(len(X)): | ||
os.system('echo 0 >finished_' + str(i) + '.txt ') | ||
############################################################################### | ||
|
||
|
||
target_function = calculate_target_function(len(X)) | ||
print target_function | ||
print len(target_function) | ||
|
||
|
||
write_zielf(id_r,target_function) | ||
|
Oops, something went wrong.