moved some more npy utils into general utils folder

This commit is contained in:
2020-05-05 16:07:37 +00:00
parent 61d8d4d912
commit e4d195cb95
3 changed files with 19 additions and 17 deletions
+2 -16
View File
@@ -2,6 +2,8 @@ from time import sleep
import numpy as np
from epics import PV
from slic.utils import get_dtype, get_shape
from .acquisition import Acquisition
@@ -75,22 +77,6 @@ def make_arrays(pvs, n_pulses):
return arrays
def get_dtype(v):
if is_array(v):
return v.dtype
else:
return type(v)
def get_shape(v):
if is_array(v):
return v.shape
else:
return tuple()
def is_array(v):
return isinstance(v, np.ndarray)
def write_to_h5(filename, channels, arrays):
if filename == "/dev/null":
return
+1 -1
View File
@@ -6,7 +6,7 @@ from .elog import Elog
from .fs_tools import can_create_file, glob_files, make_dir
from .ipy_tools import devices
from .json_tools import json_dump
from .npy_tools import fraction_to_percentage, within, within_fraction
from .npy_tools import fraction_to_percentage, within, within_fraction, get_dtype, get_shape, is_array
from .screenshot import Screenshot
+16
View File
@@ -25,4 +25,20 @@ def fraction_to_percentage(fraction, ndigits=1):
return percentage
def get_dtype(v):
if is_array(v):
return v.dtype
else:
return type(v)
def get_shape(v):
if is_array(v):
return v.shape
else:
return tuple()
def is_array(v):
return isinstance(v, np.ndarray)