diff --git a/kymata/ippm/data_tools.py b/kymata/ippm/data_tools.py index 8e59221c..095724a7 100644 --- a/kymata/ippm/data_tools.py +++ b/kymata/ippm/data_tools.py @@ -18,6 +18,7 @@ Node = namedtuple('Node', 'magnitude position in_edges') + class IPPMHexel(object): """ Container to hold data about a hexel spike. @@ -215,6 +216,7 @@ def stem_plot( plt.show() + def causality_violation_score(denoised_hexels: Dict[str, IPPMHexel], hierarchy: Dict[str, List[str]], hemi: str, inputs: List[str]) -> Tuple[float, int, int]: """ Assumption: hexels are denoised. Otherwise, it doesn't really make sense to check the min/max latency of noisy hexels. @@ -373,6 +375,7 @@ def remove_excess_funcs(to_retain: List[str], hexels: Dict[str, IPPMHexel]) -> D hexels.pop(func) return hexels + def plot_k_dist_1D(pairings: List[Tuple[float, float]], k: int=4, normalise: bool=False): """ This could be optimised further but since we aren't using it, we can leave it as it is. @@ -412,6 +415,7 @@ def plot_k_dist_1D(pairings: List[Tuple[float, float]], k: int=4, normalise: boo plt.plot(list(range(0, len(sorted_k_dists))), sorted_k_dists) plt.show() + def copy_hemisphere( hexels_to: Dict[str, IPPMHexel], hexels_from: Dict[str, IPPMHexel], @@ -456,6 +460,7 @@ def copy_hemisphere( else: hexels_to[func].left_best_pairings = hexels_from[func].left_best_pairings + def plot_denoised_vs_noisy(hexels: Dict[str, IPPMHexel], clusterer, title: str): """ Utility function to plot the noisy and denoised versions. It runs the supplied clusterer and then copies the denoised hexels, which @@ -473,4 +478,4 @@ def plot_denoised_vs_noisy(hexels: Dict[str, IPPMHexel], clusterer, title: str): """ denoised_hexels = clusterer.cluster(hexels, 'rightHemisphere') copy_hemisphere(denoised_hexels, hexels, 'leftHemisphere', 'rightHemisphere') - stem_plot(denoised_hexels, title) \ No newline at end of file + stem_plot(denoised_hexels, title)