How to use the xlwings.ret function in xlwings

To help you get started, we’ve selected a few xlwings examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pymedphys / pymedphys / packages / pymedphys_xlwings / src / pymedphys_xlwings / xlwings / interpolate.py View on Github external
@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)
github pymedphys / pymedphys / packages / pymedphys_xlwings / src / pymedphys_xlwings / xlwings / dicom.py View on Github external
@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
github pymedphys / pymedphys / packages / pymedphys_xlwings / src / pymedphys_xlwings / xlwings / dicom.py View on Github external
@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
github alpha-miner / Finance-Python / excel / pyfin.py View on Github external
@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,
github pymedphys / pymedphys / packages / pymedphys_xlwings / src / pymedphys_xlwings / xlwings / interpolate.py View on Github external
@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)
github pymedphys / pymedphys / packages / pymedphys_xlwings / src / pymedphys_xlwings / xlwings / mephysto.py View on Github external
@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)