code
string
signature
string
docstring
string
loss_without_docstring
float64
loss_with_docstring
float64
factor
float64
# Start with a page object for unknown entries if the HAR data has # any entries with no page ID pages = [] if any('pageref' not in entry for entry in self.har_data['entries']): pages.append(HarPage('unknown', har_parser=self)) for har_page in self.har_data['...
def pages(self)
This is a list of HarPage objects, each of which represents a page from the HAR file.
5.474901
4.593095
1.191985
if asset_type == 'page': assets = self.entries else: assets = getattr(self, '{0}_files'.format(asset_type), None) return self.get_total_size_trans(assets)
def _get_asset_size_trans(self, asset_type)
Helper function to dynamically create *_size properties.
4.904286
4.843109
1.012632
if asset_type == 'page': assets = self.entries else: assets = getattr(self, '{0}_files'.format(asset_type), None) return self.get_total_size(assets)
def _get_asset_size(self, asset_type)
Helper function to dynamically create *_size properties.
4.806556
4.623459
1.039602
if asset_type == 'initial': return self.actual_page['time'] elif asset_type == 'content': return self.pageTimings['onContentLoad'] elif asset_type == 'page': if self.page_id == 'unknown': return None return self.pageTimings...
def _get_asset_load(self, asset_type)
Helper function to dynamically create *_load_time properties. Return value is in ms.
7.457193
7.069923
1.054777
results = [] for entry in self.entries: valid_entry = True p = self.parser if request_type is not None and not p.match_request_type( entry, request_type, regex=regex): valid_entry = False if conten...
def filter_entries(self, request_type=None, content_type=None, status_code=None, http_version=None, regex=True)
Returns a ``list`` of entry objects based on the filter criteria. :param request_type: ``str`` of request type (i.e. - GET or POST) :param content_type: ``str`` of regex to use for finding content type :param status_code: ``int`` of the desired status code :param http_version: ``str`` o...
1.736422
1.826858
0.950496
entries = self.filter_entries( request_type=request_type, content_type=content_type, status_code=status_code ) if "async" in kwargs: asynchronous = kwargs['async'] if not asynchronous: time = 0 for entry in entries: ...
def get_load_time(self, request_type=None, content_type=None, status_code=None, asynchronous=True, **kwargs)
This method can return the TOTAL load time for the assets or the ACTUAL load time, the difference being that the actual load time takes asynchronous transactions into account. So, if you want the total load time, set asynchronous=False. EXAMPLE: I want to know the load time for...
3.65544
4.057529
0.900903
size = 0 for entry in entries: if entry['response']['bodySize'] > 0: size += entry['response']['bodySize'] return size
def get_total_size(self, entries)
Returns the total size of a collection of entries. :param entries: ``list`` of entries to calculate the total size of.
3.556794
3.945307
0.901525
size = 0 for entry in entries: if entry['response']['_transferSize'] > 0: size += entry['response']['_transferSize'] return size
def get_total_size_trans(self, entries)
Returns the total size of a collection of entries - transferred. NOTE: use with har file generated with chrome-har-capturer :param entries: ``list`` of entries to calculate the total size of.
3.744767
3.46745
1.079977
# The unknown page is just a placeholder for entries with no page ID. # As such, it would not have a TTFB if self.page_id == 'unknown': return None ttfb = 0 for entry in self.entries: if entry['response']['status'] == 200: for k, v...
def time_to_first_byte(self)
Time to first byte of the page request in ms
5.157498
4.894196
1.053799
fields = self._expand_group_by_fields(self.model, fields) return self._clone(klass=GroupByQuerySet, setup=True, _fields=fields)
def group_by(self, *fields)
Clone the queryset using GroupByQuerySet. :param fields: :return:
6.37343
6.223231
1.024135
d = {} # Iterate all keys and values for k, v in self._row_values.items(): # Split related model fields attrs = k.rsplit('__', 1) # Set value depending case if len(attrs) == 2: # Related model field, store nested ...
def _data(self)
Cached data built from instance raw _values as a dictionary.
6.108637
5.475259
1.11568
# Iterate all keys and values in data for k, v in self._data.items(): # If it's a dict, process it (it's probably instance data) if isinstance(v, dict): try: # Get related model from field (follow path) rel_model = ...
def _set_values(self)
Populate instance with given.
6.66587
6.472426
1.029887
fields = self._expand_group_by_fields(self.model, fields) clone = self._values(*fields) clone._iterable_class = GroupByIterable return clone
def group_by(self, *fields)
Clone the queryset using GroupByQuerySet. :param fields: :return:
8.639045
7.389331
1.169124
# Containers for resulting fields and related model fields res = [] related = {} # Add own fields and populate related fields for field_name in fields: if '__' in field_name: # Related model field: append to related model's fields ...
def _expand_group_by_fields(cls, model, fields)
Expand FK fields into all related object's fields to avoid future lookups. :param fields: fields to "group by" :return: expanded fields
2.690863
2.761378
0.974464
'''Write to dummy memory Parameters ---------- addr : int The register address. data : list, tuple Data (byte array) to be written. Returns ------- nothing ''' logger.debug( "Dummy SiTransferLayer.write...
def write(self, addr, data)
Write to dummy memory Parameters ---------- addr : int The register address. data : list, tuple Data (byte array) to be written. Returns ------- nothing
6.007807
3.748829
1.602582
''' Parameters ---------- addr : int The register address. size : int Length of data to be read (number of bytes). Returns ------- array : array Data (byte array) read from memory. Returns 0 for each byte if it hasn't b...
def read(self, addr, size)
Parameters ---------- addr : int The register address. size : int Length of data to be read (number of bytes). Returns ------- array : array Data (byte array) read from memory. Returns 0 for each byte if it hasn't been written to.
5.33501
2.650667
2.012704
def set_value(self, value, addr, size, offset, **kwargs): '''Writing a value of any arbitrary size (max. unsigned int 64) and offset to a register Parameters ---------- value : int, str The register value (int, long, bit string) to be written. addr : int ...
Writing a value of any arbitrary size (max. unsigned int 64) and offset to a register Parameters ---------- value : int, str The register value (int, long, bit string) to be written. addr : int The register address. size : int Bit siz...
null
null
null
def get_value(self, addr, size, offset, **kwargs): '''Reading a value of any arbitrary size (max. unsigned int 64) and offset from a register Parameters ---------- addr : int The register address. size : int Bit size/length of the value. ...
Reading a value of any arbitrary size (max. unsigned int 64) and offset from a register Parameters ---------- addr : int The register address. size : int Bit size/length of the value. offset : int Offset of the value to be written to ...
null
null
null
def set_bytes(self, data, addr, **kwargs): '''Writing bytes of any arbitrary size Parameters ---------- data : iterable The data (byte array) to be written. addr : int The register address. Returns ------- nothing ...
Writing bytes of any arbitrary size Parameters ---------- data : iterable The data (byte array) to be written. addr : int The register address. Returns ------- nothing
null
null
null
def get_bytes(self, addr, size, **kwargs): '''Reading bytes of any arbitrary size Parameters ----------. addr : int The register address. size : int Byte length of the value. Returns ------- data : iterable ...
Reading bytes of any arbitrary size Parameters ----------. addr : int The register address. size : int Byte length of the value. Returns ------- data : iterable Byte array.
null
null
null
if size is None: self._drv.set_data(self.tobytes()) else: self._drv.set_data(self.tobytes()[:size]) if "auto_start" in self._conf: if self._conf["auto_start"]: self._drv.start()
def write(self, size=None)
to call start() automatically, set yaml file as follows: registers: - name : CCPD_PCB type : StdRegister hw_driver : CCPD_PCB_SPI size : 32 auto_start : True <------ add this fields: ......
3.687523
3.654974
1.008905
''' Factory method For format characters see: https://docs.python.org/2/library/struct.html ''' bl = cls(**kwargs) # size is 0 by default bl.fromvalue(value=value, size=size, fmt=fmt) return bl
def from_value(cls, value, size=None, fmt='Q', **kwargs)
Factory method For format characters see: https://docs.python.org/2/library/struct.html
7.115271
4.795238
1.48382
''' Append from a int/long number. ''' if size and value.bit_length() > size: raise TypeError('Value is too big for given size') self.frombytes(struct.pack(fmt, value)) if size: if not isinstance(size, integer_types) or not size > 0: ...
def fromvalue(self, value, size=None, fmt='Q')
Append from a int/long number.
4.033095
3.409796
1.182797
''' Convert bitstring to a int/long number. ''' format_size = struct.calcsize(fmt) if self.length() > format_size * 8: raise TypeError('Cannot convert to number') ba = self.copy() ba.extend((format_size * 8 - self.length()) * [0]) return struct...
def tovalue(self, fmt='Q')
Convert bitstring to a int/long number.
4.767033
3.486871
1.367138
'''Swap slice indices Change slice indices from Verilog slicing (e.g. IEEE 1800-2012) to Python slicing. ''' try: start = slc.start stop = slc.stop slc_step = slc.step except AttributeError: if make_slice: if slc < ...
def _swap_slice_indices(self, slc, make_slice=False)
Swap slice indices Change slice indices from Verilog slicing (e.g. IEEE 1800-2012) to Python slicing.
2.299333
1.895222
1.213226
# Write the sequence to the sequence generator (hw driver) self['SEQ'].write(size) #write pattern to memory self['SEQ'].set_size(size) # set size self['SEQ'].set_repeat(1) # set repeat for _ in range(1): self['SEQ'].start() # start ...
def _run_seq(self, size)
Send the contents of self['SEQ'] to the chip and wait until it finishes.
7.548768
6.079092
1.241759
#reset some stuff self['SEQ']['GLOBAL_SHIFT_EN'].setall(False) self['SEQ']['GLOBAL_CTR_LD'].setall(False) self['SEQ']['GLOBAL_DAC_LD'].setall(False) self['SEQ']['PIXEL_SHIFT_EN'].setall(False) self['SEQ']['INJECTION'].setall(False)
def _clear_strobes(self)
Resets the "enable" and "load" output streams to all 0.
6.388837
6.06926
1.052655
''' Sets data for outgoing stream ''' if self._mem_bytes < len(data): raise ValueError('Size of data (%d bytes) is too big for memory (%d bytes)' % (len(data), self._mem_bytes)) self._intf.write(self._conf['base_addr'] + self._spi_mem_offset + addr, data)
def set_data(self, data, addr=0)
Sets data for outgoing stream
6.572054
5.298197
1.240432
''' Gets data for incoming stream ''' # readback memory offset if addr is None: addr = self._mem_bytes if size and self._mem_bytes < size: raise ValueError('Size is too big') if size is None: return self._intf.read(self._conf[...
def get_data(self, size=None, addr=None)
Gets data for incoming stream
5.00161
4.383761
1.14094
''' Initialize serial device. Parameters of serial.Serial: http://pyserial.sourceforge.net/pyserial_api.html Plus termination string parameter eol ''' super(Serial, self).init() self.read_termination = self._init.get('read_termination', None) self.write_te...
def init(self)
Initialize serial device. Parameters of serial.Serial: http://pyserial.sourceforge.net/pyserial_api.html Plus termination string parameter eol
3.443893
2.27935
1.51091
'''Initialize ADC ''' self._intf.write(self._base_addr + self.MAX11644_ADD, array('B', pack('B', flags | self.MAX11644_SETUP)))
def _setup_adc(self, flags)
Initialize ADC
12.430573
12.524244
0.992521
data = self._read_eeprom(self.CAL_DATA_ADDR, size=calcsize(self.CAL_DATA_GPAC_FORMAT)) for idx, channel in enumerate(self._ch_cal.iterkeys()): ch_data = data[idx * calcsize(self.CAL_DATA_CH_GPAC_FORMAT):(idx + 1) * calcsize(self.CAL_DATA_CH_GPAC_FORMAT)] values = ...
def read_eeprom_calibration(self): # use default values for temperature, EEPROM values are usually not calibrated and random '''Reading EEPROM calibration for sources and regulators ''' header = self.get_format() if header == self.HEADER_GPAC
Reading EEPROM calibration for sources and regulators
2.354744
2.345181
1.004078
'''Reading voltage ''' adc_ch = self._ch_map[channel]['ADCV']['adc_ch'] address = self._ch_map[channel]['ADCV']['address'] raw = self._get_adc_value(address=address)[adc_ch] dac_offset = self._ch_cal[channel]['ADCV']['offset'] dac_gain = self._ch_cal[channel]['AD...
def get_voltage(self, channel, unit='V')
Reading voltage
3.458099
3.384417
1.021771
'''Reading current ''' values = self._get_adc_value(address=self._ch_map[channel]['ADCI']['address']) raw = values[self._ch_map[channel]['ADCI']['adc_ch']] dac_offset = self._ch_cal[channel]['ADCI']['offset'] dac_gain = self._ch_cal[channel]['ADCI']['gain'] if 'P...
def get_current(self, channel, unit='A')
Reading current
2.566535
2.518448
1.019094
'''Enable/Disable output of power channel ''' try: bit = self._ch_map[channel]['GPIOEN']['bit'] except KeyError: raise ValueError('set_enable() not supported for channel %s' % channel) self._set_power_gpio_value(bit=bit, value=value)
def set_enable(self, channel, value)
Enable/Disable output of power channel
8.119631
6.748576
1.203162
'''Reading over current status of power channel ''' try: bit = self._ch_map[channel]['GPIOOC']['bit'] except KeyError: raise ValueError('get_over_current() not supported for channel %s' % channel) return not self._get_power_gpio_value(bit)
def get_over_current(self, channel)
Reading over current status of power channel
10.176256
7.92554
1.283983
'''Setting current limit Note: same limit for all channels. ''' # TODO: add units / calibration if unit == 'raw': value = value elif unit == 'A': value = int(value * 1000 * self.CURRENT_LIMIT_GAIN) elif unit == 'mA': value = in...
def set_current_limit(self, channel, value, unit='A')
Setting current limit Note: same limit for all channels.
4.348742
3.865375
1.12505
'''Setting current of current source ''' dac_offset = self._ch_cal[channel]['DAC']['offset'] dac_gain = self._ch_cal[channel]['DAC']['gain'] if unit == 'raw': value = value elif unit == 'A': value = int((-value * 1000000 - dac_offset) / dac_gain) ...
def set_current(self, channel, value, unit='A')
Setting current of current source
2.97823
2.824954
1.054258
q_d_f = 0 ''' fout = fref * (p_total / q_total) * (1 / div) p_total = 2 * ((p_counter + 4) + p_0) [16..1023] q_total = q_counter + 2 [2..129] div = [2,(3),4..127] constraints: f_ref * p_total / q_total = [100..400] MHz f_r...
def _calculateParameters(self, fout)
fout = fref * (p_total / q_total) * (1 / div) p_total = 2 * ((p_counter + 4) + p_0) [16..1023] q_total = q_counter + 2 [2..129] div = [2,(3),4..127] constraints: f_ref * p_total / q_total = [100..400] MHz f_ref / q_total > 0.25 MHz
3.324664
2.380946
1.396363
''' Initialize the device. Parameters of visa.ResourceManager().open_resource() ''' super(Visa, self).init() backend = self._init.get('backend', '') # Empty string means std. backend (NI VISA) rm = visa.ResourceManager(backend) try: logger.inf...
def init(self)
Initialize the device. Parameters of visa.ResourceManager().open_resource()
6.672321
5.314055
1.255599
''' Reading data in BRAM. Returns ------- array : numpy.ndarray Array of unsigned integers (32 bit). ''' fifo_int_size_1 = self.FIFO_INT_SIZE fifo_int_size_2 = self.FIFO_INT_SIZE if fifo_int_size_1 > fifo_int_size_2: fifo_int_size ...
def get_data(self)
Reading data in BRAM. Returns ------- array : numpy.ndarray Array of unsigned integers (32 bit).
4.181918
3.355338
1.246348
self.bus.RD_B <= 1 self.bus.ADD <= self._x self.bus.BUS_DATA <= self._high_impedence for _ in range(5): yield RisingEdge(self.clock) yield RisingEdge(self.clock) self.bus.ADD <= address + 0x4000 yield RisingEdge(self.clock) self.bus....
def read_external(self, address)
Copied from silusb.sv testbench interface
2.663103
2.596129
1.025798
self.bus.WR_B <= 1 self.bus.ADD <= self._x for _ in range(5): yield RisingEdge(self.clock) yield RisingEdge(self.clock) self.bus.ADD <= address + 0x4000 self.bus.BUS_DATA <= int(value) yield Timer(1) # This is hack for iverilog self...
def write_external(self, address, value)
Copied from silusb.sv testbench interface
2.110327
2.075956
1.016557
'''Initialize ADC ''' self._intf.write(self._base_addr + self.MAX_1239_ADD, array('B', pack('B', flags)))
def _setup_adc(self, flags)
Initialize ADC
16.941944
16.839325
1.006094
'''Read ADC ''' conf = self.SCAN_OFF | self.SINGLE_ENDED | ((0x1e) & (channel << 1)) self._intf.write(self._base_addr + self.MAX_1239_ADD, array('B', pack('B', conf))) def read_data(): ret = self._intf.read(self._base_addr + self.MAX_1239_ADD | 1, size=2) ...
def _get_adc_value(self, channel, average=None)
Read ADC
4.697688
4.695701
1.000423
'''Read EEPROM ''' self._intf.write(self._base_addr + self.CAL_EEPROM_ADD, array('B', pack('>H', address & 0x3FFF))) # 14-bit address, 16384 bytes n_pages, n_bytes = divmod(size, self.CAL_EEPROM_PAGE_SIZE) data = array('B') for _ in range(n_pages): data.exte...
def _read_eeprom(self, address, size)
Read EEPROM
2.977413
2.918365
1.020233
'''Setting default voltage ''' if not channels: channels = self._ch_cal.keys() for channel in channels: self.set_voltage(channel, self._ch_cal[channel]['default'], unit='V')
def set_default(self, channels=None)
Setting default voltage
5.594316
4.563143
1.225979
'''Reading voltage ''' kwargs = self._ch_map[channel]['ADCV'] voltage_raw = self._get_adc_value(**kwargs) voltage = (voltage_raw - self._ch_cal[channel]['ADCV']['offset']) / self._ch_cal[channel]['ADCV']['gain'] if unit == 'raw': return voltage_raw e...
def get_voltage(self, channel, unit='V')
Reading voltage
3.884186
3.749127
1.036024
'''Reading current ''' kwargs = self._ch_map[channel]['ADCI'] current_raw = self._get_adc_value(**kwargs) voltage = self.get_voltage(channel) current_raw_iq = current_raw - (self._ch_cal[channel]['ADCI']['iq_offset'] + self._ch_cal[channel]['ADCI']['iq_gain'] * voltage) ...
def get_current(self, channel, unit='A')
Reading current
3.225586
3.135879
1.028607
data = self._read_eeprom(self.CAL_DATA_ADDR, size=calcsize(self.CAL_DATA_V1_FORMAT)) for idx, channel in enumerate(self._ch_cal.iterkeys()): ch_data = data[idx * calcsize(self.CAL_DATA_CH_V1_FORMAT):(idx + 1) * calcsize(self.CAL_DATA_CH_V1_FORMAT)] values = unpack...
def read_eeprom_calibration(self, temperature=False): # use default values for temperature, EEPROM values are usually not calibrated and random '''Reading EEPROM calibration for power regulators and temperature ''' header = self.get_format() if header == self.HEADER_V1
Reading EEPROM calibration for power regulators and temperature
2.109205
2.096719
1.005955
'''Reading temperature ''' # NTC type SEMITEC 103KT1608 http://www.semitec.co.jp/english/products/pdf/KT_Thermistor.pdf # # R_NTC = R_25 * exp(B_NTC * (1/T - 1/T_25)) # # R_NTC measured NTC resistance # R_NTC_25 resistance @ 25C # B_NTC temperature ...
def get_temperature(self, channel, sensor='VNTC')
Reading temperature
4.402864
4.384647
1.004155
def convert_data_array(arr, filter_func=None, converter_func=None): '''Filter and convert any given data array of any dtype. Parameters ---------- arr : numpy.array Data array of any dtype. filter_func : function Function that takes array and returns true or false for each i...
Filter and convert any given data array of any dtype. Parameters ---------- arr : numpy.array Data array of any dtype. filter_func : function Function that takes array and returns true or false for each item in array. converter_func : function Function that takes ar...
null
null
null
def logical_and(f1, f2): # function factory '''Logical and from functions. Parameters ---------- f1, f2 : function Function that takes array and returns true or false for each item in array. Returns ------- Function Examples -------- filter_func=logical_...
Logical and from functions. Parameters ---------- f1, f2 : function Function that takes array and returns true or false for each item in array. Returns ------- Function Examples -------- filter_func=logical_and(is_data_record, is_data_from_channel(4)) # new f...
null
null
null
def logical_or(f1, f2): # function factory '''Logical or from functions. Parameters ---------- f1, f2 : function Function that takes array and returns true or false for each item in array. Returns ------- Function ''' def f_or(arr): return np.logical_o...
Logical or from functions. Parameters ---------- f1, f2 : function Function that takes array and returns true or false for each item in array. Returns ------- Function
null
null
null
def logical_not(f): # function factory '''Logical not from functions. Parameters ---------- f1, f2 : function Function that takes array and returns true or false for each item in array. Returns ------- Function ''' def f_not(arr): return np.logical_not...
Logical not from functions. Parameters ---------- f1, f2 : function Function that takes array and returns true or false for each item in array. Returns ------- Function
null
null
null
def logical_xor(f1, f2): # function factory '''Logical xor from functions. Parameters ---------- f1, f2 : function Function that takes array and returns true or false for each item in array. Returns ------- Function ''' def f_xor(arr): return np.logica...
Logical xor from functions. Parameters ---------- f1, f2 : function Function that takes array and returns true or false for each item in array. Returns ------- Function
null
null
null
def arr_select(value): # function factory '''Selecting array elements by bitwise and comparison to a given value. Parameters: value : int Value to which array elements are compared to. Returns: array : np.array ''' def f_eq(arr): return np.equal(np.bitwise_and(a...
Selecting array elements by bitwise and comparison to a given value. Parameters: value : int Value to which array elements are compared to. Returns: array : np.array
null
null
null
def arr_astype(arr_type): # function factory '''Change dtype of array. Parameters: arr_type : str, np.dtype Character codes (e.g. 'b', '>H'), type strings (e.g. 'i4', 'f8'), Python types (e.g. float, int) and numpy dtypes (e.g. np.uint32) are allowed. Returns: array : np.array ...
Change dtype of array. Parameters: arr_type : str, np.dtype Character codes (e.g. 'b', '>H'), type strings (e.g. 'i4', 'f8'), Python types (e.g. float, int) and numpy dtypes (e.g. np.uint32) are allowed. Returns: array : np.array
null
null
null
assert isinstance(obj, ProtocolBase) string = pickle.dumps(obj) length = len(string) self.sock.sendall(struct.pack("<I", length) + string)
def send(self, obj)
Prepend a 4-byte length to the string
4.066068
4.060127
1.001463
length = struct.unpack("<I", self.sock.recv(4))[0] return self._get_next_obj(length)
def recv(self, blocking=True)
Receive the next object from the socket
6.225574
4.983139
1.249328
try: lenstr = self.sock.recv(4, socket.MSG_DONTWAIT) except socket.error: return None if len(lenstr) < 4: raise EOFError("Socket closed") length = struct.unpack("<I", lenstr)[0] return self._get_next_obj(length)
def try_recv(self)
Return None immediately if nothing is waiting
3.200877
3.229785
0.99105
data = b'' while len(data) < length: data += self.sock.recv(length - len(data)) return pickle.loads(data)
def _get_next_obj(self, length)
Assumes we've already read the object length
3.012752
2.480268
1.214688
'''Getting modules by type name. Parameters ---------- type_name : string Type name of the modules to be returned. Returns ------- List of modules of given type name else empty list. ''' modules = [] for module in self: ...
def get_modules(self, type_name)
Getting modules by type name. Parameters ---------- type_name : string Type name of the modules to be returned. Returns ------- List of modules of given type name else empty list.
3.244356
1.925458
1.684979
'''Read response to command and convert it to 16-bit integer. Returns : list of values ''' self.write(command) time.sleep(0.1) return self.read()
def ask(self, command)
Read response to command and convert it to 16-bit integer. Returns : list of values
8.041972
2.999694
2.680931
if isinstance(channel, str): cmd = "OPALL %d" % int(on) elif isinstance(channel, int): cmd = "OP%d %d" % (channel, int(on)) self.write(cmd)
def set_enable(self, on, channel=1)
channel: 1=OP1, 2=OP2, 3=AUX, ALL=all channels
3.616395
3.067724
1.178853
ret = self.ask("I%dO?" % channel) if ret[-1] != "A": print("ttiQl355tp.get_current() format error", ret) return None return float(ret[:-1])
def get_current(self, channel)
channel: 1=OP1, 2=OP2, AUX is not supported
13.145668
12.10553
1.085923
ret = self.ask("V%dO?" % channel) if ret[-1] != "V": print("ttiQl355tp.get_voltage() format error", ret) return None return float(ret[:-1])
def get_voltage(self, channel)
channel: 1=OP1, 2=OP2, AUX is not supported
11.365613
10.637447
1.068453
ret = self.ask("V%d?" % channel) if ret[:3] != "V%d " % channel: print("ttiQl355tp.get_voltage() format error", ret) return None return float(ret[3:])
def get_set_voltage(self, channel)
channel: 1=OP1, 2=OP2, AUX is not supported
10.287136
9.548592
1.077346
ret = self.ask("I%d?" % channel) if ret[:3] != "I%d " % channel: print("ttiQl355tp.get_current_limit() format error", ret) return None return float(ret[3:])
def get_current_limit(self, channel)
channel: 1=OP1, 2=OP2, AUX is not supported
9.928011
8.91201
1.114004
cmd = "V%d %f" % (channel, value) self.write(cmd)
def set_voltage(self, value, channel=1)
channel: 1=OP1, 2=OP2, AUX is not supported
4.982796
4.869675
1.02323
cmd = "I%d %f" % (channel, value) self.write(cmd)
def set_current_limit(self, value, channel=1)
channel: 1=OP1, 2=OP2, AUX is not supported
6.16416
6.221117
0.990845
'''Determine the ready state of the device and wait until device is ready. Parameters ---------- timeout : int, float The maximum amount of time to wait in seconds. Reaching the timeout will raise a RuntimeError. times : int Maximum number of times readin...
def wait_for_ready(self, timeout=None, times=None, delay=None, delay_between=None, abort=None)
Determine the ready state of the device and wait until device is ready. Parameters ---------- timeout : int, float The maximum amount of time to wait in seconds. Reaching the timeout will raise a RuntimeError. times : int Maximum number of times reading the ready...
3.609323
2.1273
1.696669
'''Write DAC ''' self._intf.write(self._base_addr + self.MAX_5380_ADD, array('B', pack('B', value)))
def _set_dac_value(self, channel, value)
Write DAC
19.642979
16.562611
1.185983
'''Write DAC ''' # DAC value cannot be -128 if value == -128: value = -127 if value < 0: sign = 1 else: sign = 0 value = (sign << 7) | (0x7F & abs(value)) self._intf.write(self._base_addr + self.DS_4424_ADD, array('B', p...
def _set_dac_value(self, channel, value)
Write DAC
5.627642
5.357318
1.050459
data = self._read_eeprom(self.CAL_DATA_ADDR, size=calcsize(self.CAL_DATA_V2_FORMAT)) for idx, channel in enumerate(self._ch_cal.iterkeys()): ch_data = data[idx * calcsize(self.CAL_DATA_CH_V2_FORMAT):(idx + 1) * calcsize(self.CAL_DATA_CH_V2_FORMAT)] values = unpack...
def read_eeprom_calibration(self, temperature=False): # use default values for temperature, EEPROM values are usually not calibrated and random '''Reading EEPROM calibration for power regulators and temperature ''' header = self.get_format() if header == self.HEADER_V2
Reading EEPROM calibration for power regulators and temperature
2.086566
2.073246
1.006425
'''Setting current limit Note: same limit for all channels. ''' dac_offset = self._ch_cal[channel]['DACI']['offset'] dac_gain = self._ch_cal[channel]['DACI']['gain'] if unit == 'raw': value = value elif unit == 'A': value = int((value - d...
def set_current_limit(self, channel, value, unit='A')
Setting current limit Note: same limit for all channels.
3.95143
3.469574
1.13888
self._sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self._sock.connect((self.simulation_host, self.simulation_port)) self._iface = PickleInterface(self._sock) return True
def DownloadXilinx(self, bitfile)
We hijack this call to perform the socket connect
4.454513
3.662002
1.216415
''' Move chuck to absolute position in um''' if speed: self._intf.write('MoveChuckSubsite %1.1f %1.1f R Y %d' % (x, y, speed)) else: self._intf.write('MoveChuckSubsite %1.1f %1.1f R Y' % (x, y))
def set_position(self, x, y, speed=None)
Move chuck to absolute position in um
5.598204
4.128745
1.355909
''' Move chuck relative to actual position in um''' if speed: self._intf.write('MoveChuckPosition %1.1f %1.1f R Y %d' % (dx, dy, speed)) else: self._intf.write('MoveChuckPosition %1.1f %1.1f R Y' % (dx, dy))
def move_position(self, dx, dy, speed=None)
Move chuck relative to actual position in um
5.100121
3.406385
1.497224
''' Read chuck position (x, y, z)''' reply = self._intf.query('ReadChuckPosition Y H')[2:] return [float(i) for i in reply.split()]
def get_position(self)
Read chuck position (x, y, z)
15.936893
8.614533
1.850001
''' Move chuck to wafer map chip index''' reply = self._intf.query('ReadMapPosition') values = reply[2:].split(' ') return (int(values[0]), int(values[1]))
def get_die(self)
Move chuck to wafer map chip index
20.937895
6.806087
3.076348
'Clear tracks in memory - all zero' for track in self._tracks: self._tracks[track].setall(False)
def clear(self)
Clear tracks in memory - all zero
20.090542
7.151941
2.809103
''' Reading data from SiTCP FIFO (via TCP). Returns ------- array : numpy.ndarray Array of unsigned integers (32 bit). ''' fifo_size = self._intf._get_tcp_data_size() fifo_int_size = int((fifo_size - (fifo_size % 4)) / 4) data = self._intf._ge...
def get_data(self)
Reading data from SiTCP FIFO (via TCP). Returns ------- array : numpy.ndarray Array of unsigned integers (32 bit).
5.646588
3.08537
1.830117
''' Sending data to via TCP. Parameters ---------- data : array Array of unsigned integers (32 bit). ''' data = array.array('B', struct.unpack("{}B".format(len(data) * 4), struct.pack("{}I".format(len(data)), *data))) self._intf._send_tcp_data(data)
def set_data(self, data)
Sending data to via TCP. Parameters ---------- data : array Array of unsigned integers (32 bit).
6.342872
3.89448
1.628683
self._clear_strobes() gr_size = len(self['GLOBAL_REG'][:]) # get the size self['SEQ']['SHIFT_IN'][0:gr_size] = self['GLOBAL_REG'][:] # this will be shifted out self['SEQ']['GLOBAL_SHIFT_EN'][0:gr_size] = bitarray(gr_size * '1') # this is to enable clock self['SEQ'][...
def program_global_reg(self)
Send the global register to the chip. Loads the values of self['GLOBAL_REG'] onto the chip. Includes enabling the clock, and loading the Control (CTR) and DAC shadow registers.
7.60861
6.109038
1.245468
self._clear_strobes() # enable receiver it work only if pixel register is enabled/clocked self['PIXEL_RX'].set_en(enable_receiver) px_size = len(self['PIXEL_REG'][:]) # get the size self['SEQ']['SHIFT_IN'][0:px_size] = self['PIXEL_REG'][:] # this will be shifted out...
def program_pixel_reg(self, enable_receiver=True)
Send the pixel register to the chip and store the output. Loads the values of self['PIXEL_REG'] onto the chip. Includes enabling the clock, and loading the Control (CTR) and DAC shadow registers. if(enable_receiver), stores the output (by byte) in self['DATA'], retrievable via ...
9.827022
9.03128
1.08811
# Write the sequence to the sequence generator (hw driver) self['SEQ'].write(size) # write pattern to memory self['SEQ'].set_size(size) # set size self['SEQ'].set_repeat(1) # set repeat self['SEQ'].start() # start while not self['SEQ'].get_done(): ...
def _run_seq(self, size)
Send the contents of self['SEQ'] to the chip and wait until it finishes.
5.944578
4.629991
1.283929
def write(self, addr, data): '''Write access. :param addr: i2c slave address :type addr: char :param data: array/list of bytes :type data: iterable :rtype: None ''' self.set_addr(addr & 0xfe) self.set_data(data) self.set_size(...
Write access. :param addr: i2c slave address :type addr: char :param data: array/list of bytes :type data: iterable :rtype: None
null
null
null
def read(self, addr, size): '''Read access. :param addr: i2c slave address :type addr: char :param size: size of transfer :type size: int :returns: data byte array :rtype: array.array('B') ''' self.set_addr(addr | 0x01) self.s...
Read access. :param addr: i2c slave address :type addr: char :param size: size of transfer :type size: int :returns: data byte array :rtype: array.array('B')
null
null
null
global _full_parser if _full_parser: return _full_parser luigi_parser = luigi.cmdline_parser.CmdlineParser.get_instance() if not luigi_parser: return None # build the full argument parser with luigi helpers root_task = luigi_parser.known_args.root_task _full_parser = ...
def full_parser()
Returns the full *ArgumentParser* used by the luigi ``CmdlineParser``. The returned instance is cached.
3.807879
3.508128
1.085445
global _root_task_parser if _root_task_parser: return _root_task_parser luigi_parser = luigi.cmdline_parser.CmdlineParser.get_instance() if not luigi_parser: return None root_task = luigi_parser.known_args.root_task # get all root task parameter destinations root_des...
def root_task_parser()
Returns a new *ArgumentParser* instance that only contains paremeter actions of the root task. The returned instance is cached.
3.114275
2.926191
1.064276
global _global_cmdline_args if _global_cmdline_args: return _global_cmdline_args luigi_parser = luigi.cmdline_parser.CmdlineParser.get_instance() if not luigi_parser: return None _global_cmdline_args = root_task_parser().parse_known_args(luigi_parser.cmdline_args)[1] ret...
def global_cmdline_args()
Returns the list of command line arguments that do not belong to the root task. The returned list is cached. Example: .. code-block:: python global_cmdline_args() # -> ["--local-scheduler"]
3.28628
3.669453
0.895578
global _global_cmdline_values if _global_cmdline_values: return _global_cmdline_values luigi_parser = luigi.cmdline_parser.CmdlineParser.get_instance() if not luigi_parser: return None # go through all actions of the full luigi parser and compare option strings # with the...
def global_cmdline_values()
Returns a dictionary of global command line arguments (computed with :py:func:`global_cmdline_args`) to their current values. The returnd dictionary is cached. Example: .. code-block:: python global_cmdline_values() # -> {"core_local_scheduler": True}
3.228689
3.584693
0.900688
if arg not in args: args = list(args) + [arg] + list(values) return args
def add_cmdline_arg(args, arg, *values)
Adds a command line argument *arg* to a list of argument *args*, e.g. as returned from :py:func:`global_cmdline_args`. When *arg* exists, *args* is returned unchanged. Otherwise, *arg* is appended to the end with optional argument *values*. Example: .. code-block:: python args = global_cmdline_val...
3.320477
5.29269
0.62737
if arg in args: idx = args.index(arg) args = list(args) del args[idx:idx + max(n, 1)] return args
def remove_cmdline_arg(args, arg, n=1)
Removes the command line argument *args* from a list of arguments *args*, e.g. as returned from :py:func:`global_cmdline_args`. When *n* is 1 or less, only the argument is removed. Otherwise, the following *n-1* values are removed. Example: .. code-block:: python args = global_cmdline_values() ...
2.741941
3.580343
0.765832
skip = make_list(skip) if skip else [] transfer_kwargs = { name: kwargs.pop(name) for name in ["cache", "prefer_cache", "retries", "retry_delay"] if name in kwargs and name not in skip } return transfer_kwargs, kwargs
def split_transfer_kwargs(kwargs, skip=None)
Takes keyword arguments *kwargs*, splits them into two separate dictionaries depending on their content, and returns them in a tuple. The first one will contain arguments related to potential file transfer operations (e.g. ``"cache"`` or ``"retries"``), while the second one will contain all remaining argume...
4.036435
4.486943
0.899596
return dict(job_id=job_id, branches=branches or [])
def job_data(cls, job_id=dummy_job_id, branches=None, **kwargs)
Returns a dictionary containing default job submission information such as the *job_id* and task *branches* covered by the job.
4.990068
4.729575
1.055077
return dict(job_id=job_id, status=status, code=code, error=error)
def job_data(cls, job_id=dummy_job_id, status=None, code=None, error=None, **kwargs)
Returns a dictionary containing default job status information such as the *job_id*, a job *status* string, a job return code, and an *error* message.
2.700625
2.587208
1.043838
attr = "{}_{}".format(self.workflow_type, name) if not fallback: return getattr(self.task, attr) else: value = getattr(self.task, attr, no_value) return value if value != no_value else getattr(self.task, name)
def _get_task_attribute(self, name, fallback=False)
Return an attribute of the actial task named ``<workflow_type>_<name>``. When the attribute does not exist and *fallback* is *True*, try to return the task attribute simply named *name*. In any case, if a requested task attribute is eventually not found, an AttributeError is raised.
3.248037
2.769601
1.172745
task = self.task # get the directory where the control outputs are stored out_dir = self._get_task_attribute("output_directory")() # define outputs outputs = OrderedDict() postfix = self._get_task_attribute("output_postfix")() # a file containing the s...
def output(self)
Returns the default workflow outputs in an ordered dictionary. At the moment, this is the collection of outputs of the branch tasks (key ``"collection"``), the submission file (key ``"submission"``), and the status file (key ``"status"``). These two *control outputs* are optional, i.e., they are...
5.490766
4.891549
1.1225