How to use pymedphys - 10 common examples

To help you get started, we’ve selected a few pymedphys 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 / pymedphys / labs / film / optical_density.py View on Github external
def create_axes(image, dpcm=100):
    shape = np.shape(image)
    x_span = (np.arange(0, shape[0]) - shape[0] // 2) * 10 / dpcm
    y_span = (np.arange(0, shape[1]) - shape[1] // 2) * 10 / dpcm

    return x_span, y_span
github pymedphys / pymedphys / pymedphys / labs / film / optical_density.py View on Github external
def create_axes(image, dpcm=100):
    shape = np.shape(image)
    x_span = (np.arange(0, shape[0]) - shape[0] // 2) * 10 / dpcm
    y_span = (np.arange(0, shape[1]) - shape[1] // 2) * 10 / dpcm

    return x_span, y_span
github pymedphys / pymedphys / tests / labs / paulking / test_profile.py View on Github external
def test_get_flatness():
    profiler = Profile().from_tuples(PROFILER)
    profiler = profiler.resample_x(0.1)
    assert np.isclose(profiler.get_flatness(), 0.03042644213284108)
github pymedphys / pymedphys / tests / labs / paulking / test_profile.py View on Github external
def test_make_centered():
    profiler = Profile().from_tuples(PROFILER)
    assert np.isclose(np.sum(profiler.make_centered().get_edges()), 0.0)
github pymedphys / pymedphys / tests / labs / paulking / test_profile.py View on Github external
def test_slice_penumbra():
    profiler = Profile().from_tuples(PROFILER).resample_x(0.1)
    lt_penum, rt_penum = profiler.slice_penumbra()
    assert np.all(lt_penum.x < 0)
    assert np.all(rt_penum.x > 0)
    assert np.all(lt_penum.y < profiler.get_y(0))
    assert np.all(rt_penum.y < profiler.get_y(0))
github pymedphys / pymedphys / tests / labs / paulking / test_profile.py View on Github external
def test_from_tuples():
    empty = Profile()
    profiler = empty.from_tuples(PROFILER)
    assert len(profiler.x) == len(PROFILER)
    assert profiler.x[0] == PROFILER[0][0]
github pymedphys / pymedphys / tests / labs / paulking / test_profile.py View on Github external
def test_slice_tails():
    profiler = Profile().from_tuples(PROFILER).resample_x(0.1)
    lt_tail, rt_tail = profiler.slice_tails()
    assert np.all(lt_tail.x < min(rt_tail.x))
    assert np.all(rt_tail.x > max(lt_tail.x))
github pymedphys / pymedphys / tests / labs / paulking / test_profile.py View on Github external
def test_from_pulse():
    pulse = 4 * Profile().from_pulse(0.0, 1, (-5, 5), 0.1)
    assert np.isclose(sum(pulse.y), 40)
github pymedphys / pymedphys / pymedphys / labs / managelogfiles / bygantry.py View on Github external
def group_consecutive_logfiles(file_hashes, index):
    times = np.array([index[key]["local_time"] for key in file_hashes]).astype(
        np.datetime64
    )

    sort_reference = np.argsort(times)
    file_hashes = file_hashes[sort_reference]
    times = times[sort_reference]

    hours_4 = np.array(60 * 60 * 4).astype(np.timedelta64)
    split_locations = np.where(np.diff(times) >= hours_4)[0] + 1

    return np.split(file_hashes, split_locations)
github pymedphys / pymedphys / pymedphys / labs / film / calibrate.py View on Github external
def cal_fit(net_od):
        net_od = np.array(net_od, copy=False)
        return a * net_od + b * net_od ** n