text stringlengths 0 828 |
|---|
nbytes *= count |
# Read enough bytes starting at specified address to match the |
# requested number of the specified data type. |
data_bytes = np.array([self.persistent_read(address + i) |
for i in xrange(nbytes)], dtype=np.uint8) |
# Cast byte array as array of specified data type. |
result = data_bytes.view(dtype) |
# If no count was specified, we return a scalar value rather than the |
# resultant array. |
if count is None: |
return result[0] |
return result" |
966,"def persistent_write_multibyte(self, address, data, refresh_config=False): |
''' |
Write multiple bytes to an address in persistent memory. |
Parameters |
---------- |
address : int |
Address in persistent memory (e.g., EEPROM). |
data : numpy.array |
Data to write. |
refresh_config : bool, optional |
Is ``True``, :meth:`load_config()` is called afterward to refresh |
the configuration settings. |
''' |
for i, byte in enumerate(data.view(np.uint8)): |
self.persistent_write(address + i, int(byte)) |
if refresh_config: |
self.load_config(False)" |
967,"def measure_impedance(self, sampling_window_ms, n_sampling_windows, |
delay_between_windows_ms, interleave_samples, rms, |
state): |
''' |
Measure voltage across load of each of the following control board |
feedback circuits: |
- Reference _(i.e., attenuated high-voltage amplifier output)_. |
- Load _(i.e., voltage across DMF device)_. |
The measured voltage _(i.e., ``V2``)_ can be used to compute the |
impedance of the measured load, the input voltage _(i.e., ``V1``)_, |
etc. |
Parameters |
---------- |
sampling_window_ms : float |
Length of sampling window (in milleseconds) for each |
RMS/peak-to-peak voltage measurement. |
n_sampling_windows : int |
Number of RMS/peak-to-peak voltage measurements to take. |
delay_between_windows_ms : float |
Delay (in milleseconds) between RMS/peak-to-peak voltage |
measurements. |
interleave_samples : bool |
If ``True``, interleave RMS/peak-to-peak measurements for analog |
channels. |
For example, ``[<i_0>, <j_0>, <i_1>, <j_1>, ..., <i_n>, <j_n>]`` |
where ``i`` and ``j`` correspond to two different analog channels. |
If ``False``, all measurements for each analog channel are taken |
together. For example, ``[<i_0>, ..., <i_n>, <j_0>, ..., <j_n>]`` |
where ``i`` and ``j`` correspond to two different analog channels. |
rms : bool |
If ``True``, a RMS voltage measurement is collected for each |
sampling window. |
Otherwise, peak-to-peak measurements are collected. |
state : list |
State of device channels. Length should be equal to the number of |
device channels. |
Returns |
------- |
:class:`FeedbackResults` |
''' |
state_ = uint8_tVector() |
for i in range(0, len(state)): |
state_.append(int(state[i])) |
buffer = np.array(Base.measure_impedance(self, |
sampling_window_ms, |
n_sampling_windows, |
delay_between_windows_ms, |
interleave_samples, |
rms, |
state_)) |
return self.measure_impedance_buffer_to_feedback_result(buffer)" |
968,"def sweep_channels(self, |
sampling_window_ms, |
n_sampling_windows_per_channel, |
delay_between_windows_ms, |
interleave_samples, |
rms, |
channel_mask): |
''' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.