From 51e937dbaf75c7c78949347628595e48743a613f Mon Sep 17 00:00:00 2001 From: SamTov Date: Thu, 24 Jun 2021 09:24:23 +0200 Subject: [PATCH] Add cluster detection and fix plotting --- .../notebooks/Pendulum_Investigation.ipynb | 49 +++++++++++++++++++ symdet/symmetry_groups/group_detection.py | 2 +- 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 examples/notebooks/Pendulum_Investigation.ipynb diff --git a/examples/notebooks/Pendulum_Investigation.ipynb b/examples/notebooks/Pendulum_Investigation.ipynb new file mode 100644 index 0000000..5bef35a --- /dev/null +++ b/examples/notebooks/Pendulum_Investigation.ipynb @@ -0,0 +1,49 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Pendulum Investigation\n", + "\n", + "In this example, we will begin with generated simulation data of an ideal pendulum and go through the entire process of symmetry group extraction and then characterisation of the Lie algebra via the extraction of generators." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Data Generation\n", + "First things first, we need to generate some data on which to perform analysis." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.8.5" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/symdet/symmetry_groups/group_detection.py b/symdet/symmetry_groups/group_detection.py index 28a9330..c035019 100644 --- a/symdet/symmetry_groups/group_detection.py +++ b/symdet/symmetry_groups/group_detection.py @@ -107,7 +107,7 @@ def _cluster_detection(self, classes: np.ndarray, data: np.ndarray, vis_data: np stop = np.searchsorted(sorted_data[:, -1], item, side='right') - 1 n_cluster = len(np.unique(ms.fit(sorted_data[start:stop, 0:len(data)]).labels_)) if n_cluster == 2: - point_cloud[item] = sorted_data[start:stop, len(data):-1] + point_cloud[item] = sorted_data[start:stop, data.shape[-1]:-1] return point_cloud