HK Variance Test (Frames Running)

This notebook provides a test for the noise and stability of the housekeeping data captured by the FPE. It evaluates the performance of the housekeeping system by taking a large number of samples, collecting the results for each signal channel, and evaluating the variance of the data for each channel.

In this version, we start frames running and repeat the taking of variance data on the housekeeping system.

Instructions:

Enter Your Name and today's date:

Ed Bokhour, 11/4/15

Enter the part numbers and serial numbers of the units under test:

SDPCB Interface 6.1, s/n 02. SDPCB 6.1 Driver s/n RPI15310002, SDPCB Video 6.1 s/n RPI15310001. Using wrapper 6.1.2 (San Diego).

When the test is complete, save this notebook as a new file, indicating the date, as "HK_Variance_Results_YYMMDD.ipynb". Alternatively, export the notebook as a PDF file, then clear all entries and outputs.

Start the Observatory Simulator and Load the FPE FPGA

Remember that whenever you power-cycle the Observatory Simulator, you should set preload=True below.

When you are running this notebook and it has not been power cycled, you should set preload=False.

Run the following cell to get the FPE loaded:


In [1]:
from tessfpe.dhu.fpe import FPE
from tessfpe.dhu.unit_tests import check_house_keeping_voltages
fpe1 = FPE(1, debug=False, preload=True, FPE_Wrapper_version='6.1.1')
print fpe1.version
fpe1.cmd_start_frames()
fpe1.cmd_stop_frames()
if check_house_keeping_voltages(fpe1):
    print "Wrapper load complete. Interface voltages OK."


Observatory Simulator Version 1.6c - Oct  8 2015 11:55:03
Wrapper load complete. Interface voltages OK.

Set all the operating parameters to the default values:


In [2]:
def set_fpe_defaults(fpe):
    "Set the FPE to the default operating parameters and return a list of the default values"
    defaults = {}
    for k in range(len(fpe.ops.address)):
        if fpe.ops.address[k] is None:
            continue
        fpe.ops.address[k].value = fpe.ops.address[k].default
        defaults[fpe.ops.address[k].name] = fpe.ops.address[k].default
    return defaults
set_fpe_defaults(fpe1)


Out[2]:
{'ccd1_backside': 0.0,
 'ccd1_input_diode_high': 12.0,
 'ccd1_input_diode_low': 12.0,
 'ccd1_input_gate_1': -3.0,
 'ccd1_input_gate_2': -3.0,
 'ccd1_output_drain_a_offset': 8.0,
 'ccd1_output_drain_b_offset': 8.0,
 'ccd1_output_drain_c_offset': 8.0,
 'ccd1_output_drain_d_offset': 8.0,
 'ccd1_output_gate': -1.0,
 'ccd1_parallel_high_offset': 0.0,
 'ccd1_parallel_low': -8.0,
 'ccd1_reset_drain': 12.0,
 'ccd1_reset_high': 3.0,
 'ccd1_reset_low_offset': -3.0,
 'ccd1_scupper': 12.0,
 'ccd1_serial_high': 4.0,
 'ccd1_serial_low_offset': -6.0,
 'ccd1_substrate': -40.0,
 'ccd2_backside': 0.0,
 'ccd2_input_diode_high': 12.0,
 'ccd2_input_diode_low': 12.0,
 'ccd2_input_gate_1': -3.0,
 'ccd2_input_gate_2': -3.0,
 'ccd2_output_drain_a_offset': 8.0,
 'ccd2_output_drain_b_offset': 8.0,
 'ccd2_output_drain_c_offset': 8.0,
 'ccd2_output_drain_d_offset': 8.0,
 'ccd2_output_gate': -1.0,
 'ccd2_parallel_high_offset': 0.0,
 'ccd2_parallel_low': -8.0,
 'ccd2_reset_drain': 12.0,
 'ccd2_reset_high': 3.0,
 'ccd2_reset_low_offset': -3.0,
 'ccd2_scupper': 12.0,
 'ccd2_serial_high': 4.0,
 'ccd2_serial_low_offset': -6.0,
 'ccd2_substrate': -40.0,
 'ccd3_backside': 0.0,
 'ccd3_input_diode_high': 12.0,
 'ccd3_input_diode_low': 12.0,
 'ccd3_input_gate_1': -3.0,
 'ccd3_input_gate_2': -3.0,
 'ccd3_output_drain_a_offset': 8.0,
 'ccd3_output_drain_b_offset': 8.0,
 'ccd3_output_drain_c_offset': 8.0,
 'ccd3_output_drain_d_offset': 8.0,
 'ccd3_output_gate': -1.0,
 'ccd3_parallel_high_offset': 0.0,
 'ccd3_parallel_low': -8.0,
 'ccd3_reset_drain': 12.0,
 'ccd3_reset_high': 3.0,
 'ccd3_reset_low_offset': -3.0,
 'ccd3_scupper': 12.0,
 'ccd3_serial_high': 4.0,
 'ccd3_serial_low_offset': -6.0,
 'ccd3_substrate': -40.0,
 'ccd4_backside': 0.0,
 'ccd4_input_diode_high': 12.0,
 'ccd4_input_diode_low': 12.0,
 'ccd4_input_gate_1': -3.0,
 'ccd4_input_gate_2': -3.0,
 'ccd4_output_drain_a_offset': 8.0,
 'ccd4_output_drain_b_offset': 8.0,
 'ccd4_output_drain_c_offset': 8.0,
 'ccd4_output_drain_d_offset': 8.0,
 'ccd4_output_gate': -1.0,
 'ccd4_parallel_high_offset': 0.0,
 'ccd4_parallel_low': -8.0,
 'ccd4_reset_drain': 12.0,
 'ccd4_reset_high': 3.0,
 'ccd4_reset_low_offset': -3.0,
 'ccd4_scupper': 12.0,
 'ccd4_serial_high': 4.0,
 'ccd4_serial_low_offset': -6.0,
 'ccd4_substrate': -40.0,
 'heater_1_current': 0.0,
 'heater_2_current': 0.0,
 'heater_3_current': 0.0}

Start the frames


In [3]:
fpe1.cmd_start_frames()


Out[3]:
'Starting frames...'

In [70]:
subprocess.check_output(["pwd"])


Out[70]:
'/Users/Ed/Documents/TESS_git/FPE_Test_Procedures\n'

In [ ]:
def capture_frames(self, n):
        """Capture frames"""
        import subprocess
        import os.path
        self.cmd_start_frames()
        proc = subprocess.Popen(
            [os.path.join(self._dir, "..", "fits_capture", "tess_obssim", "tess_obssim"), '-n', str(n)],
            shell=False)
        proc.communicate()
        self.cmd_stop_frames()

In [ ]:

Run the variance test:


In [27]:
from numpy import var, sqrt
samples=5
#from tessfpe.data.housekeeping_channels import housekeeping_channels
fpe1.cmd_cam_status()


# We make sample_data a dictionary and each value will be a set of HK 
# data, with key = sample_name.
sample_data = {}

# For later:
signal_names = []
signal_values = []
signal_data = {}
variance_values = {}

#for i in range(samples):
    # Get a new set of HK values
#    house_keeping_values = fpe1.house_keeping["analogue"]
#    data_values = house_keeping_values.values()
    # Add the new HK values to the sample_data dictionary:
    sample_number = "sample_" + str(i)
    sample_data[sample_number] = data_values

# Get the signal names for use later
signal_names = housekeeping_channels.keys()

# Get list of units for later
units = {}
for name in housekeeping_channels:
    units[name] = housekeeping_channels[name]['unit']
    
"""Assign the set of all HK values of the same signal (e.g. substrate_1) 
to the dictionary 'signal_data'"""

for k in range(len(signal_names)):
    # Build the list 'signal_values' for this signal:
    for i in range(samples):
        sample_number = "sample_" + str(i)
        signal_values.append(sample_data[sample_number][k])
    # Add signal_values to the signal_data dictionary:
    signal_data[signal_names[k]] = signal_values
    signal_values = []

""" Now get the square root of the variance of each of the 'signal_values' in the 
signal_data dictionary and put the result in the 'variance_values' 
dictionary."""
for name in signal_data:
    variance_values[name] = sqrt(var(signal_data[name]))
    #print units[name]["unit"]
    #print signal_data
    #print units[name]
    print '{0:26}     {1:.3} {2}'.format(name, variance_values[name], units[name])

# Results will be displayed below, in engineering units (root-variance).  
# Watch ObsSim LEDs for activity.


---------------------------------------------------------------------------
TimeOutError                              Traceback (most recent call last)
<ipython-input-27-ba6825fd43e6> in <module>()
     17 for i in range(samples):
     18     # Get a new set of HK values
---> 19     house_keeping_values = fpe1.house_keeping["analogue"]
     20     data_values = house_keeping_values.values()
     21     # Add the new HK values to the sample_data dictionary:

/Users/Ed/Documents/TESS_git/FPE_Test_Procedures/tessfpe/dhu/fpe.pyc in house_keeping(self)
    173     @property
    174     def house_keeping(self):
--> 175         hsk = self.cmd_cam_hsk()
    176         # Create a dictionary of the analogue outputs
    177         analogue = house_keeping.hsk_to_analogue_dictionary(hsk)

/Users/Ed/Documents/TESS_git/FPE_Test_Procedures/tessfpe/dhu/fpe.pyc in cmd_cam_hsk(self)
    124             "cam_hsk",
    125             reply_pattern="Hsk\[[0-9]+\] = 0x[0-9a-f]+",
--> 126             matches=channels
    127         )
    128         return [int(n, 16) for n in re.findall('0x[0-9a-f]+', out)]

/Users/Ed/Documents/TESS_git/FPE_Test_Procedures/tessfpe/dhu/fpesocketconnection.pyc in send_command(self, command, reply_pattern, chars, matches, timeout, retries)
     66             except TimeOutError as e:
     67                 t = e
---> 68         raise t
     69 
     70     def wait_for_pattern(self, pattern, matches=1, chars=1024, seperator='\n'):

TimeOutError: Timeout on trial 10

End HK Variance Test.