Hi Natali,
Unfortunately I think the short answer is that to find suitable pairs will just take some trial and error. There are a few ways though that you can narrow your search. We will also do what we can on our end to make more graceful and informative error messages to let users know whether data is available or not.
For your initial example experiment 1515610888.871 we can first see how many pairs there are:
pairs = db.experiment_from_ext_id('1515610888.871').pairs
pairs
>>{('1', '2'): <Pair 1515610888.871 1 2>,
('2', '1'): <Pair 1515610888.871 2 1>,
('1', '3'): <Pair 1515610888.871 1 3>,
('1', '4'): <Pair 1515610888.871 1 4>,
('2', '3'): <Pair 1515610888.871 2 3>,
('2', '4'): <Pair 1515610888.871 2 4>,
('3', '1'): <Pair 1515610888.871 3 1>,
('3', '2'): <Pair 1515610888.871 3 2>,
('3', '4'): <Pair 1515610888.871 3 4>,
('4', '1'): <Pair 1515610888.871 4 1>,
('4', '2'): <Pair 1515610888.871 4 2>,
('4', '3'): <Pair 1515610888.871 4 3>}
From that list, not all pairs will have a connection. To figure that out we can do:
pairs_with_synapse = [pair for pair in pairs.values() if pair.has_synapse is True]
pairs_with_synapse
>>[<Pair 1515610888.871 1 2>]
From this we see that just one pair had a connection. We only expect connected pairs to have data that will plot PSP amplitudes in the function you are trying to use.
However, not all connections have PSP amplitudes that we could reliably fit and thus quantify as in those plots. These amplitudes are used to measure STP and so a short-cut way of seeing whether this pair has data that will be plottable is to check the STP measurements in the dynamics table as such:
pairs_with_STP_data = [pair for pair in pairs_with_synapse if np.isfinite(pair.dynamics.stp_induction_50hz)]
pairs_with_STP_data
>>[]
Unfortunately this returns an empty list, so there aren’t any pairs in this experiment that would have data to plot in this way.
Instead of going through all of these experiments one by one, you could use the pair_query
to return pairs that do have this data:
query = db.pair_query(
experiment_type='standard_multipatch', # filter: just multipatch experiments
species='human', # filter: only human data
synapse=True, # filter: only cell pairs connected by synapse
filter_exprs = [db.Dynamics.stp_induction_50hz != np.nan] # filter: only connections that have STP data
)
pairs_with_stp = query.all()
print(len(pairs_with_stp))
>> 264
pair = pairs_with_stp[0] # let's just grab the first pair
pair
>> <Pair 1488403059.445 2 8>
# Now we can try plotting this and see if it works
fig, ax = plt.subplots()
pair = db.experiment_from_ext_id('1488403059.445').pairs[('2', '8')]
plot_stim_sorted_pulse_amp(pair, ax, avg_line=True)