Olli Graf
11 months ago
9 changed files with 124 additions and 0 deletions
@ -0,0 +1,4 @@ |
|||
# created by virtualenv automatically |
|||
__pycache__ |
|||
bin |
|||
lib |
@ -0,0 +1,18 @@ |
|||
import io |
|||
import numpy as np |
|||
|
|||
class StressFile: |
|||
def readOutFile(self,filename): |
|||
result = { |
|||
'frequency': [], |
|||
'temperatures': [] |
|||
} |
|||
with open(filename,'r') as f: |
|||
content = f.readlines() |
|||
print(f'conent= {content}') |
|||
|
|||
|
|||
sf = StressFile() |
|||
|
|||
sf.readOutFile('./kodos.out') |
|||
|
@ -0,0 +1,42 @@ |
|||
import numpy as np |
|||
|
|||
# Array initialisieren |
|||
org = np.array([1,2,3,4,5,6]) |
|||
|
|||
|
|||
# Kopiert das int64 Array in ein float64 Array |
|||
def copy_to_float64(source): |
|||
liste = [] |
|||
|
|||
for i in range(source.shape[1]): |
|||
liste.append(float(source[i])) |
|||
|
|||
return np.array(liste,dtype=float64) |
|||
|
|||
|
|||
# Ein paar Kopien anlegen |
|||
copy_sum = org.copy() |
|||
copy_mult = org.copy() |
|||
copy_diff = org.copy() |
|||
copy_div = org.astype(np.float64).copy() |
|||
|
|||
# Zu allen Elementen 2 dazuzählen |
|||
copy_sum += 2 |
|||
|
|||
print(f'copy_sum={copy_sum}') |
|||
|
|||
# Alle Elemente mit 2 multiplizieren |
|||
copy_mult *= 2 |
|||
|
|||
print(f'copy_mult={copy_mult}') |
|||
|
|||
|
|||
# Von allen Elementen 1 abziehen |
|||
copy_diff -= 1 |
|||
|
|||
print(f'copy_diff={copy_diff}') |
|||
|
|||
copy_div /=2 |
|||
|
|||
print(f'copy_div={copy_div}') |
|||
|
@ -0,0 +1,20 @@ |
|||
import numpy as np |
|||
|
|||
org = np.array([1,2,3,4,5,6]) |
|||
|
|||
copy = org |
|||
|
|||
print(f'org= {org}') |
|||
print(f'copy={copy}') |
|||
|
|||
copy[2]= 7 |
|||
|
|||
print(f'org= {org}') |
|||
print(f'copy={copy}') |
|||
|
|||
copy2 = org.copy() |
|||
|
|||
copy2[2]= 3 |
|||
|
|||
print(f'org= {org}') |
|||
print(f'copy2={copy2}') |
@ -0,0 +1,9 @@ |
|||
import numpy as np |
|||
|
|||
a = np.array([1,2,3,4,5,6,7,8,9,10]) |
|||
|
|||
print(f'orignal {a}') |
|||
|
|||
reshaped = a.reshape(2,5) |
|||
|
|||
print(f'reshaped {reshaped}') |
@ -0,0 +1,7 @@ |
|||
import numpy as np |
|||
|
|||
#Erzeuge 1 Mio Zufallszahlen |
|||
random_np = np.random(100000) |
|||
|
|||
random_list = list(random_np) |
|||
|
@ -0,0 +1,6 @@ |
|||
import numpy as np |
|||
|
|||
twodim_array = np.array([[1,2,3,4,5],[1,4,9,16,25]]) |
|||
|
|||
print(f'shape is {twodim_array.shape}') |
|||
|
@ -0,0 +1,9 @@ |
|||
import numpy as np |
|||
|
|||
|
|||
simple_array = np.array([1,2,3,4,5,6]) |
|||
|
|||
print(f'simple_array={simple_array}') |
|||
print(f'ndim={simple_array.ndim}') |
|||
print(f'dtype={simple_array.dtype}') |
|||
print(f'shape is {simple_array.shape}') |
@ -0,0 +1,9 @@ |
|||
import numpy as np |
|||
|
|||
twodim_array = np.array([[1,2,3,4,5],[1,4,9,16,25]],dtype='int32') |
|||
|
|||
print(f'twodim_array={twodim_array}') |
|||
print(f'ndim={twodim_array.ndim}') |
|||
print(f'dtype={twodim_array.dtype}') |
|||
print(f'shape is {twodim_array.shape}') |
|||
|
Loading…
Reference in new issue