generated from neutrons/python_project_template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
72 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__version__ = "0.0.1+d20240507" |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" |