diff --git a/beamtime/auxillary.py b/beamtime/auxillary.py index 76ec551..68785f7 100644 --- a/beamtime/auxillary.py +++ b/beamtime/auxillary.py @@ -1,4 +1,5 @@ import json +import numpy as np def update_options(options, required_options, default_options): ''' Takes a dictionary of options along with a list of required options and dictionary of default options, and sets all keyval-pairs of options that is not already defined to the default values''' @@ -37,6 +38,18 @@ def swap_values(dict, key1, key2): -def hello_world2(a=1, b=2): +def ceil(a, roundto=1): - print(f'Halla, MAFAKKAS! a = {a} og b = {b}') \ No newline at end of file + fac = 1/roundto + + a = np.ceil(a*fac) / fac + + return a + +def floor(a, roundto=1): + + fac = 1/roundto + + a = np.floor(a*fac) / fac + + return a \ No newline at end of file