Esempio n. 1
0
def merge_files_arrays(ts_1, ts_2, ts, det, f1_num, f2_num):
    i = np.array([0])  # indices ts_1
    j = np.array([0])  # indices ts_2
    k = 0  # indices ts
    i_temp = np.array([0])
    j_temp = np.array([0])

    t1 = ts_1[i[0], 0]
    t2 = ts_2[j[0], 0]
    check = 1
    while check:
        i_temp[0] = i[0]
        j_temp[0] = j[0]
        # ts[k], i_neu, j_neu, check = iterate(i, j, t1, t2, f1_num, f2_num, check)
        # ts[k], i_neu, j_neu, check = fib2.fib(i, j, t1, t2, f1_num, f2_num)
        ts[k], check = fib2.fib(i, j, t1, t2, f1_num, f2_num)
        if (i[0] > i_temp[0]):
            # i = i_neu
            if i[0] < f1_num:
                t1 = ts_1[i[0], 0]
                det[k] = 0
                k += 1
        if (j[0] > j_temp[0]):
            # j = j_neu
            if j[0] < f2_num:
                t2 = ts_2[j[0], 0]
                det[k] = 1
                k += 1
    if i[0] == f1_num:
        # t1 has ended first, rest of ts is ts_2
        k += 1
        for o in range(j[0], f2_num):
            ts[k] = ts_2[o, 0]
            det[k] = 1
            k += 1
    if j[0] == f2_num:
        # t2 has ended first, rest is ts_1
        k += 1
        for p in range(i[0], f1_num):
            ts[k] = ts_1[p, 0]
            det[k] = 0
            k += 1
Esempio n. 2
0
def merge_files_scalars(ts_1, ts_2, ts, det, f1_num, f2_num):
    i = 0  # indices ts_1
    j = 0  # indices ts_2
    k = 0  # indices ts

    t1 = ts_1[i, 0]
    t2 = ts_2[j, 0]
    check = 1
    while check:
        # ts[k], i_neu, j_neu, check = iterate(i, j, t1, t2, f1_num, f2_num, check)
        ts[k], i_neu, j_neu, check = fib2.fib(i, j, t1, t2, f1_num, f2_num)
        # ts[k], i_neu, j_neu, check = fib_jit(fib2.fib(i, j, t1, t2, f1_num, f2_num))

        if (i_neu > i):
            i = i_neu
            if i < f1_num:
                t1 = ts_1[i, 0]
                det[k] = 0
                k += 1
        if (j_neu > j):
            j = j_neu
            if j < f2_num:
                t2 = ts_2[j, 0]
                det[k] = 1
                k += 1
    if i == f1_num:
        # t1 has ended first, rest of ts is ts_2
        k += 1
        for o in range(j, f2_num):
            ts[k] = ts_2[o, 0]
            det[k] = 1
            k += 1
    if j == f2_num:
        # t2 has ended first, rest is ts_1
        k += 1
        for p in range(i, f1_num):
            ts[k] = ts_1[p, 0]
            det[k] = 0
            k += 1
Esempio n. 3
0
def fib_jit(i, j, t1, t2, f1_num, f2_num):
    t, i, j, check = fib2.fib(i, j, t1, t2, f1_num, f2_num)
    return t, i, j, check
Esempio n. 4
0
#!/usr/bin/env python

import sys
import numpy as np

import fib1
print fib1.fib.__doc__
a = np.zeros(10, 'd')
fib1.fib(a)
print a


import fib2
print fib2.fib.__doc__
b = fib2.fib(10)
print b, b.dtype, b.shape


import fib3
print fib3.fib.__doc__
c = np.zeros_like(a)
fib3.fib(c)
print c, c.dtype, c.shape


import fib4
print fib4.fib.__doc__
d = np.zeros_like(a)
fib4.fib(d)
print d, d.dtype, d.shape
Esempio n. 5
0
'''######################################################################
# File Name:
# Project:
# Version:
# Creation Date:
# Created By:
# Company: Goethe University of Frankfurt
# Institute: Institute of Physical and Theoretical Chemistry
# Department: Single Molecule Biophysics
# License: GPL3
#####################################################################'''
import numpy as np
import fib2

print(fib2.fib.__doc__)

# a = numpy.zeros(8, 'd')
# fib1.fib(a)
# print(a)
i = np.array(3)
j = np.array(3)
t1 = 3
t2 = 3
check = 1
t = 0
f1 = 5
f2 = 5
t, check = fib2.fib(i, j, t1, t2, f1, f2)
# print(t)
print('i=%i, j=%i, t=%i, check=%i (should be 4, 3, 3, 1)' % (i, j, t, check))
Esempio n. 6
0
# -*- coding: utf-8 -*-
"""
Created on Thu Jul  9 21:15:33 2020

@author: s150127
"""

import numpy as np

import fib2

print(fib2.fib.__doc__)

a = np.zeros(11)
print(fib2.fib(8))

import fib3

test = fib3.fib(8)

import gauss4 as gauss

data = np.zeros((9, 9))

data = gauss.gaussian(1, 4, 4, 1, 1)

print(data)