ajustador.fitnesses

class ajustador.fitnesses.ErrorCalc[source]

An enumeration.

normal = 1
relative = 2
class ajustador.fitnesses.WaveHistogram(wave1, wave2, left=-inf, right=inf)[source]

Compute the difference between cumulative histograms of two waves

Since the x step might be different, we need to scale to the same range. This is done by doing a frequency histogram, which abstracts away the number of points in either plot.

bins(n=50)[source]
diff(full=False)[source]
hist(bins, y, cumulative=True)[source]
plot(figure)[source]
x1()[source]
x2()[source]
y1()[source]
y2()[source]
ajustador.fitnesses.ahp_curve_centered(wave, i)[source]
ajustador.fitnesses.ahp_curve_compare(cut1, cut2)[source]

Returns a number from [0, 1] which compares how close they are.

0 means the same, 1 means very different.

ajustador.fitnesses.ahp_curve_fitness(sim, measurement, full=False, error=<ErrorCalc.relative: 2>)[source]
ajustador.fitnesses.baseline_fitness(sim, measurement, full=False, error=<ErrorCalc.relative: 2>)[source]

Similarity of baselines

ajustador.fitnesses.baseline_post_fitness(sim, measurement, full=False, error=<ErrorCalc.relative: 2>)[source]

Similarity of baselines

ajustador.fitnesses.baseline_pre_fitness(sim, measurement, full=False, error=<ErrorCalc.relative: 2>)[source]

Similarity of baselines

ajustador.fitnesses.charging_curve_fitness(sim, measurement, full=False, error=<ErrorCalc.relative: 2>)[source]
class ajustador.fitnesses.combined_fitness(preset='new_combined_fitness', *, error=<ErrorCalc.relative: 2>, extra=None, **kwargs)[source]

Basic weighted combinations of fitness functions

static fitness_by_name(name)[source]
presets = {'empty': OrderedDict(), 'new_combined_fitness': OrderedDict([('response', 1), ('baseline_pre', 1), ('baseline_post', 1), ('rectification', 1), ('falling_curve_time', 1), ('spike_time', 1), ('spike_width', 1), ('spike_height', 1), ('spike_latency', 1), ('spike_ahp', 1), ('ahp_curve', 1), ('spike_range_y_histogram', 1)]), 'simple_combined_fitness': OrderedDict([('response', 1), ('baseline', 1), ('rectification', 1), ('falling_curve_time', 1), ('mean_isi', 1), ('spike_latency', 1), ('spike_height', 1), ('spike_width', 1), ('spike_ahp', 1), ('spike_count', 1), ('isi_spread', 1)])}
report(sim, measurement, *, full=False)[source]
ajustador.fitnesses.falling_curve_time_fitness(sim, measurement, full=False, error=<ErrorCalc.relative: 2>)[source]
ajustador.fitnesses.find_best(group, measurement, fitness)[source]
ajustador.fitnesses.find_multi_best(group, measurement, fitness, similarity=0.1, debug=False, full=False)[source]
ajustador.fitnesses.find_nonsimilar(group, measurement, fitness, similarity=0.1)[source]
class ajustador.fitnesses.find_nonsimilar_result(group, scores, params)
group

Alias for field number 0

params

Alias for field number 2

scores

Alias for field number 1

ajustador.fitnesses.fit_finished(fitness, cutoff=0.01, window=10)[source]
ajustador.fitnesses.fit_sort(group, measurement, fitness)[source]
ajustador.fitnesses.hyperpol_fitness(sim, measurement, full=False, error=<ErrorCalc.relative: 2>)[source]
ajustador.fitnesses.interpolate(wave1, wave2)[source]

Interpolate wave1 to wave2.x

ajustador.fitnesses.isi_spread_fitness(sim, measurement, full=False, error=<ErrorCalc.relative: 2>)[source]
ajustador.fitnesses.mean_isi_fitness(sim, measurement, full=False, error=<ErrorCalc.relative: 2>)[source]
ajustador.fitnesses.normalize_dimensions(vect)[source]
ajustador.fitnesses.parametrized_fitness(response=1, baseline=0.3, rectification=1, falling_curve_param=1, mean_isi=1, spike_latency=1, spike_height=1, spike_width=1, spike_ahp=1, error=<ErrorCalc.relative: 2>)[source]
ajustador.fitnesses.rectification_fitness(sim, measurement, full=False, error=<ErrorCalc.relative: 2>)[source]
ajustador.fitnesses.relative_diff(a, b)[source]

A difference between a and b using b as the yardstick

\[W = |a - b| / (|b| + |a| * RELATIVE_MAX_RATIO) w = rms(W)\]
ajustador.fitnesses.relative_diff_single(a, b, extra=0)[source]
ajustador.fitnesses.response_fitness(sim, measurement, full=False, error=<ErrorCalc.relative: 2>)[source]

Similarity of response to hyperpolarizing injection

ajustador.fitnesses.spike_ahp_fitness(sim, measurement, full=False, error=<ErrorCalc.relative: 2>)[source]
ajustador.fitnesses.spike_count_fitness(sim, measurement, full=False, error=<ErrorCalc.relative: 2>)[source]
ajustador.fitnesses.spike_fitness(sim, measurement, full=False, error=<ErrorCalc.relative: 2>)[source]
ajustador.fitnesses.spike_fitness_0(sim, measurement, full=False, error=<ErrorCalc.relative: 2>)[source]
ajustador.fitnesses.spike_height_fitness(sim, measurement, full=False, error=<ErrorCalc.relative: 2>)[source]
ajustador.fitnesses.spike_latency_fitness(sim, measurement, full=False, error=<ErrorCalc.relative: 2>)[source]
ajustador.fitnesses.spike_range_y_histogram_fitness(sim, measurement, full=False, error=<ErrorCalc.relative: 2>)[source]

Match histograms of y-values in spiking regions

This returns an rms of WaveHistogram.diff over the injection region. Waves are filtered to have at at least one spike between the pair. This is done to make this fitness function sensitive to depolarization block. Otherwise, the result would be dominated by baseline mismatches and response mismatches.

baseline_post_fitness and response_fitness are better fitted to detect mismatches in other regions.

ajustador.fitnesses.spike_time_fitness(sim, measurement, full=False, error=<ErrorCalc.relative: 2>)[source]
ajustador.fitnesses.spike_width_fitness(sim, measurement, full=False, error=<ErrorCalc.relative: 2>)[source]
ajustador.fitnesses.sub_mes_dev(reca, recb)[source]