Esempio n. 1
0
            (eff,
             eff_err2) = phys_corr.exp_detector_eff(axis_bc[0], 1.0, 0.0, 1.0)
        else:
            if inst_name == "SANS":
                (eff, eff_err2) = dr_lib.subexp_eff(eff_atten_const, axis,
                                                    eff_scale_const)
            else:
                raise RuntimeError("Do not know how to handle %s instrument" \
                                   % inst_name)

        hlr_utils.result_insert(result, res_descr, (eff, eff_err2), map_so)

    return result


if __name__ == "__main__":
    import hlr_test

    som1 = hlr_test.generate_som("histogram", 1, 1)
    som1.setAllAxisUnits(["Angstroms"])

    print "********** SOM1"
    print "* ", som1[0]

    print "********** create_det_eff"
    print "* som: ", create_det_eff(som1)
    print "* som: ", create_det_eff(som1,
                                    inst_name="SANS",
                                    eff_const=hlr_utils.DrParameter(
                                        0.2477, 0.0))
    # Check for x_units keyword argument
    try:
        comb_som.setAllAxisUnits(["Pixel#", kwargs["x_units"]])
    except KeyError:
        comb_som.setAllAxisUnits(["Pixel#", "Arb"])

    comb_som.append(so_dim)

    del so_dim

    return comb_som


if __name__ == "__main__":
    import hlr_test

    som1 = hlr_test.generate_som("histogram", 1, 3)
    som1.attr_list.instrument = SOM.ASG_Instrument()

    x_axis_err = hlr_utils.make_axis(0, 1, 0.25)

    print "********** SOM1"
    print "* ", som1[0]
    print "* ", som1[1]
    print "* ", som1[2]

    print "********** create_X_vs_pixpos"
    print " som :", create_X_vs_pixpos(som1, som1[0].axis[0].val, x_axis_err,
                                       withXVar="True")
Esempio n. 3
0
        value = array_manip.div_ncerr(val1, err2_1, val2, err2_2)

        map_so = hlr_utils.get_map_so(left, right, i)
        hlr_utils.result_insert(result, res_descr, value, map_so, axis,
                                axis_pos)

    if is_number:
        return tuple(result)
    else:
        return result

if __name__ == "__main__":
    import hlr_test

    som1 = hlr_test.generate_som()
    som2 = hlr_test.generate_som()

    print "********** SOM1"
    print "* ", som1[0]
    print "* ", som1[1]
    print "********** SOM2"
    print "* ", som2[0]
    print "* ", som2[1]

    print "********** div_ncerr"
    print "* som /som :", div_ncerr(som1, som2)
    print "* som /so  :", div_ncerr(som1, som1[0])
    print "* so  /som :", div_ncerr(som1[0], som1)
    print "* som /scal:", div_ncerr(som1, (2, 1))
    print "* scal/som :", div_ncerr((2, 1), som1)
Esempio n. 4
0
            else:
                map_so.y = axis_manip.reverse_array_cp(counts[0])
                map_so.var_y = axis_manip.reverse_array_cp(counts[1])
        else:
            pass

        hlr_utils.result_insert(result, res_descr, rev_value, map_so, "x",
                                axis)

    return result


if __name__ == "__main__":
    import hlr_test

    som1 = hlr_test.generate_som()
    som1.setAllAxisUnits(["Angstroms"])

    som2 = hlr_test.generate_som()
    som2.setAllAxisUnits(["Angstroms"])

    print "********** SOM1"
    print "* ", som1[0]
    print "* ", som1[1]

    print "********** SOM2"
    print "* ", som2[0]
    print "* ", som2[1]

    print "********** wavelength_to_velocity"
    print "* som  :", wavelength_to_velocity(som1)
Esempio n. 5
0
        (int_val) = utils.integrate_1D_hist(value, error, x_axis,
                                            width=width,
                                            min_int=start,
                                            max_int=end)
        (integration,
         integration_error2) = array_manip.add_ncerr(int_val[0],
                                                     int_val[1],
                                                     integration,
                                                     integration_error2)

    return (integration, integration_error2)

if __name__ == "__main__":
    import hlr_test

    som1 = hlr_test.generate_som()
    som2 = hlr_test.generate_som("histogram", 1, 1)

    print "********** SOM1"
    print "* ", som1[0]
    print "* ", som1[1]

    print "********** SOM2"
    print "* ", som2[0]

    print "********** integrate_axis"
    print "* som        :", integrate_axis(som1)
    print "* som        :", integrate_axis(som2)
    print "* som [2,4]  :", integrate_axis(som2, start=2, end=4)
    print "* som (width):", integrate_axis(som1, width=True)
    print "* so         :", integrate_axis(som1[0])