:point_up: April 20 2015 6:27 AM @tomsains I'll take a stab at this:

`modelfile`

is where you specify the stimulus values that you used to get the response magnitudes (which is sounds like you computed from a previous regression analysis). So if you used 12 angles, this this would be a vector containing those 12 angles. It could alternatively be a string with the path to a `.mat`

file that contains said parameters in a variable that is specified by another optional argument, `var`

. I think this is where the name comes form...it might make more sense to call it `stimparams`

, as that's the common denominator here.
@jwittenbach :point_up: April 21 2015 1:55 AM ah so is it literally the case of something like this:

```
circ = nmp.array((300, 90, 120, 330, 0, 240, 270, 210, 60, 30, 150, 180), dtype=nmp.int)
tuningmodel = TuningModel.load(circ, 'circular')
```

ok and from that i'm assuming the output 'center' is a spatial map of tuning values (each of the angles in circ) ?

@tomsains that code looks right to me! The only thing I would check is that I *think* the angles need to be in radians (not 100% on this, but looking at the code, there's a place where you do an eiθ, which makes me think radians).

Once you have the

`TuningModel`

, you'll also need a `Series`

where each record contains the "responses" to those stimuli. Then you can call `TuningModel.fit()`

on the `Series`

to fit that model independently on each record of the `Series`

(e.g. each record might be a voxel or a neuron).
Something like:

```
circ = nmp.array((300, 90, 120, 330, 0, 240, 270, 210, 60, 30, 150, 180), dtype=nmp.int)
tuningmodel = TuningModel.load(nmp.radians(circ), 'circular').fit(responses)
```

Where

`responses`

is your `Series`

of responses to the given stimulus parameters.
Now

`tuningmodel`

will be a `Series`

where each record contains the mean and variance of the fitted von Mises tuning curve
The means are indexed by

`center`

and the variances by `spread`

So, for example, you could find the stimulus values that would be predicted to produce the largest response for each record with

`centers = tuningmodel['center']`

@jwittenbach so are the 'responses' you are essentially the 'betas' (regression coefficient) from the regression that is performed prior to the tuning model?

@tomsains any set of 12 numbers that represents how strongly system responds to each of the 12 stimuli would work. If you regressed an initial time-series against a set of indicator variables (0 = off, 1 = on) for the 12 stimuli, then that would definitely work.

@jwittenbach Brilliant that is what i have done and the model seems to be working! thank you!

Excellent! Happy I could help :smile:

nice work figuring this one out @jwittenbach and @tomsains ! we clearly need a tuning tutorial =)

yes a tutorial on tuning models would be very useful. I would make one myself but i am still definitely learning how they are implemented in thunder.

@tomsains :point_up: April 20 2015 10:17 AM that S3 error is strange, we upgraded our EC2 instances a couple weeks ago to use Anaconda, which means the latest versions of

`boto`

(the library for accessing S3), and in the process added one configuration setting to fix a bug handling bucket names with periods in them https://github.com/thunder-project/thunder/blob/17b218c638acf9a460f5fcf49f4313e7ecfe4e2e/python/thunder/utils/ec2.py#L219
from googling it looks like the error is related to buckets and the cluster being in different regions

for a quick test you launch a cluster and then open the file

`/root/.boto`

and remove this bit:```
[s3]
calling_format = boto.s3.connection.OrdinaryCallingFormat
```

@freeman-lab yeah that's what I found from googling too so i fired up a new cluster in eu-west-1 (same as my S3 bucket) and received the same error. Just to be certain i will try again and try your test

very strange, is this the same public bucket you shared with us previously? if so i can play around as well.

it is - feel free to use it

awesome, will do