From 9b7f77c66948389beb067240b83d66f69685922b Mon Sep 17 00:00:00 2001 From: Pranjal Gupta Date: Tue, 8 Aug 2023 16:08:27 -0400 Subject: [PATCH] updating imports for pip install --- demos/ieeg_seizure.py | 4 ++-- demos/pandarinath2018_reaching.py | 4 ++-- demos/rp_benchmark.py | 5 ++--- demos/stringer2019_ephys.py | 6 ++---- demos/toy_examples.py | 2 +- utils.py => pro_utils.py | 0 pyproject.toml | 31 +++++++++++++++++++++++++++++++ requirements.txt | 5 ----- setup.py | 17 ----------------- 9 files changed, 40 insertions(+), 34 deletions(-) rename utils.py => pro_utils.py (100%) create mode 100644 pyproject.toml delete mode 100644 requirements.txt delete mode 100644 setup.py diff --git a/demos/ieeg_seizure.py b/demos/ieeg_seizure.py index 31d622b..891bd5c 100644 --- a/demos/ieeg_seizure.py +++ b/demos/ieeg_seizure.py @@ -6,8 +6,8 @@ import scipy.io as sio import mdp # for incremental sfa, ica, pca -from proSVD.proSVD import proSVD -from proSVD.utils import get_derivs +from proSVD import proSVD +from pro_utils import get_derivs # %% data from http://ieeg-swez.ethz.ch/ # sampled at 512 hz, each file is 3 mins before seizure, seizure, 3 mins after diff --git a/demos/pandarinath2018_reaching.py b/demos/pandarinath2018_reaching.py index 4652479..633c58f 100644 --- a/demos/pandarinath2018_reaching.py +++ b/demos/pandarinath2018_reaching.py @@ -4,8 +4,8 @@ import scipy.io as sio from scipy.ndimage import gaussian_filter1d -from proSVD.proSVD import proSVD -from proSVD.utils import get_streamingSVD, get_derivs +from proSVD import proSVD +from pro_utils import get_streamingSVD, get_derivs import os diff --git a/demos/rp_benchmark.py b/demos/rp_benchmark.py index 6aa64ea..c49636b 100644 --- a/demos/rp_benchmark.py +++ b/demos/rp_benchmark.py @@ -10,8 +10,8 @@ from scipy.stats import sem from scipy.spatial.distance import pdist -from proSVD.proSVD import proSVD -from proSVD.utils import embed_data, generate_stable_LDS, get_stable_dynamics_mat +from proSVD import proSVD +from pro_utils import embed_data, generate_stable_LDS, get_stable_dynamics_mat np.set_printoptions(precision=4) #%% reduction functions @@ -219,7 +219,6 @@ def get_accuracy_6_dim(X, dists, rp_range, k=6, form='traut', iters=20): plt.plot(X_low.T) #%% running distortion -%%time iters = 2 # iters for RP # rp_range = np.array([10, 50, 100, 500, 1000, 5000]) # rp_range = np.ceil(np.logspace(1, 4, 30)).astype('int') diff --git a/demos/stringer2019_ephys.py b/demos/stringer2019_ephys.py index 192d344..6373127 100644 --- a/demos/stringer2019_ephys.py +++ b/demos/stringer2019_ephys.py @@ -10,7 +10,7 @@ from scipy.ndimage import gaussian_filter1d from sklearn import random_projection as rp -from proSVD.proSVD import proSVD +from proSVD import proSVD #%% loading processed matlab data # one mouse @@ -68,9 +68,7 @@ def reduce_sparseRP(X, comps=100, eps=0.1, transformer=None): #%% running proSVD -%%time - -k = 10 +k = 10 l1 = k # cols to init l = 1 # num cols processed per iter (1 datapoint) decay = 1 # 'forgetting' diff --git a/demos/toy_examples.py b/demos/toy_examples.py index f86d27c..108bcff 100644 --- a/demos/toy_examples.py +++ b/demos/toy_examples.py @@ -6,7 +6,7 @@ from scipy.ndimage import gaussian_filter1d from proSVD import proSVD -# from proSVD.utils import get_streamingSVD +from pro_utils import get_streamingSVD #%% switching between different spectral regimes np.random.seed(100) diff --git a/utils.py b/pro_utils.py similarity index 100% rename from utils.py rename to pro_utils.py diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..63d229e --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,31 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[project] +name = "proSVD" +version = "0.0.1" +description = "Code for streaming dimension reduction with stability" +authors = [{name = "Pranjal Gupta"}] + +readme = "README.md" +classifiers = [ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", +] + +requires-python = ">=3.7" +keywords = ["streaming", "SVD"] +dependencies = [ + "numpy", + "scipy", + "matplotlib", + "scikit-learn" +] + +[tool.setuptools] +py-modules = ["proSVD", "pro_utils"] + +[project.optional-dependencies] +related-methods = ["pymdptoolbox"] diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 254ecce..0000000 --- a/requirements.txt +++ /dev/null @@ -1,5 +0,0 @@ -numpy -matplotlib -scipy -sklearn -jupyter \ No newline at end of file diff --git a/setup.py b/setup.py deleted file mode 100644 index 4a16850..0000000 --- a/setup.py +++ /dev/null @@ -1,17 +0,0 @@ -import setuptools - -with open("README.md", "r") as fh: - long_description = fh.read() - -setuptools.setup( - name="proSVD", - version='0.0.1', - author="Pranjal Gupta", - author_email="pranjal.gupta@duke.edu", - description="Streaming dimension reduction tools for neural data", - long_description=long_description, - long_description_content_type="text/markdown", - url="https://github.com/pearsonlab/proSVD", - packages=setuptools.find_packages(), - -) \ No newline at end of file