Package qubx_mac :: Module rates :: Class RatesFace
[hide private]
[frames] | no frames]

Class RatesFace

source code

        object --+                                    
                 |                                    
        ??.GObject --+                                
                     |                                
            gtk.Object --+                            
                         |                            
        object --+       |                            
                 |       |                            
gobject.GInterface --+   |                            
                     |   |                            
  atk.ImplementorIface --+                            
                         |                            
        object --+       |                            
                 |       |                            
gobject.GInterface --+   |                            
                     |   |                            
         gtk.Buildable --+                            
                         |                            
                gtk.Widget --+                        
                             |                        
                 gtk.Container --+                    
                                 |                    
                object --+       |                    
                         |       |                    
        gobject.GInterface --+   |                    
                             |   |                    
                gtk.Orientable --+                    
                                 |                    
                           gtk.Box --+                
                                     |                
                              gtk.VBox --+            
                                         |            
                           qubx.faces.Face --+        
                                             |        
                        qubx_plugin.ToolPlugin --+    
                                                 |    
                         qubx_plugin.OptToolPlugin --+
                                                     |
                                        object --+   |
                                                 |   |
                      qubx.settings.PropertiedBase --+
                                                     |
                                                    RatesFace

Calculates log-likelihood and optimizes model parameters, a la Milescu 2005.

Instance Methods [hide private]
 
__init__(self, name='MacRates', global_name='QubX.Modeling.MacRates')
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
mac_finalize(self)
Stops the worker threads; call this in qubx_plugin_fini.
source code
 
on_exception(self, robot, typ, val, trace)
Override this method to do something with exceptions thrown on robot thread; default: print to stdout.
source code
 
__onWriteStatus(self, msg) source code
 
propertied_set(self, value, name) source code
 
__onInvalidateRates(self, prod) source code
 
invalidate_controls(self, gray=True)
Changes LL text color gray (outdated) or black (up-to-date), and starts computation if showing in live mode.
source code
 
__queue_robot_live(self) source code
 
__sensitize(self, sens) source code
 
on_robot_begin(self)
Override this method to respond when the robot starts working.
source code
 
on_robot_end(self)
Override this method to respond when the robot finishes working.
source code
 
fitbot_send_datapic(self, auto_id) source code
 
get_ndata(self, data_prep=None)
Override to tell how many datapoints/events used, for Trials.
source code
 
__onChangeModelGroup(self) source code
 
__onChangeModelGroupRates(self) source code
 
__get_rates(self) source code
 
add_trial_fields(self, row, mtree, prefix='', model_prep=None, data_prep=None)
Override to pick info from the model.
source code
 
__onGotLL(self, LL) source code
 
calculate_score(self, model_prep=None, data_prep=None, wait=True, receiver=<__builtin__.function object>, on_trial=None, **kw)
Starts the robot calculating the score.
source code
 
optimize(self, model_prep=None, data_prep=None, wait=True, receiver=None, ext_return=False, on_trial=None)
Starts the robot optimizing.
source code
 
__onOptDone(self, LL, iterations, grads, Hessian, workspaces, model_prep, data_prep) source code
 
__set_model_confidence(self, ws, model_prep) source code
 
__onIteration(self, iteration, LL, grads, optNchannel, workspaces, modelinfo, K0s, K1s, K2s, amps, stds, amp0s, std0s, Nchannels) source code
 
on_interrupt(self, task, cancel)
Override this method to customize the effect of the Stop button (e.g.
source code
 
get_model_prep(self, model=None) source code
 
request_data_prep(self, receiver, segs, model_prep, last_data_prep=None, resample=None, resample_std=None) source code
 
__onGPUFail(self) source code
 
wait_for_fits(self)
Waits until all pending work is done on the thread which updates fit curves, then returns.
source code
 
__capture_robot_settings(self)
Should happen at the same time the modelprep is captured, e.g.
source code
 
robot_setup(self) source code
 
robot_live(self, model_prep=None) source code
 
robot_calculate_score(self, grads=None)
Calculates and returns the score, on worker thread; override this method.
source code
 
robot_get_pars(self)
Returns the list of initial parameter values, on worker thread; override this method.
source code
 
robot_set_pars(self, pars)
Updates self.robot.model_prep.model and/or other state from new param values, on worker thread; override this method.
source code
 
robot_optimize(self)
Finds improved param values, starting from robot_get_pars(); override if you don't want the built-in optimizers.
source code
 
robot_on_iteration(self, pars, grads, iterations, score)
Responds to a completed iteration; override this function to send model params etc back to gui.
source code
 
robot_queue_fits(self, iteration=0, force=False) source code
 
robot_on_status(self, s) source code
 
fitbot_set_fits(self, datafile, iSignal, chunks, serial) source code
 
do_set_fits(self, datafile, iSignal, chunks) source code

Inherited from qubx_plugin.OptToolPlugin: add_to_trials, append_output, clear_output, get_data_prep, make_trial, onShow, robot_setup_data, set_score, update_score

Inherited from qubx.faces.Face: request_show, set_parent_window, set_pop_prefs, set_showing

Inherited from gtk.VBox: __iter__

Inherited from gtk.Box: get_homogeneous, get_spacing, pack_end, pack_end_defaults, pack_start, pack_start_defaults, query_child_packing, reorder_child, set_child_packing, set_homogeneous, set_spacing

Inherited from gtk.Container: __len__, __nonzero__, add, add_with_properties, check_resize, child_get, child_get_property, child_set, child_set_property, child_type, children, do_add, do_check_resize, do_child_type, do_composite_name, do_forall, do_get_child_property, do_remove, do_set_child_property, do_set_focus_child, forall, foreach, get_border_width, get_children, get_focus_chain, get_focus_child, get_focus_hadjustment, get_focus_vadjustment, get_resize_mode, install_child_property, list_child_properties, propagate_expose, remove, resize_children, set_border_width, set_focus_chain, set_focus_child, set_focus_hadjustment, set_focus_vadjustment, set_reallocate_redraws, set_resize_mode, unset_focus_chain

Inherited from gtk.Widget: activate, add_accelerator, add_events, add_mnemonic_label, can_activate_accel, child_focus, child_notify, class_path, create_pango_context, create_pango_layout, destroy, do_button_press_event, do_button_release_event, do_can_activate_accel, do_client_event, do_composited_changed, do_configure_event, do_delete_event, do_destroy_event, do_direction_changed, do_drag_begin, do_drag_data_delete, do_drag_data_get, do_drag_data_received, do_drag_drop, do_drag_end, do_drag_leave, do_drag_motion, do_enter_notify_event, do_event, do_expose_event, do_focus, do_focus_in_event, do_focus_out_event, do_get_accessible, do_grab_broken_event, do_grab_focus, do_grab_notify, do_hide, do_hide_all, do_hierarchy_changed, do_key_press_event, do_key_release_event, do_leave_notify_event, do_map, do_map_event, do_mnemonic_activate, do_motion_notify_event, do_no_expose_event, do_parent_set, do_popup_menu, do_property_notify_event, do_proximity_in_event, do_proximity_out_event, do_realize, do_screen_changed, do_scroll_event, do_selection_clear_event, do_selection_get, do_selection_notify_event, do_selection_received, do_selection_request_event, do_show, do_show_all, do_show_help, do_size_allocate, do_size_request, do_state_changed, do_style_set, do_unmap, do_unmap_event, do_unrealize, do_visibility_notify_event, do_window_state_event, drag_begin, drag_check_threshold, drag_dest_add_image_targets, drag_dest_add_text_targets, drag_dest_add_uri_targets, drag_dest_find_target, drag_dest_get_target_list, drag_dest_get_track_motion, drag_dest_set, drag_dest_set_proxy, drag_dest_set_target_list, drag_dest_set_track_motion, drag_dest_unset, drag_get_data, drag_highlight, drag_source_add_image_targets, drag_source_add_text_targets, drag_source_add_uri_targets, drag_source_get_target_list, drag_source_set, drag_source_set_icon, drag_source_set_icon_name, drag_source_set_icon_pixbuf, drag_source_set_icon_stock, drag_source_set_target_list, drag_source_unset, drag_unhighlight, draw, ensure_style, error_bell, event, freeze_child_notify, get_accessible, get_action, get_activate_signal, get_allocation, get_ancestor, get_app_paintable, get_can_default, get_can_focus, get_child_requisition, get_child_visible, get_clipboard, get_colormap, get_composite_name, get_direction, get_display, get_double_buffered, get_events, get_extension_events, get_has_tooltip, get_has_window, get_mapped, get_modifier_style, get_name, get_no_show_all, get_pango_context, get_parent, get_parent_window, get_pointer, get_realized, get_receives_default, get_requisition, get_root_window, get_screen, get_sensitive, get_settings, get_size_request, get_snapshot, get_state, get_style, get_tooltip_markup, get_tooltip_text, get_tooltip_window, get_toplevel, get_visible, get_visual, get_window, grab_add, grab_default, grab_focus, grab_remove, has_default, has_focus, has_grab, has_rc_style, has_screen, hide, hide_all, hide_on_delete, input_shape_combine_mask, intersect, is_ancestor, is_composited, is_drawable, is_focus, is_sensitive, is_toplevel, keynav_failed, list_accel_closures, list_mnemonic_labels, map, menu_get_for_attach_widget, mnemonic_activate, modify_base, modify_bg, modify_cursor, modify_fg, modify_font, modify_style, modify_text, path, queue_clear, queue_clear_area, queue_draw, queue_draw_area, queue_resize, queue_resize_no_redraw, rc_get_style, realize, region_intersect, remove_accelerator, remove_mnemonic_label, render_icon, reparent, reset_rc_styles, reset_shapes, selection_add_target, selection_add_targets, selection_clear_targets, selection_convert, selection_owner_set, selection_remove_all, send_expose, send_focus_change, set_accel_path, set_activate_signal, set_allocation, set_app_paintable, set_can_default, set_can_focus, set_child_visible, set_colormap, set_composite_name, set_direction, set_double_buffered, set_events, set_extension_events, set_has_tooltip, set_has_window, set_mapped, set_name, set_no_show_all, set_parent, set_realized, set_receives_default, set_redraw_on_allocate, set_scroll_adjustments, set_sensitive, set_set_scroll_adjustments_signal, set_size_request, set_state, set_style, set_tooltip_markup, set_tooltip_text, set_tooltip_window, set_uposition, set_usize, set_visible, set_window, shape_combine_mask, show, show_all, show_now, size_allocate, size_request, style_attach, style_get_property, thaw_child_notify, translate_coordinates, trigger_tooltip_query, unmap, unparent, unrealize

Inherited from gtk.Object: do_destroy, flags, remove_data, remove_no_notify, set_flags, unset_flags

Inherited from unreachable.GObject: __copy__, __deepcopy__, __delattr__, __eq__, __gdoc__, __ge__, __gobject_init__, __gt__, __hash__, __le__, __lt__, __ne__, __new__, __repr__, __setattr__, chain, connect, connect_after, connect_object, connect_object_after, disconnect, disconnect_by_func, emit, emit_stop_by_name, freeze_notify, get_data, get_properties, get_property, handler_block, handler_block_by_func, handler_disconnect, handler_is_connected, handler_unblock, handler_unblock_by_func, notify, props, set_data, set_properties, set_property, stop_emission, thaw_notify, weak_ref

Inherited from atk.ImplementorIface: ref_accessible

Inherited from gtk.Buildable: add_child, construct_child, do_add_child, do_construct_child, do_get_internal_child, do_parser_finished, do_set_name, get_internal_child, parser_finished

Inherited from gtk.Orientable: get_orientation, set_orientation

Inherited from qubx.settings.PropertiedBase: propertied_add_property, propertied_connect_NumEntry, propertied_connect_check, propertied_connect_radios, propertied_connect_settings, propertied_connect_settings1, propertied_get, propertied_init, propertied_on_preset, propertied_on_radio, propertied_on_user_set, propertied_scriptable

Inherited from object: __format__, __getattribute__, __reduce__, __reduce_ex__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  __explore_featured = ['accel', 'rates', 'iterations', 'LL', 'l...
  propertied_spec_dict = {'Gleak': <qubx.settings.Property objec...
  propertied_specs = [<qubx.settings.Property object>, <qubx.set...

Inherited from gtk.VBox: __gtype__

Instance Variables [hide private]
  OnIteration
WeakEvent(iteration, LL, grads, K0, K1, amp, std, amp0, std0, Nchannel)
  OnIteration2
WeakEvent(iteration, LL, grads, K0, K1, K2, amp, std, amp0, std0, Nchannel)
  OnLiveLL
WeakEvent(LL)
  OnOptimized
WeakEvent(iterations, LL, grads, Hessian)

Inherited from qubx_plugin.OptToolPlugin: model_prep, right_panel, top_panel, txtStatus

Inherited from qubx_plugin.ToolPlugin: robot

Inherited from qubx.faces.Face: icon, menubar, showing, tab_sublayers

Properties [hide private]
  Gleak
Leakage conductance (pS)
  Vleak
Leak voltage (mV)
  live
True to redo fit curve when model changes
  multi_model
True to fit the sum of a group of models
  multi_model_group
Group for multi_model fitting (column in Models table)
  opt_Nchannel
True to optimize the model's channel count
  opt_cond
True to optimize the model's Amps/Conds
  opt_var
True to optimize the model's Stds/CondStds
  resample
True to resample by delta y
  resample_delta
an interval with std < delta is resampled as one data point
  use_GPU
True to use OpenCL-capable graphics card, if avail
  use_Peq
True to start each segment from equilibrium; False to use States:Pr
  use_group
True to fit a group of data files
  use_group_index
Group of interest in Data table

Inherited from qubx_plugin.OptToolPlugin: model, optimizing, score

Inherited from qubx.faces.Face: parent_window, pop_prefs

Inherited from gtk.Container: border_width, focus_child, has_focus_chain, need_resize, reallocate_redraws, resize_mode

Inherited from gtk.Widget: allocation, name, parent, requisition, saved_state, state, style, window

Inherited from unreachable.GObject: __grefcount__

Inherited from object: __class__

Method Details [hide private]

__init__(self, name='MacRates', global_name='QubX.Modeling.MacRates')
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Parameters:
  • label - tab label, becomes self.face_name
  • opt_name - optimizer preferences selector, defaults to label
  • opt_options - {option_label : default} to override specific defaults of the built-in optimizers (see qubx.optimize)
  • have_grads - True if your robot_calculate_score can also calculate dScore/dPar[i]
Overrides: object.__init__
(inherited documentation)

on_exception(self, robot, typ, val, trace)

source code 

Override this method to do something with exceptions thrown on robot thread; default: print to stdout.

Overrides: qubx_plugin.ToolPlugin.on_exception
(inherited documentation)

propertied_set(self, value, name)

source code 
Overrides: qubx.settings.PropertiedBase.propertied_set

on_robot_begin(self)

source code 

Override this method to respond when the robot starts working.

Overrides: qubx_plugin.ToolPlugin.on_robot_begin
(inherited documentation)

on_robot_end(self)

source code 

Override this method to respond when the robot finishes working.

Overrides: qubx_plugin.ToolPlugin.on_robot_end
(inherited documentation)

get_ndata(self, data_prep=None)

source code 

Override to tell how many datapoints/events used, for Trials.

Overrides: qubx_plugin.OptToolPlugin.get_ndata
(inherited documentation)

add_trial_fields(self, row, mtree, prefix='', model_prep=None, data_prep=None)

source code 

Override to pick info from the model.

Overrides: qubx_plugin.OptToolPlugin.add_trial_fields
(inherited documentation)

calculate_score(self, model_prep=None, data_prep=None, wait=True, receiver=<__builtin__.function object>, on_trial=None, **kw)

source code 

Starts the robot calculating the score.

Parameters:
  • receiver - func(score) called when score is finished calculating
Overrides: qubx_plugin.OptToolPlugin.calculate_score
(inherited documentation)

optimize(self, model_prep=None, data_prep=None, wait=True, receiver=None, ext_return=False, on_trial=None)

source code 

Starts the robot optimizing.

Parameters:
  • receiver - func() called when optimization is finished
Overrides: qubx_plugin.OptToolPlugin.optimize
(inherited documentation)

on_interrupt(self, task, cancel)

source code 

Override this method to customize the effect of the Stop button (e.g. set a flag); default: KeyboardInterrupt raised in robot thread.

Overrides: qubx_plugin.ToolPlugin.on_interrupt
(inherited documentation)

get_model_prep(self, model=None)

source code 
Overrides: qubx_plugin.OptToolPlugin.get_model_prep

request_data_prep(self, receiver, segs, model_prep, last_data_prep=None, resample=None, resample_std=None)

source code 
Overrides: qubx_plugin.OptToolPlugin.request_data_prep

__capture_robot_settings(self)

source code 

Should happen at the same time the modelprep is captured, e.g. at button press

robot_calculate_score(self, grads=None)

source code 

Calculates and returns the score, on worker thread; override this method. self.model_prep.model has just been updated.

Parameters:
  • grads - either None (no gradient requested) or an array to fill with dScore/dPar[i]
Overrides: qubx_plugin.OptToolPlugin.robot_calculate_score
(inherited documentation)

robot_get_pars(self)

source code 

Returns the list of initial parameter values, on worker thread; override this method. Derive parameter values from self.robot.model and/or from your own widgets.

Overrides: qubx_plugin.OptToolPlugin.robot_get_pars

robot_set_pars(self, pars)

source code 

Updates self.robot.model_prep.model and/or other state from new param values, on worker thread; override this method.

Overrides: qubx_plugin.OptToolPlugin.robot_set_pars
(inherited documentation)

robot_optimize(self)

source code 

Finds improved param values, starting from robot_get_pars(); override if you don't want the built-in optimizers. If you override, also do self.optOptions = None. self.robot.model_prep.model has just been updated.

Overrides: qubx_plugin.OptToolPlugin.robot_optimize
(inherited documentation)

robot_on_iteration(self, pars, grads, iterations, score)

source code 

Responds to a completed iteration; override this function to send model params etc back to gui.

Overrides: qubx_plugin.OptToolPlugin.robot_on_iteration
(inherited documentation)

Class Variable Details [hide private]

__explore_featured

Value:
['accel',
 'rates',
 'iterations',
 'LL',
 'last_LL',
 'grads',
 'OnLiveLL',
 'fitbot',
...

propertied_spec_dict

Value:
{'Gleak': <qubx.settings.Property object>,
 'Vleak': <qubx.settings.Property object>,
 'live': <qubx.settings.Property object>,
 'multi_model': <qubx.settings.Property object>,
 'multi_model_group': <qubx.settings.Property object>,
 'opt_Nchannel': <qubx.settings.Property object>,
 'opt_cond': <qubx.settings.Property object>,
 'opt_var': <qubx.settings.Property object>,
...

propertied_specs

Value:
[<qubx.settings.Property object>,
 <qubx.settings.Property object>,
 <qubx.settings.Property object>,
 <qubx.settings.Property object>,
 <qubx.settings.Property object>,
 <qubx.settings.Property object>,
 <qubx.settings.Property object>,
 <qubx.settings.Property object>,
...

Property Details [hide private]

Gleak

Leakage conductance (pS)

Get Method:
unreachable.act(*act_args, **act_kw)
Set Method:
unreachable.act(*act_args, **act_kw)

Vleak

Leak voltage (mV)

Get Method:
unreachable.act(*act_args, **act_kw)
Set Method:
unreachable.act(*act_args, **act_kw)

live

True to redo fit curve when model changes

Get Method:
unreachable.act(*act_args, **act_kw)
Set Method:
unreachable.act(*act_args, **act_kw)

multi_model

True to fit the sum of a group of models

Get Method:
unreachable.act(*act_args, **act_kw)
Set Method:
unreachable.act(*act_args, **act_kw)

multi_model_group

Group for multi_model fitting (column in Models table)

Get Method:
unreachable.act(*act_args, **act_kw)
Set Method:
unreachable.act(*act_args, **act_kw)

opt_Nchannel

True to optimize the model's channel count

Get Method:
unreachable.act(*act_args, **act_kw)
Set Method:
unreachable.act(*act_args, **act_kw)

opt_cond

True to optimize the model's Amps/Conds

Get Method:
unreachable.act(*act_args, **act_kw)
Set Method:
unreachable.act(*act_args, **act_kw)

opt_var

True to optimize the model's Stds/CondStds

Get Method:
unreachable.act(*act_args, **act_kw)
Set Method:
unreachable.act(*act_args, **act_kw)

resample

True to resample by delta y

Get Method:
unreachable.act(*act_args, **act_kw)
Set Method:
unreachable.act(*act_args, **act_kw)

resample_delta

an interval with std < delta is resampled as one data point

Get Method:
unreachable.act(*act_args, **act_kw)
Set Method:
unreachable.act(*act_args, **act_kw)

use_GPU

True to use OpenCL-capable graphics card, if avail

Get Method:
unreachable.act(*act_args, **act_kw)
Set Method:
unreachable.act(*act_args, **act_kw)

use_Peq

True to start each segment from equilibrium; False to use States:Pr

Get Method:
unreachable.act(*act_args, **act_kw)
Set Method:
unreachable.act(*act_args, **act_kw)

use_group

True to fit a group of data files

Get Method:
unreachable.act(*act_args, **act_kw)
Set Method:
unreachable.act(*act_args, **act_kw)

use_group_index

Group of interest in Data table

Get Method:
unreachable.act(*act_args, **act_kw)
Set Method:
unreachable.act(*act_args, **act_kw)