[Python] I have encountered TypeError: float() argument must be a string or a real number, not...

Discussão em 'Python' iniciado por Stack, Setembro 25, 2024.

  1. Stack

    Stack Membro Participativo

    I tried an example code from PyNomo.doc, copied the code for the specific nomogram to be generated, and it yielded a TypeError. How can I fix this?

    from pynomo.nomographer import Nomographer
    import numpy
    const_A = 1.5
    const_B = 0.36
    const_C = 4.25
    const_D = .134
    const_E = 150
    const_F = 0.15

    def f1(x,v):
    return const_A*numpy.sin(const_B*(-x+const_C*v**const_D))+ \
    (v/const_E)/(-x+const_F+(v/200))**2

    block_20_params={
    'block_type':'type_5',
    'u_tag':'resolution',
    'wd_tag':'illum',
    'width':10.0,
    'height':13.0,
    'u_func':lambda u:numpy.log10(u),
    'u_values':[1.0,2.0,3.0,4.0,5.0,
    6.0,7.0,8.0,9.0,
    10.0,20.0,30.0,40.0],
    'u_text_format':r"$%3.0f$ ",
    'v_func':f1,
    'v_values':[10.0,20.0,30.0,50.0,100.0]

    Continue reading...

Compartilhe esta Página