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

AttributeError: 'Image' object has no attribute 'ylim' #638

Closed kalok87 closed 8 years ago

kalok87 commented 8 years ago

Hallo, I used to record the size of V1 map by using: topo.sim.V1.views.maps.OrientationSelectivity.last.ylim

But it doesn't work now, is there any replacement command for this?

thank you

philippjfr commented 8 years ago

Sure there's two alternatives. You either access the bounds object on the Image, which has an lbrt method, returning both the xlim and ylim or you can simply call Image.range('y') or equivalently Image.range(1).

kalok87 commented 8 years ago

Dear Philipp, I am using: import Image b = Image.range('y') which gives me a error in Topo: AttributeError: 'module' object has no attribute 'range'

What is that problem? I am using the newest version of Topo.

philippjfr commented 8 years ago

Range is a method on the Image objects, where you previously accessed ylim, it's got nothing to do with the Image library, so your access should look something like this based on your example: topo.sim.V1.views.OrientationMap.last.range('y')

kalok87 commented 8 years ago

Thank for your replying, Phillipp. But after using topo.sim.V1.views.OrientationMap.last.range('y'), I get a result (None,None). What happens here?

philippjfr commented 8 years ago

Could you tell me what you get when executing topo.sim.V1.views.OrientationMap.last.dimensions(). You should pass the name of the second dimension to the range method to get the corresponding range values.

kalok87 commented 8 years ago

When I am using print topo.sim.V1.views.OrientationMap.last.dimensions(), I get [ ] which is an empty list.

philippjfr commented 8 years ago

Have you measured an OrientationMap?

kalok87 commented 8 years ago

Philipp, here is my command: measure_or_pref() p = topo.sim.V1.views.maps.OrientationPreference.last.data s = topo.sim.V1.views.maps.OrientationSelectivity.last.data b = topo.sim.V1.views.OrientationMap.last.range('y') print topo.sim.V1.views.OrientationMap.last.dimensions()

Is there anything wrong?

philippjfr commented 8 years ago

Sorry my fault, left out the maps part. This should work:

topo.sim.V1.views.maps.OrientationSelectivity.last.range('y')

But really you should just be accessing the return value of measure_or_pref directly.

data = measure_or_pref()
data.OrientationPreference.V1.last # The orientation map
data.OrientationPreference.V1.last.bounds.lbrt() # The left, bottom, right and top coordinate of the OR map
data.OrientationPreference.V1.last.range('y') # The y-range of the OR map, equivalent to bottom and top
kalok87 commented 8 years ago

Thank you, Philipp, there are a lot of helps.