Beispiel #1
0
                             T[imin:imax],
                             data[key][imin:imax],
                             maxfev=1000000,
                             p0=(0., 1., 100., 1., 0.01, 0.01, 0.),
                             jac=jacobian_fitting_curve)
        A = round_parameters(*A)
        # compute the xi2 difference between the data values (in the fitting
        # interval) and the curve
        xi2 = sum((data[key][imin:imax] - fitting_curve(T[imin:imax], *A))**2)
        # output some info
        print "Transition:", key
        print_fit_variables(*A)
        print "convergence:", xi2
        print "validity: [", T[imin], ",", T[imax - 1], "]"
        # write the fitting code for this transition
        code += get_code("OII", transitions[key], *A)
        # add the values to the list strings
        append_data_values(data_values, *A)

        # plot the data and fit for visual comparison
        Trange = np.logspace(3., 5., 100)
        pl.plot(T, data[key], "k.")
        pl.plot(Trange, fitting_curve(Trange, *A), "r-")
        pl.xlim(0., 1.e5)
        pl.savefig("tmp/OII_{key}.png".format(key=key))
        pl.close()

        # save the plot values in separate files
        dfile = open("tmp/OII_{key}_data.txt".format(key=key), "w")
        for i in range(len(T)):
            dfile.write("{T}\t{data}\n".format(T=T[i], data=data[key][i]))
Beispiel #2
0
                         data[imin:imax],
                         maxfev=1000000,
                         method="trf",
                         p0=(0., 1., 1., 1., 0.01, 0.01, 0.),
                         jac=jacobian_fitting_curve)
    A = round_parameters(*A)
    # compute the xi2 difference between the data values (in the fitting
    # interval) and the curve
    xi2 = sum((data[imin:imax] - fitting_curve(T[imin:imax], *A))**2)
    # output some info
    print "Transition: 0 to 1"
    print_fit_variables(*A)
    print "convergence:", xi2
    print "validity: [", T[imin], ",", T[imax - 1], "]"
    # write the fitting code for this transition
    code += get_code("NeII", "REMOVE_THIS_BLOCK", *A)
    # add the values to the list strings
    append_data_values(data_values, *A)

    # plot the data and fit for visual comparison
    Trange = np.logspace(3., 5., 100)
    pl.plot(T, data, "k.")
    pl.plot(Trange, fitting_curve(Trange, *A), "r-")
    pl.xlim(0., 1.e5)
    pl.savefig("tmp/NeII_{key}.png".format(key="G0t1"))
    pl.close()

    # save the plot values in separate files
    dfile = open("tmp/NeII_{key}_data.txt".format(key="G0t1"), "w")
    for i in range(len(T)):
        dfile.write("{T}\t{data}\n".format(T=T[i], data=data[i]))
Beispiel #3
0
        maxfev=1000000,
        method="trf",
        p0=(0.0, 1.0, 1.0, 1.0, 0.01, 0.01, 0.0),
        jac=jacobian_fitting_curve,
    )
    A = round_parameters(*A)
    # compute the xi2 difference between the data values (in the fitting
    # interval) and the curve
    xi2 = sum((data[imin:imax] - fitting_curve(T[imin:imax], *A)) ** 2)
    # output some info
    print("Transition: 0 to 1")
    print_fit_variables(*A)
    print("convergence:", xi2)
    print("validity: [", T[imin], ",", T[imax - 1], "]")
    # write the fitting code for this transition
    code += get_code("SIV", "REMOVE_THIS_BLOCK", *A)
    # add the values to the list strings
    append_data_values(data_values, *A)

    # plot the data and fit for visual comparison
    Trange = np.logspace(3.0, 5.0, 100)
    pl.plot(T, data, "k.")
    pl.plot(Trange, fitting_curve(Trange, *A), "r-")
    pl.xlim(0.0, 1.0e5)
    pl.savefig("tmp/SIV_{key}.png".format(key="G0t1"))
    pl.close()

    # save the plot values in separate files
    dfile = open("tmp/SIV_{key}_data.txt".format(key="G0t1"), "w")
    for i in range(len(T)):
        dfile.write("{T}\t{data}\n".format(T=T[i], data=data[i]))
Beispiel #4
0
                         T[imin:imax],
                         data[imin:imax],
                         maxfev=100000,
                         p0=(0., 1., 10., 1., 0.01, 0.01, 0.),
                         jac=jacobian_fitting_curve)
    A = round_parameters(*A)
    # compute the xi2 difference between the data values (in the fitting
    # interval) and the curve
    xi2 = sum((data[imin:imax] - fitting_curve(T[imin:imax], *A))**2)
    # output some info
    print "Transition: 0 to 1"
    print_fit_variables(*A)
    print "convergence:", xi2
    print "validity: [", T[imin], ",", T[imax - 1], "]"
    # write the fitting code for this transition
    code += get_code("NIII", "REMOVE_THIS_BRACKET", *A)
    # add the values to the list strings
    append_data_values(data_values, *A)

    # plot the data and fit for visual comparison
    Trange = np.logspace(3., 5., 100)
    pl.plot(T, data, "k.")
    pl.plot(Trange, fitting_curve(Trange, *A), "r-")
    pl.savefig("tmp/NIII_{key}.png".format(key="G0t1"))
    pl.close()

    # save the plot values in separate files
    dfile = open("tmp/NIII_{key}_data.txt".format(key="G0t1"), "w")
    for i in range(len(T)):
        dfile.write("{T}\t{data}\n".format(T=T[i], data=data[i]))
    dfile.close()