text
stringlengths 0
828
|
|---|
try:
|
color = axis._get_lines.color_cycle.next()
|
except: # make compatible with matplotlib v1.5
|
color = axis._get_lines.prop_cycler.next()['color']
|
F = feedback_params.loc[resistor_index]
|
# Broadcast values in case sympy function simplifies to scalar value.
|
values = np.empty_like(x['frequency'])
|
values[:] = compute_from_transfer_function(hw_major_version, 'V2',
|
V1=1., R1=R1,
|
R2=F['original R'],
|
C2=F['original C'],
|
f=x['frequency'])
|
axis.loglog(x['frequency'], values, color=color, linestyle='--',
|
label='R$_{%d}$ (previous fit)' % resistor_index)
|
values[:] = compute_from_transfer_function(hw_major_version, 'V2',
|
V1=1., R1=R1,
|
R2=F['fitted R'],
|
C2=F['fitted C'],
|
f=x['frequency'])
|
axis.loglog(x['frequency'], values, color=color, linestyle='-',
|
alpha=0.6, label='R$_{%d}$ (new fit)' % resistor_index)
|
attenuation = x['board measured V'] / x['oscope measured V']
|
axis.plot(x['frequency'], attenuation, color='none',
|
marker=markers[resistor_index % len(markers)],
|
label='R$_{%d}$ (scope measured)' % resistor_index,
|
linestyle='none', markeredgecolor=color, markeredgewidth=2,
|
markersize=8)
|
return 0
|
map(plot_resistor_params, max_resistor_readings.groupby('resistor index'))
|
legend = axis.legend(ncol=3)
|
legend.draw_frame(False)
|
axis.set_xlabel('Frequency (Hz)')
|
axis.set_ylabel(r'$\frac{V_{BOARD}}'
|
r'{V_{SCOPE}}$', fontsize=25)"
|
593,"def update_control_board_calibration(control_board, fitted_params):
|
'''
|
Update the control board with the specified fitted parameters.
|
'''
|
# Update the control board with the new fitted capacitor and resistor
|
# values for the reference load analog input (channel 0).
|
control_board.a0_series_resistance = fitted_params['fitted R'].values
|
control_board.a0_series_capacitance = fitted_params['fitted C'].values"
|
594,"def load(self):
|
"""""" Load each path in order. Remember paths already loaded and only load new ones. """"""
|
data = self.dict_class()
|
for path in self.paths:
|
if path in self.paths_loaded: continue
|
try:
|
with open(path, 'r') as file:
|
path_data = yaml.load(file.read())
|
data = dict_merge(data, path_data)
|
self.paths_loaded.add(path)
|
except IOError:
|
# TODO: Log this correctly once logging is implemented
|
if not path.endswith('.local.yml'):
|
print 'CONFIG NOT FOUND: %s' % (path)
|
self.data = data"
|
595,"def _initialize(self, settings_module):
|
""""""
|
Initialize the settings from a given settings_module
|
settings_module - path to settings module
|
""""""
|
#Get the global settings values and assign them as self attributes
|
self.settings_list = []
|
for setting in dir(global_settings):
|
#Only get upper case settings
|
if setting == setting.upper():
|
setattr(self, setting, getattr(global_settings, setting))
|
self.settings_list.append(setting)
|
#If a settings module was passed in, import it, and grab settings from it
|
#Overwrite global settings with theses
|
if settings_module is not None:
|
self.SETTINGS_MODULE = settings_module
|
#Try to import the settings module
|
try:
|
mod = import_module(self.SETTINGS_MODULE)
|
except ImportError:
|
error_message = ""Could not import settings at {0}"".format(self.SETTINGS_MODULE)
|
log.exception(error_message)
|
raise ImportError(error_message)
|
#Grab uppercased settings as set them as self attrs
|
for setting in dir(mod):
|
if setting == setting.upper():
|
if setting == ""INSTALLED_APPS"":
|
self.INSTALLED_APPS += getattr(mod, setting)
|
else:
|
setattr(self, setting, getattr(mod, setting))
|
self.settings_list.append(setting)
|
#If PATH_SETTINGS is in the settings file, extend the system path to include it
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.