Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@xw.ret(expand="table")
def linear_interpolation(x, y, xnew, fill_value=None):
f = interpolate.interp1d(x, y, fill_value=fill_value)
ynew = f(xnew)
return np.expand_dims(ynew, axis=1)
@xw.ret(expand="table")
def arbitrary_profile(dicom_path, depth_adjust, inplane, crossplane, depth):
dicom_path_found = wildcard_file_resolution(dicom_path)
inplane_ref = np.invert(np.isnan(inplane))
crossplane_ref = np.invert(np.isnan(crossplane))
depth_ref = np.invert(np.isnan(depth))
reference = inplane_ref & crossplane_ref & depth_ref
ds = pydicom.read_file(dicom_path_found, force=True)
dose = arbitrary_profile_from_dicom_dose(
ds, depth_adjust, inplane[reference], crossplane[reference], depth[reference]
)
result = np.ones_like(inplane) * np.nan
@xw.ret(expand="table")
def depth_dose(dicom_path, depth_adjust, averaging_distance=0):
dicom_path_found = wildcard_file_resolution(dicom_path)
ds = pydicom.read_file(dicom_path_found, force=True)
depth, depth_dose_values = extract_depth_dose(ds, depth_adjust, averaging_distance)
return np.vstack([depth, depth_dose_values]).T
@xw.ret(expand='table')
@xw.arg('strikes', np.array, dim=1)
@xw.arg('volatilites', np.array, dim=1)
def sabrCalibration(strikes,
volatilites,
forward,
expiryTime,
intialAlpha,
initialBeta,
initialNu,
initialRho,
isFixedAlpha=False,
isFixedBeta=False,
isFixedNu=False,
isFixedRho=False,
method='trf'):
x = scb(strikes,
@xw.ret(expand="table")
def nd_linear_interpolation(points, values, points_new):
func = interpolate.LinearNDInterpolator(points, values)
values_new = func(points_new)
return np.expand_dims(values_new, axis=1)
@xw.ret(expand="table")
def mephysto(filepath, index):
filepath_found = wildcard_file_resolution(filepath)
(axis, reading, scan_curvetype, scan_depth) = load_single_item(
filepath_found, int(index)
)
second_column_header = ["Reading"]
if scan_curvetype == "PDD":
first_column_header = ["Depth Profile", "Depth (mm)"]
second_column_header = [None] + second_column_header
elif scan_curvetype == "INPLANE_PROFILE":
first_column_header = ["Inplane Profile", "y (mm)"]
second_column_header = [
"Depth = {} mm".format(scan_depth)