コード例 #1
0
def make_nomograph(func, file):
    """Create nomograph with pynomo.

    Variant: x-axis: V_Sp, y-axis: A_PV, contour: WP_multi

    - Coordinate x is referenced with ``wd`` in block parameters
    - Coordinate y is referenced with ``u`` in block parameters
    - Coordinate z is referenced with ``v`` in block parameters

    - v_func is the function f(x,y) which returns z
    - v_func is the function f(wd,v) which returns u
    """
    import sys
    sys.path.insert(0, "..")
    from pynomo.nomographer import Nomographer

    def func2(x, y):
        return func([x], [y])[0]

    isopleth_wd = 30000  # x
    isopleth_v = 56  # z
    print(func2(isopleth_wd, isopleth_v))

    block_params = {
        'block_type': 'type_5',
        'v_func': func2,
        'u_values': [200, 250, 300, 350, 400, 450, 500],  # y-Axis
        'v_values': [48, 56, 64, 72],  # , 80, 90],  # z-Axis
        'wd_tick_levels': 2,
        'wd_tick_text_levels': 1,
        'wd_tick_side': 'right',
        'wd_title': r'$V_{Sp}$',  # x-Axis
        'v_title': r'$WP_{m}$',  # y-Axis
        'u_title': r'$A_{PV}$',  # z-Axis
        'u_title_distance_center': 2.0,
        'v_title_distance_center': 2.0,
        'v_title_opposite_tick': True,
        'wd_title_opposite_tick': True,
        'wd_title_distance_center': 3.0,
        'isopleth_values': [['unknown_u', isopleth_v, isopleth_wd]],
    }

    main_params = {
        'filename': os.path.join(os.path.dirname(file), 'polyfit.pdf'),
        'paper_height': 10.0,
        'paper_width': 10.0,
        'block_params': [block_params],
        'transformations': [('rotate', 0.01), ('scale paper', )]
    }

    Nomographer(main_params)
コード例 #2
0
ファイル: ex_axes_8_1.py プロジェクト: tevorbl/pynomo
    'text_size_4': pyx.text.size.tiny,
    'text_distance_0': 1.2 / 4,
    'text_distance_1': 1.1 / 4,
    'text_distance_2': 1.0 / 4,
    'text_distance_3': 1.0 / 4,
    'text_distance_4': 1.0 / 4,
    'title_distance_center': 0.7,
    'title_opposite_tick': True,
    'title_draw_center': True,
    'text_format': "$%3.1f$",
    'full_angle': True,
    'extra_angle': 90.0,
    'text_horizontal_align_center': True,
    'text_format': r"$%2.0f$",
    'text_color': pyx.color.cmyk.Sepia,
}
block_params = {
    'block_type': 'type_8',
    'f_params': N_params,
    'width': 5.0,
    'height': 15.0,
}
main_params = {
    'filename': 'ex_axes_8_1.pdf',
    'paper_height': 10.0,
    'paper_width': 10.0,
    'block_params': [block_params],
    'transformations': [('scale paper', )]
}
Nomographer(main_params)