ioam / topographica

A general-purpose neural simulator focusing on topographic maps.
topographica.org
BSD 3-Clause "New" or "Revised" License
53 stars 32 forks source link

How to change a event of a button successfully? #614

Closed youngjt closed 9 years ago

youngjt commented 9 years ago

how can I replace the pre_plot_hooks=[analysis.update_activity](in the pic1) with pre_plot_hooks=[analysis.measure_movelightbar_jty_pref.instance(preference_fn=distribution.DSF_MaxValue())](in pic_2) successfully when I use the example of gcal.ty.

pic1 pic_1

pic2 pic_2

I have found the code following: (1) pg = create_plotgroup(name='Activity', category='Basic', doc='Plot the activity for all Sheets.', auto_refresh=True, pre_plot_hooks=[analysis.update_activity], plot_immediately=True) pg.add_plot('Activity', [('Strength', 'ActivityBuffer')]) (2) pg = create_plotgroup(name='Orientation Preference', category="Preference Maps", doc='Measure preference for sine grating orientation.', pre_plot_hooks=[analysis.measure_sine_pref.instance( preference_fn=distribution.DSF_MaxValue())])

then I have changed (1) as following:

pg = create_plotgroup(name='Activity', category='Basic', doc='Plot the activity for all Sheets.', auto_refresh=True, pre_plot_hooks=[analysis.measure_sine_pref.instance( preference_fn=distribution.DSF_MaxValue())], plot_immediately=True) pg.add_plot('Activity', [('Strength', 'ActivityBuffer')])

but I found there is something wrong. Then I have read the code in the whole affernoon, and found it seemed a difficult problem.

Thanks.

jbednar commented 9 years ago

I'm not sure what the problem is or what you're trying to achieve here, so it's difficult to say what you should do. Here you're using measure_sine_pref, which is fine, but if it's in the context of an Activity plot, I'm not sure what that's meant to achieve, because measure_sine_pref won't generate plots named Activity, which is what this code is plotting. measure_sine_pref generates plots named like OrientationPreference and OrientationSelectivity (and similarly for any other features besides orientation that you are varying), and so you'd need to change the add_plot call to plot something that's actually been generated by this call. Activity plots are generated by the measure_response command. Basically, you need to make sure that the pre_plot_hooks generate some plots with appropriate names, and then make sure that you have used add_plot to plot those and not some other plots.

youngjt commented 9 years ago

thanks