Esempio n. 1
0
def __checktype(typename, a, b):
    # Check that the type of the variable is anything
    if typename == "a":
        return True
    # Check that the type of the variable is string
    if typename == "s":
        return type(a) is str and type(b) is str
    # Check that the type of the variable is "n:Numeric" which accepts int or float
    if typename == "n":
        return (isinstance(a, np.int64) or np.integer(a) or type(a) is int
                or type(a) is float or type(a) is np.int64) and (
                    type(b) is int or type(b) is float or type(b) is np.int64
                    or np.integer(b) or isinstance(b, np.int64))
    # For unknown types
    return False
Esempio n. 2
0
 def default(self, obj):
     if isinstance(obj, int):
         return numpy.integer(obj)
     elif isinstance(obj, float):
         return numpy.floating(obj)
     #elif isinstance(obj, numpy.ndarray):
     #return obj.tolist()
     else:
         return super(MyDecoder, self).default(obj)
Esempio n. 3
0

np.int8(A())  # E: incompatible type
np.int16(A())  # E: incompatible type
np.int32(A())  # E: incompatible type
np.int64(A())  # E: incompatible type
np.uint8(A())  # E: incompatible type
np.uint16(A())  # E: incompatible type
np.uint32(A())  # E: incompatible type
np.uint64(A())  # E: incompatible type

np.void("test")  # E: incompatible type

np.generic(1)  # E: Cannot instantiate abstract class
np.number(1)  # E: Cannot instantiate abstract class
np.integer(1)  # E: Cannot instantiate abstract class
np.inexact(1)  # E: Cannot instantiate abstract class
np.character("test")  # E: Cannot instantiate abstract class
np.flexible(b"test")  # E: Cannot instantiate abstract class

np.float64(value=0.0)  # E: Unexpected keyword argument
np.int64(value=0)  # E: Unexpected keyword argument
np.uint64(value=0)  # E: Unexpected keyword argument
np.complex128(value=0.0j)  # E: Unexpected keyword argument
np.str_(value='bob')  # E: No overload variant
np.bytes_(value=b'test')  # E: No overload variant
np.void(value=b'test')  # E: Unexpected keyword argument
np.bool_(value=True)  # E: Unexpected keyword argument
np.datetime64(value="2019")  # E: No overload variant
np.timedelta64(value=0)  # E: Unexpected keyword argument
Esempio n. 4
0
    help=
    'The detection level to use to find pulses in sigma(ish)  ,  (default=%default)'
)

#major/minor
# Set default value for any option (both standard and experiment-specific options)
#parser.set_defaults(description='UHF signal generator track',dump_rate=1.0,nd_params='off')
# Parse the command line
opts, args = parser.parse_args()

# Values to be read in from Params
sync_time = opts.sync  #Pulse100-16dB-Noise20dB-V.npy.epoch
if os.path.isfile(opts.first_timestamp):
    timestamp_value = np.loadtxt(opts.first_timestamp, dtype=np.integer)
else:
    timestamp_value = np.integer(
        opts.first_timestamp)  # Pulse100-16dB-Noise20dB-V.npy.timestamp
ts = 1.0 / 1712e6  # seconds per data point
avg_num = opts.num
window_length = opts.window
chunk_size = opts.chunk_size * 32768
trans = slice(0, chunk_size)  # First look plots
plotting = opts.plot
if len(args) == 0:
    raise RuntimeError('No file passed to the script')

data = np.load(args[0], mmap_mode='r')

if plotting:
    nice_filename = args[0].split('/')[-1] + '_Pulse_report'
    pp = PdfPages(nice_filename + '.pdf')