Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@xw.arg("dicom_path")
@xw.arg("depth_adjust")
@xw.arg("depth_lookup")
@xw.arg("averaging_distance")
@xw.ret(expand="table")
def inplane_profile(dicom_path, depth_adjust, depth_lookup, averaging_distance=0):
dicom_path_found = wildcard_file_resolution(dicom_path)
ds = pydicom.read_file(dicom_path_found, force=True)
inplane, inplane_dose, _, _ = extract_profiles(
ds, depth_adjust, depth_lookup, averaging_distance
)
return np.vstack([inplane, inplane_dose]).T
@xw.arg("values", np.array, ndim=2)
@xw.ret(expand="table")
def npravel(values):
return np.expand_dims(np.ravel(values.T), axis=1)
@xw.arg("depth_lookup")
@xw.arg("averaging_distance")
@xw.ret(expand="table")
def crossplane_profile(dicom_path, depth_adjust, depth_lookup, averaging_distance=0):
dicom_path_found = wildcard_file_resolution(dicom_path)
ds = pydicom.read_file(dicom_path_found, force=True)
_, _, crossplane, crossplane_dose = extract_profiles(
ds, depth_adjust, depth_lookup, averaging_distance
)
return np.vstack([crossplane, crossplane_dose]).T
@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,
volatilites,
forward,
@xw.arg("points", np.array, ndim=2)
@xw.arg("values", np.array, ndim=1)
@xw.arg("points_new", np.array, ndim=2)
@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)