diff --git a/environment.yml b/environment.yml index 248292d..58bb998 100644 --- a/environment.yml +++ b/environment.yml @@ -1,10 +1,10 @@ -name: mypythonapp +name: tavi channels: - conda-forge dependencies: # -- Runtime dependencies # base: list all base dependencies here - - python>=3.8 # please specify the mimimum version of python here + - python>=3.10 # please specify the mimimum version of python here - versioningit # compute: list all compute dependencies here - numpy @@ -33,7 +33,7 @@ dependencies: # add additional sections such as Qt, etc. if needed # -------------------------------------------------- # if pakcages are not available on conda, list them here - - pip - - pip: - - bm3d-streak-removal # example - - pytest-playwright + # - pip + # - pip: + # - bm3d-streak-removal # example + # - pytest-playwright diff --git a/src/packagenamepy/_version.py b/src/packagenamepy/_version.py new file mode 100644 index 0000000..edc3d26 --- /dev/null +++ b/src/packagenamepy/_version.py @@ -0,0 +1 @@ +__version__ = "0.0.1+d20240507" diff --git a/src/packagenamepy/__init__.py b/src/tavi/__init__.py similarity index 100% rename from src/packagenamepy/__init__.py rename to src/tavi/__init__.py diff --git a/src/packagenamepy/configuration.py b/src/tavi/configuration.py similarity index 100% rename from src/packagenamepy/configuration.py rename to src/tavi/configuration.py diff --git a/src/packagenamepy/configuration_template.ini b/src/tavi/configuration_template.ini similarity index 100% rename from src/packagenamepy/configuration_template.ini rename to src/tavi/configuration_template.ini diff --git a/src/packagenamepy/help/help_model.py b/src/tavi/help/help_model.py similarity index 100% rename from src/packagenamepy/help/help_model.py rename to src/tavi/help/help_model.py diff --git a/src/packagenamepy/home/home_model.py b/src/tavi/home/home_model.py similarity index 100% rename from src/packagenamepy/home/home_model.py rename to src/tavi/home/home_model.py diff --git a/src/packagenamepy/home/home_presenter.py b/src/tavi/home/home_presenter.py similarity index 100% rename from src/packagenamepy/home/home_presenter.py rename to src/tavi/home/home_presenter.py diff --git a/src/packagenamepy/home/home_view.py b/src/tavi/home/home_view.py similarity index 100% rename from src/packagenamepy/home/home_view.py rename to src/tavi/home/home_view.py diff --git a/src/packagenamepy/mainwindow.py b/src/tavi/mainwindow.py similarity index 100% rename from src/packagenamepy/mainwindow.py rename to src/tavi/mainwindow.py diff --git a/src/packagenamepy/packagename.py b/src/tavi/packagename.py similarity index 100% rename from src/packagenamepy/packagename.py rename to src/tavi/packagename.py diff --git a/src/tavi/scans.py b/src/tavi/scans.py new file mode 100644 index 0000000..943f021 --- /dev/null +++ b/src/tavi/scans.py @@ -0,0 +1,39 @@ +import numpy as np + + +class Scan(object): + """ + Scan class + """ + + def __init__(self): + self.metadata = {} + self.data = {} + + def get_metadata(self): + return self.metadata + + def get_data(self): + return self.data + + def plot_gen( + self, + x_str=None, + y_str=None, + xerr_str=None, + yerr_str=None, + norm_str=None, + norm_val=None, + ): + if x_str == None: + x_str = self.get_metadata()["def_x"] + + if y_str == None: + y_str = self.get_metadata()["def_y"] + + x = self.data[x_str] + y = self.data[y_str] + xerr = None + yerr = None + + return x, y, xerr, yerr diff --git a/src/packagenamepy/version.py b/src/tavi/version.py similarity index 100% rename from src/packagenamepy/version.py rename to src/tavi/version.py diff --git a/tests/test_scan.py b/tests/test_scan.py new file mode 100644 index 0000000..5fa1977 --- /dev/null +++ b/tests/test_scan.py @@ -0,0 +1,23 @@ +import numpy as np +from tavi.scans import Scan + + +def test_get_metadata(): + s1 = Scan() + s1.metadata = dict(IPTS=1234, exp=567, def_x="s1") + # print(s1) + # assert s1.metadata["def_x"] == "test" + md = s1.get_metadata() + assert md["def_x"] == "s1" + + +def test_plot_gen(): + s2 = Scan() + s2.metadata = dict(def_x="s1", def_y="detector") + s2.data = dict(s1=np.arange(0, 1, 0.2), detector=np.arange(100, 300, 40)) + x, y, xerr, yerr = s2.plot_gen() + print(x) + assert np.allclose(x, np.arange(0, 1, 0.2)) + # assert y == np.arange(100, 300, 40) + # assert xerr == 0 + # assert yerr == 0 diff --git a/tests/test_version.py b/tests/test_version.py index 5b09eca..e524661 100644 --- a/tests/test_version.py +++ b/tests/test_version.py @@ -1,5 +1,7 @@ -from packagenamepy import __version__ +from tavi import __version__ def test_version(): + print(__version__) assert __version__ == "unknown" + # assert __version__ == "0.0.1"