text stringlengths 0 828 |
|---|
''' |
Apply calibration values from `fit_fb_calibration` result to `calibration` |
object. |
''' |
from dmf_control_board_firmware import FeedbackResults |
for i, (fb_resistor, R_fb, C_fb) in calibration_df[['fb_resistor', 'R_fb', 'C_fb']].iterrows(): |
calibration.R_fb[int(fb_resistor)] = R_fb |
calibration.C_fb[int(fb_resistor)] = C_fb |
cleaned_df = df.dropna() |
grouped = cleaned_df.groupby(['frequency', 'test_capacitor', 'repeat_index']) |
for (f, channel, repeat_index), group in grouped: |
r = FeedbackResults(group.V_actuation.iloc[0], f, 5.0, |
group.V_hv.values, group.hv_resistor.values, |
group.V_fb.values, group.fb_resistor.values, |
calibration) |
# Update the measured capacitance values based on the updated |
# calibration model. |
df.loc[group.index, 'C'] = r.capacitance()" |
1440,"def config_dict(config): |
"""""" |
Given a Sphinx config object, return a dictionary of config |
values. |
"""""" |
return dict( |
(key, getattr(config, key)) |
for key in config.values |
)" |
1441,"def from_defn(cls, defn): |
""Return the first Repl subclass that works with this"" |
instances = (subcl(defn) for subcl in cls.__subclasses__()) |
return next(filter(None, instances))" |
1442,"def from_definition(cls, defn, names={}): |
"""""" |
A definition may contain the following members: |
- using: a dictionary of variables available for substitution |
- replace: a list of replacement definitions. |
"""""" |
repls = map(Repl.from_defn, defn.get('replace', [])) |
self = cls(repls) |
vars(self).update(names) |
vars(self).update(defn.get('using', {})) |
return self" |
1443,"def data(self, index, role=Qt.DisplayRole): |
""""""Cell content"""""" |
if not index.isValid(): |
return None |
if role == Qt.DisplayRole or role == Qt.EditRole: |
return ' ' |
if role == Qt.BackgroundColorRole: |
color = self.color_da[index.row(), index.column()].values |
return QtGui.QColor.fromRgbF(*color) |
return None" |
1444,"def headerData(self, section, orientation, role=Qt.DisplayRole): |
""""""Set header data"""""" |
if role != Qt.DisplayRole: |
return None |
if orientation == Qt.Vertical: |
return six.text_type(self.color_da.cmap[section].values) |
return super(ColormapModel, self).headerData(section, orientation, |
role)" |
1445,"def get_colormap(cls, names=[], N=10, *args, **kwargs): |
""""""Open a :class:`ColormapDialog` and get a colormap |
Parameters |
---------- |
%(ColormapModel.parameters)s |
Other Parameters |
---------------- |
``*args, **kwargs`` |
Anything else that is passed to the ColormapDialog |
Returns |
------- |
str or matplotlib.colors.Colormap |
Either the name of a standard colormap available via |
:func:`psy_simple.colors.get_cmap` or a colormap |
"""""" |
names = safe_list(names) |
obj = cls(names, N, *args, **kwargs) |
vbox = obj.layout() |
buttons = QDialogButtonBox( |
QDialogButtonBox.Ok | QDialogButtonBox.Cancel, parent=obj) |
buttons.button(QDialogButtonBox.Ok).setEnabled(False) |
vbox.addWidget(buttons) |
buttons.accepted.connect(obj.accept) |
buttons.rejected.connect(obj.reject) |
obj.table.selectionModel().selectionChanged.connect( |
lambda indices: buttons.button(QDialogButtonBox.Ok).setEnabled( |
bool(indices))) |
accepted = obj.exec_() |
if accepted: |
return obj.table.chosen_colormap" |
1446,"def show_colormap(cls, names=[], N=10, show=True, *args, **kwargs): |
""""""Show a colormap dialog |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.