Skip to content

Streamfile creator for profiles #2

@DavidDierickx

Description

@DavidDierickx

New function for creating stream files out of numpy arrays.

import numpy as np

def streamfile(filename, profile, n_passes, sputter_rate, dwell_time_base):
# Dwell time base = 100ns
# Sputter rate = ?

profile = profile / (n_passes * sputter_rate * dwell_time_base)

# create a list of lists
profile_list = []
for i in range(profile.shape[0]):
    for j in range(profile.shape[1]):
        profile_list.append([profile[i,j], i, j])
# write the header
np.random.shuffle(profile_list)

with open(filename, "w") as f:
    f.write("s\n")
    f.write(str(n_passes)+"\n")
    f.write(str(profile.shape[0]*profile.shape[1])+"\n")

# write the profile
with open(filename, "a") as f:
    for i in range(len(profile_list)):
        f.write(str(profile_list[i][0])+" "+str(profile_list[i][1])+" "+str(profile_list[i][2])+"\n")

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions