diff --git a/.gitignore b/.gitignore index 1245444..8e4d493 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,6 @@ /problem880_960/* /installer/* /test/* -*.hdr *.enp *.log # 自己写的log文件 /.idea @@ -13,10 +12,6 @@ 20220629_focus corning410_test corning410_test.hdr -data - - - # Byte-compiled / optimized / DLL files __pycache__/ diff --git a/record_system_v25/data/ArcusDevice.py b/record_system_v25/data/ArcusDevice.py new file mode 100644 index 0000000..70ba5a0 --- /dev/null +++ b/record_system_v25/data/ArcusDevice.py @@ -0,0 +1,75 @@ +""" +Arcus controller python interface. +Only works if one ARCUS device is connected. +Including Arcus Configuration cables. +Open ArcusDevice.py in Python IDE --> Run --> Enter Terminal Commands +""" +import threading +import Arcus +import copy +import sys + +class ArcusDevice(object): + """ + This is interface class to Arcus stepper controller + @author Lukas Zubal + @version 1.0 + """ + def __init__(self): + """ + @brief Constructor + @param self object instance + """ + self.device = Arcus.Arcus() + if self.device.Connect() == 1: + print ' ' + else: + print "Cannot open stepper device on port " + sys.exit() + self.outputBuffer = " " + self.lock = threading.Lock() # thread safety + self.verbose = 0 + + def close(self): + """ + @brief Closes Arcus device connection + @param self object instance + @return bool Returns a 1 if successful + """ + self.lock.acquire() + self.device.Close() + self.lock.release() + del self.device + return 1 + + def write(self, data): + """ + @brief Command-response call to Arcus device + @see Arcus controller manual for complete list of interactive commands + @param self object instance + @param data string containing interactive commands to arcus + @return str Returns string containing response of controller + """ + self.lock.acquire() + self.device.SendAndRecive(data, self.outputBuffer) + resp = copy.deepcopy(self.outputBuffer[:]) + self.lock.release() + resp = resp.split('\x00')[0] + if self.verbose == 1: + print resp + return resp + +arc = ArcusDevice() + +arc.write('DN') # Send Terminal Command to return device name. +# print "Connected to device: " + response # Notify user + +for i in range(len(sys.argv)-1): + response = arc.write(sys.argv[i+1]) # Process Command and save Controller Response + while response != 'OK': + response = arc.write(sys.argv[i+1]) + if sys.argv[i+1] == 'HSPD': + print response + +arc.close() # Close Device. +del arc diff --git a/record_system_v26/data/ArcusDevice.py b/record_system_v26/data/ArcusDevice.py new file mode 100644 index 0000000..d5622f0 --- /dev/null +++ b/record_system_v26/data/ArcusDevice.py @@ -0,0 +1,75 @@ +""" +Arcus controller python interface. +Only works if one ARCUS device is connected. +Including Arcus Configuration cables. +Open ArcusDevice.py in Python IDE --> Run --> Enter Terminal Commands +""" +import threading +import Arcus +import copy +import sys + +class ArcusDevice(object): + """ + This is interface class to Arcus stepper controller + @author Lukas Zubal + @version 1.0 + """ + def __init__(self): + """ + @brief Constructor + @param self object instance + """ + self.device = Arcus.Arcus() + if self.device.Connect() == 1: + print ' ' + else: + print "Cannot open stepper device on port " + sys.exit() + self.outputBuffer = " " + self.lock = threading.Lock() # thread safety + self.verbose = 0 + + def close(self): + """ + @brief Closes Arcus device connection + @param self object instance + @return bool Returns a 1 if successful + """ + self.lock.acquire() + self.device.Close() + self.lock.release() + del self.device + return 1 + + def write(self, data): + """ + @brief Command-response call to Arcus device + @see Arcus controller manual for complete list of interactive commands + @param self object instance + @param data string containing interactive commands to arcus + @return str Returns string containing response of controller + """ + self.lock.acquire() + self.device.SendAndRecive(data, self.outputBuffer) + resp = copy.deepcopy(self.outputBuffer[:]) + self.lock.release() + resp = resp.split('\x00')[0] + if self.verbose == 1: + print resp + return resp + +arc = ArcusDevice() + +arc.write('DN') # Send Terminal Command to return device name. +# print "Connected to device: " + response # Notify user + +for i in range(len(sys.argv)-1): # The first param is the name of this file. + response = arc.write(sys.argv[i+1]) # Process Command and save Controller Response + print sys.argv[i+1], response + if sys.argv[i+1] != 'DN': # command 'DN' whose response is not 'OK'(actually is JSA00) is used to test if arcus is connected. + while response != 'OK': + response = arc.write(sys.argv[i+1]) + +arc.close() # Close Device. +del arc diff --git a/record_system_v27/data/ArcusDevice.py b/record_system_v27/data/ArcusDevice.py new file mode 100644 index 0000000..50228c4 --- /dev/null +++ b/record_system_v27/data/ArcusDevice.py @@ -0,0 +1,83 @@ +""" +Arcus controller python interface. +Only works if one ARCUS device is connected. +Including Arcus Configuration cables. +Open ArcusDevice.py in Python IDE --> Run --> Enter Terminal Commands +""" +import threading +import Arcus +import copy +import sys + +class ArcusDevice(object): + """ + This is interface class to Arcus stepper controller + @author Lukas Zubal + @version 1.0 + """ + def __init__(self): + """ + @brief Constructor + @param self object instance + """ + self.device = Arcus.Arcus() + if self.device.Connect() == 1: + print ' ' + else: + print "Cannot open stepper device on port " + sys.exit() + self.outputBuffer = " " + self.lock = threading.Lock() # thread safety + self.verbose = 0 + + def close(self): + """ + @brief Closes Arcus device connection + @param self object instance + @return bool Returns a 1 if successful + """ + self.lock.acquire() + self.device.Close() + self.lock.release() + del self.device + return 1 + + def write(self, data): + """ + @brief Command-response call to Arcus device + @see Arcus controller manual for complete list of interactive commands + @param self object instance + @param data string containing interactive commands to arcus + @return str Returns string containing response of controller + """ + self.lock.acquire() + self.device.SendAndRecive(data, self.outputBuffer) + resp = copy.deepcopy(self.outputBuffer[:]) + self.lock.release() + resp = resp.split('\x00')[0] + if self.verbose == 1: + print resp + return resp + +arc = ArcusDevice() + +arc.write('DN') # Send Terminal Command to return device name. +# print "Connected to device: " + response # Notify user + +for i in range(len(sys.argv)-1): # The first param is the name of this file. + response = arc.write(sys.argv[i+1]) # Process Command and save Controller Response + print sys.argv[i+1], response + if sys.argv[i+1] == 'DN': # Command 'DN' whose response is not 'OK'(actually is JSA00) is used to test if arcus is connected. + pass + elif sys.argv[i+1] == 'PX': # Command 'PX' is used to test if the position of arcus is return to 0(initial position); + if int(response) == 0: + print 'arcus is return to initial position' + if int(response) != 0: + print 'arcus is still returning' + else: + while response != 'OK': + response = arc.write(sys.argv[i+1]) + + +arc.close() # Close Device. +del arc diff --git a/record_system_v28/data/ArcusDevice.py b/record_system_v28/data/ArcusDevice.py new file mode 100644 index 0000000..50228c4 --- /dev/null +++ b/record_system_v28/data/ArcusDevice.py @@ -0,0 +1,83 @@ +""" +Arcus controller python interface. +Only works if one ARCUS device is connected. +Including Arcus Configuration cables. +Open ArcusDevice.py in Python IDE --> Run --> Enter Terminal Commands +""" +import threading +import Arcus +import copy +import sys + +class ArcusDevice(object): + """ + This is interface class to Arcus stepper controller + @author Lukas Zubal + @version 1.0 + """ + def __init__(self): + """ + @brief Constructor + @param self object instance + """ + self.device = Arcus.Arcus() + if self.device.Connect() == 1: + print ' ' + else: + print "Cannot open stepper device on port " + sys.exit() + self.outputBuffer = " " + self.lock = threading.Lock() # thread safety + self.verbose = 0 + + def close(self): + """ + @brief Closes Arcus device connection + @param self object instance + @return bool Returns a 1 if successful + """ + self.lock.acquire() + self.device.Close() + self.lock.release() + del self.device + return 1 + + def write(self, data): + """ + @brief Command-response call to Arcus device + @see Arcus controller manual for complete list of interactive commands + @param self object instance + @param data string containing interactive commands to arcus + @return str Returns string containing response of controller + """ + self.lock.acquire() + self.device.SendAndRecive(data, self.outputBuffer) + resp = copy.deepcopy(self.outputBuffer[:]) + self.lock.release() + resp = resp.split('\x00')[0] + if self.verbose == 1: + print resp + return resp + +arc = ArcusDevice() + +arc.write('DN') # Send Terminal Command to return device name. +# print "Connected to device: " + response # Notify user + +for i in range(len(sys.argv)-1): # The first param is the name of this file. + response = arc.write(sys.argv[i+1]) # Process Command and save Controller Response + print sys.argv[i+1], response + if sys.argv[i+1] == 'DN': # Command 'DN' whose response is not 'OK'(actually is JSA00) is used to test if arcus is connected. + pass + elif sys.argv[i+1] == 'PX': # Command 'PX' is used to test if the position of arcus is return to 0(initial position); + if int(response) == 0: + print 'arcus is return to initial position' + if int(response) != 0: + print 'arcus is still returning' + else: + while response != 'OK': + response = arc.write(sys.argv[i+1]) + + +arc.close() # Close Device. +del arc diff --git a/record_system_v28/data/lens_bin1_gain_SN0073 b/record_system_v28/data/lens_bin1_gain_SN0073 new file mode 100644 index 0000000..12cfdc4 Binary files /dev/null and b/record_system_v28/data/lens_bin1_gain_SN0073 differ diff --git a/record_system_v28/data/lens_bin1_gain_SN0073.hdr b/record_system_v28/data/lens_bin1_gain_SN0073.hdr new file mode 100644 index 0000000..b2cf1d2 --- /dev/null +++ b/record_system_v28/data/lens_bin1_gain_SN0073.hdr @@ -0,0 +1,9 @@ +ENVI +samples = 1364 +lines = 1 +bands = 300 +header offset = 0 +file type = ENVI Standard +data type = 4 +interleave = bsq +byte order = 0 diff --git a/record_system_v28/data/lens_bin2_gain_SN0073 b/record_system_v28/data/lens_bin2_gain_SN0073 new file mode 100644 index 0000000..644db5f Binary files /dev/null and b/record_system_v28/data/lens_bin2_gain_SN0073 differ diff --git a/record_system_v28/data/lens_bin2_gain_SN0073.hdr b/record_system_v28/data/lens_bin2_gain_SN0073.hdr new file mode 100644 index 0000000..54cb039 --- /dev/null +++ b/record_system_v28/data/lens_bin2_gain_SN0073.hdr @@ -0,0 +1,9 @@ +ENVI +samples = 682 +lines = 1 +bands = 150 +header offset = 0 +file type = ENVI Standard +data type = 4 +interleave = bsq +byte order = 0 diff --git a/record_system_v28/data/optical_fiber_bin1_gain_SN0073 b/record_system_v28/data/optical_fiber_bin1_gain_SN0073 new file mode 100644 index 0000000..0ab05c6 Binary files /dev/null and b/record_system_v28/data/optical_fiber_bin1_gain_SN0073 differ diff --git a/record_system_v28/data/optical_fiber_bin1_gain_SN0073.hdr b/record_system_v28/data/optical_fiber_bin1_gain_SN0073.hdr new file mode 100644 index 0000000..b2cf1d2 --- /dev/null +++ b/record_system_v28/data/optical_fiber_bin1_gain_SN0073.hdr @@ -0,0 +1,9 @@ +ENVI +samples = 1364 +lines = 1 +bands = 300 +header offset = 0 +file type = ENVI Standard +data type = 4 +interleave = bsq +byte order = 0 diff --git a/record_system_v28/data/wavelength0073.txt b/record_system_v28/data/wavelength0073.txt new file mode 100644 index 0000000..ec9d522 --- /dev/null +++ b/record_system_v28/data/wavelength0073.txt @@ -0,0 +1,300 @@ +3.962699999999999818e+02 +3.982699999999999818e+02 +4.002699999999999818e+02 +4.022799999999999727e+02 +4.042799999999999727e+02 +4.062799999999999727e+02 +4.082900000000000205e+02 +4.102900000000000205e+02 +4.122900000000000205e+02 +4.143000000000000114e+02 +4.163000000000000114e+02 +4.183000000000000114e+02 +4.203000000000000114e+02 +4.223100000000000023e+02 +4.243100000000000023e+02 +4.263100000000000023e+02 +4.283199999999999932e+02 +4.303199999999999932e+02 +4.323199999999999932e+02 +4.343299999999999841e+02 +4.363299999999999841e+02 +4.383299999999999841e+02 +4.403299999999999841e+02 +4.423399999999999750e+02 +4.443399999999999750e+02 +4.463399999999999750e+02 +4.483500000000000227e+02 +4.503500000000000227e+02 +4.523500000000000227e+02 +4.543500000000000227e+02 +4.563600000000000136e+02 +4.583600000000000136e+02 +4.603600000000000136e+02 +4.623700000000000045e+02 +4.643700000000000045e+02 +4.663700000000000045e+02 +4.683799999999999955e+02 +4.703799999999999955e+02 +4.723799999999999955e+02 +4.743799999999999955e+02 +4.763899999999999864e+02 +4.783899999999999864e+02 +4.803899999999999864e+02 +4.823999999999999773e+02 +4.843999999999999773e+02 +4.863999999999999773e+02 +4.884100000000000250e+02 +4.904100000000000250e+02 +4.924100000000000250e+02 +4.944100000000000250e+02 +4.964200000000000159e+02 +4.984200000000000159e+02 +5.004200000000000159e+02 +5.024300000000000068e+02 +5.044300000000000068e+02 +5.064300000000000068e+02 +5.084399999999999977e+02 +5.104399999999999977e+02 +5.124400000000000546e+02 +5.144400000000000546e+02 +5.164500000000000455e+02 +5.184500000000000455e+02 +5.204500000000000455e+02 +5.224600000000000364e+02 +5.244600000000000364e+02 +5.264600000000000364e+02 +5.284700000000000273e+02 +5.304700000000000273e+02 +5.324700000000000273e+02 +5.344700000000000273e+02 +5.364800000000000182e+02 +5.384800000000000182e+02 +5.404800000000000182e+02 +5.424900000000000091e+02 +5.444900000000000091e+02 +5.464900000000000091e+02 +5.485000000000000000e+02 +5.505000000000000000e+02 +5.525000000000000000e+02 +5.545000000000000000e+02 +5.565099999999999909e+02 +5.585099999999999909e+02 +5.605099999999999909e+02 +5.625199999999999818e+02 +5.645199999999999818e+02 +5.665199999999999818e+02 +5.685199999999999818e+02 +5.705299999999999727e+02 +5.725299999999999727e+02 +5.745299999999999727e+02 +5.765399999999999636e+02 +5.785399999999999636e+02 +5.805399999999999636e+02 +5.825499999999999545e+02 +5.845499999999999545e+02 +5.865499999999999545e+02 +5.885499999999999545e+02 +5.905599999999999454e+02 +5.925599999999999454e+02 +5.945599999999999454e+02 +5.965700000000000500e+02 +5.985700000000000500e+02 +6.005700000000000500e+02 +6.025800000000000409e+02 +6.045800000000000409e+02 +6.065800000000000409e+02 +6.085800000000000409e+02 +6.105900000000000318e+02 +6.125900000000000318e+02 +6.145900000000000318e+02 +6.166000000000000227e+02 +6.186000000000000227e+02 +6.206000000000000227e+02 +6.226100000000000136e+02 +6.246100000000000136e+02 +6.266100000000000136e+02 +6.286100000000000136e+02 +6.306200000000000045e+02 +6.326200000000000045e+02 +6.346200000000000045e+02 +6.366299999999999955e+02 +6.386299999999999955e+02 +6.406299999999999955e+02 +6.426399999999999864e+02 +6.446399999999999864e+02 +6.466399999999999864e+02 +6.486399999999999864e+02 +6.506499999999999773e+02 +6.526499999999999773e+02 +6.546499999999999773e+02 +6.566599999999999682e+02 +6.586599999999999682e+02 +6.606599999999999682e+02 +6.626699999999999591e+02 +6.646699999999999591e+02 +6.666699999999999591e+02 +6.686699999999999591e+02 +6.706799999999999500e+02 +6.726799999999999500e+02 +6.746799999999999500e+02 +6.766900000000000546e+02 +6.786900000000000546e+02 +6.806900000000000546e+02 +6.827000000000000455e+02 +6.847000000000000455e+02 +6.867000000000000455e+02 +6.887000000000000455e+02 +6.907100000000000364e+02 +6.927100000000000364e+02 +6.947100000000000364e+02 +6.967200000000000273e+02 +6.987200000000000273e+02 +7.007200000000000273e+02 +7.027200000000000273e+02 +7.047300000000000182e+02 +7.067300000000000182e+02 +7.087300000000000182e+02 +7.107400000000000091e+02 +7.127400000000000091e+02 +7.147400000000000091e+02 +7.167500000000000000e+02 +7.187500000000000000e+02 +7.207500000000000000e+02 +7.227500000000000000e+02 +7.247599999999999909e+02 +7.267599999999999909e+02 +7.287599999999999909e+02 +7.307699999999999818e+02 +7.327699999999999818e+02 +7.347699999999999818e+02 +7.367799999999999727e+02 +7.387799999999999727e+02 +7.407799999999999727e+02 +7.427799999999999727e+02 +7.447899999999999636e+02 +7.467899999999999636e+02 +7.487899999999999636e+02 +7.507999999999999545e+02 +7.527999999999999545e+02 +7.547999999999999545e+02 +7.568099999999999454e+02 +7.588099999999999454e+02 +7.608099999999999454e+02 +7.628099999999999454e+02 +7.648200000000000500e+02 +7.668200000000000500e+02 +7.688200000000000500e+02 +7.708300000000000409e+02 +7.728300000000000409e+02 +7.748300000000000409e+02 +7.768400000000000318e+02 +7.788400000000000318e+02 +7.808400000000000318e+02 +7.828400000000000318e+02 +7.848500000000000227e+02 +7.868500000000000227e+02 +7.888500000000000227e+02 +7.908600000000000136e+02 +7.928600000000000136e+02 +7.948600000000000136e+02 +7.968700000000000045e+02 +7.988700000000000045e+02 +8.008700000000000045e+02 +8.028700000000000045e+02 +8.048799999999999955e+02 +8.068799999999999955e+02 +8.088799999999999955e+02 +8.108899999999999864e+02 +8.128899999999999864e+02 +8.148899999999999864e+02 +8.168899999999999864e+02 +8.188999999999999773e+02 +8.208999999999999773e+02 +8.228999999999999773e+02 +8.249099999999999682e+02 +8.269099999999999682e+02 +8.289099999999999682e+02 +8.309199999999999591e+02 +8.329199999999999591e+02 +8.349199999999999591e+02 +8.369199999999999591e+02 +8.389299999999999500e+02 +8.409299999999999500e+02 +8.429299999999999500e+02 +8.449400000000000546e+02 +8.469400000000000546e+02 +8.489400000000000546e+02 +8.509500000000000455e+02 +8.529500000000000455e+02 +8.549500000000000455e+02 +8.569500000000000455e+02 +8.589600000000000364e+02 +8.609600000000000364e+02 +8.629600000000000364e+02 +8.649700000000000273e+02 +8.669700000000000273e+02 +8.689700000000000273e+02 +8.709800000000000182e+02 +8.729800000000000182e+02 +8.749800000000000182e+02 +8.769800000000000182e+02 +8.789900000000000091e+02 +8.809900000000000091e+02 +8.829900000000000091e+02 +8.850000000000000000e+02 +8.870000000000000000e+02 +8.890000000000000000e+02 +8.910099999999999909e+02 +8.930099999999999909e+02 +8.950099999999999909e+02 +8.970099999999999909e+02 +8.990199999999999818e+02 +9.010199999999999818e+02 +9.030199999999999818e+02 +9.050299999999999727e+02 +9.070299999999999727e+02 +9.090299999999999727e+02 +9.110399999999999636e+02 +9.130399999999999636e+02 +9.150399999999999636e+02 +9.170399999999999636e+02 +9.190499999999999545e+02 +9.210499999999999545e+02 +9.230499999999999545e+02 +9.250599999999999454e+02 +9.270599999999999454e+02 +9.290599999999999454e+02 +9.310700000000000500e+02 +9.330700000000000500e+02 +9.350700000000000500e+02 +9.370700000000000500e+02 +9.390800000000000409e+02 +9.410800000000000409e+02 +9.430800000000000409e+02 +9.450900000000000318e+02 +9.470900000000000318e+02 +9.490900000000000318e+02 +9.510900000000000318e+02 +9.531000000000000227e+02 +9.551000000000000227e+02 +9.571000000000000227e+02 +9.591100000000000136e+02 +9.611100000000000136e+02 +9.631100000000000136e+02 +9.651200000000000045e+02 +9.671200000000000045e+02 +9.691200000000000045e+02 +9.711200000000000045e+02 +9.731299999999999955e+02 +9.751299999999999955e+02 +9.771299999999999955e+02 +9.791399999999999864e+02 +9.811399999999999864e+02 +9.831399999999999864e+02 +9.851499999999999773e+02 +9.871499999999999773e+02 +9.891499999999999773e+02 +9.911499999999999773e+02 +9.931599999999999682e+02 +9.951599999999999682e+02 diff --git a/record_system_v28/log/corning_config.ini b/record_system_v28/log/corning_config.ini index 98cf93b..c06a303 100644 --- a/record_system_v28/log/corning_config.ini +++ b/record_system_v28/log/corning_config.ini @@ -13,7 +13,7 @@ end_row_binning_2 = 151 width_binning_1 = 1392 offsetx_binning_1 = 272 height_binning_1 = 302 -offsety_binning_1 = 364 +offsety_binning_1 = 340 width_binning_2 = 696 offsetx_binning_2 = 128 height_binning_2 = 151 @@ -33,10 +33,10 @@ file_name = wavelength0073.txt [image_record_param] image_dir = D:\py_program\corning410\record_system_v28/image default_image_name = 20220627 -framerate = 10 -exposure_time = 23232 +framerate = 20 +exposure_time = 17877.0 gain = 0.0 -frame_number = 50 +frame_number = 1000 arcus_speed = 800 [spectral_record_param]