This notebook demonstrates how you can collect measurements and analyze data over development using the Collector
class.
%reload_ext topo.misc.ipython
import topo
from topo.analysis import Collector
from topo.submodel.gcal import ModelGCAL, ArraySpec
scipy.optimize
from topo.analysis.command import measure_or_pref
from featuremapper.analysis.raster import fft_power
from featuremapper.analysis.pinwheels import PinwheelAnalysis
from featuremapper.analysis.hypercolumns import PowerSpectrumAnalysis
from holoviews import Points
We will now define the GCAL model specification:
topo.sim.model = ModelGCAL(cortex_density=47)
gcal = topo.sim.model.specification
Collector can be configured to collect Sheet
and Projection
activities, Projection
weights, the output of featuremapper
measurements, array data (here the V1 homeostatic threshold) and can be instructed to analyze any of these sources with the analyze
method:
c = Collector()
# Projection activities
c.Activity.LGNOnAfferent = c.collect(gcal.projections.V1.LGNOnAfferent)
c.Activity.LGNOffAfferent = c.collect(gcal.projections.V1.LGNOffAfferent)
# OR preference measurement
c.collect(measure_or_pref)
# Sheet activities
c.Activity.Retina = c.collect(gcal.sheets.Retina)
c.Activity.V1 = c.collect(gcal.sheets.V1)
# Connection fields
c.CFs.LGNOnAfferent = c.collect(gcal.projections.V1.LGNOnAfferent, grid=True)
c.CFs.LGNOffAfferent = c.collect(gcal.projections.V1.LGNOffAfferent, grid=True)
# Homeostatic threshold
c.HomeostaticThreshold.V1 = c.collect(ArraySpec('V1.output_fns[0].t'),
group='Homeostatic Threshold')
# Analysis
c.Pinwheels.V1 = c.analyze(c.ref.OrientationPreference.V1
* c.ref.OrientationSelectivity.V1, PinwheelAnalysis)
c.FFTAnalysis.V1 = c.analyze(c.ref.OrientationPreference.V1, PowerSpectrumAnalysis)
Now to instantiate and load the model:
topo.sim()
Finally, we define the measurement times and run the collector:
times = [500*i for i in range(31)]
print("Collection will start at iteration %d and end on iteration %d" % (min(times), max(times)))
data = c(times=times)
Here are both the projection activities (top row) and sheet activies (bottom row)
data.Activity.display('all').cols(2)
Here are the weights on the ON surround and OFF surround RGC+LGN projections:
(data.CFs.LGNOnAfferent + data.CFs.LGNOffAfferent).select(Time=(0, 15000, 16))