Example #1
0
def spectrum_fit_calc_flux_value(private_key, sender_id, msg_id, mtype, params,
                                 extra):
    """
    spectrum_fit_calc_flux_value



    """
    try:
        info("spectrum_fit_calc_flux_value()")
        ui = SherpaSession()

        try:
            ui.set_data(params["datasets"])

        except Exception, e:
            reply_error(msg_id, sedexceptions.DataException, e, mtype)
            return

        try:
            usermodels = []
            if (params.has_key("usermodels")):
                usermodels = params["usermodels"]
            ui.set_parameters(params["models"], usermodels)

        except Exception, e:
            reply_error(msg_id, sedexceptions.ParameterException, e, mtype)
            return
Example #2
0
def spectrum_fit_fit(private_key, sender_id, msg_id, mtype, params, extra):
    """
    spectrum_fit_fit


    """
    try:
        info("spectrum_fit_fit()")
        ui = SherpaSession()

        info("ui session _sources: " + str(ui.session._sources))
        info("ui session _models: " + str(ui.session._models))
        info("ui session _model_components: " +
             str(ui.session._model_components))
        info("ui session _data: " + str(ui.session._data))

        try:
            ui.set_method(params["method"])

        except Exception, e:
            reply_error(msg_id, sedexceptions.MethodException, e, mtype)
            return

        try:
            ui.set_data(params["datasets"])

        except Exception, e:
            reply_error(msg_id, sedexceptions.DataException, e, mtype)
            return
Example #3
0
def spectrum_fit_confidence(private_key, sender_id, msg_id, mtype, params,
                            extra):
    """
    spectrum_fit_confidence



    """
    try:
        info("spectrum_fit_confidence()")
        ui = SherpaSession()

        try:
            ui.set_method(params["method"])

        except Exception, e:
            reply_error(msg_id, sedexceptions.MethodException, e, mtype)
            return

        try:
            ui.set_data(params["datasets"])

        except Exception, e:
            reply_error(msg_id, sedexceptions.DataException, e, mtype)
            return
Example #4
0
def spectrum_fit_set_confidence(private_key, sender_id, msg_id, mtype, params,
                                extra):
    """
    spectrum_fit_set_confidence

    
    """
    try:
        info("spectrum_fit_set_confidence()")
        ui = SherpaSession()

        try:
            ui.set_confidence(params["confidence"])

        except Exception, e:
            reply_error(msg_id, sedexceptions.ConfidenceException, e, mtype)
            return

        reply_success(msg_id, mtype)
Example #5
0
def spectrum_fit_set_method(private_key, sender_id, msg_id, mtype, params,
                            extra):
    """
    spectrum_fit_set_method

    
    """
    try:
        info("spectrum_fit_set_method()")
        ui = SherpaSession()

        try:
            ui.set_method(params["method"])

        except Exception, e:
            reply_error(msg_id, sedexceptions.MethodException, e, mtype)
            return

        reply_success(msg_id, mtype)
Example #6
0
def spectrum_fit_set_statistic(private_key, sender_id, msg_id, mtype, params,
                               extra):
    """
    spectrum_fit_set_statistic

    
    """
    try:
        info("spectrum_fit_set_statistic()")
        ui = SherpaSession()

        try:
            ui.set_stat(params["stat"])

        except Exception, e:
            reply_error(msg_id, sedexceptions.StatisticException, e, mtype)
            return

        reply_success(msg_id, mtype)
Example #7
0
def spectrum_fit_set_data(private_key, sender_id, msg_id, mtype, params,
                          extra):
    """
    spectrum_fit_set_model

    
    """
    try:
        info("spectrum_fit_set_data()")
        ui = SherpaSession()

        try:
            ui.set_data(params["datasets"])

        except Exception, e:
            reply_error(msg_id, sedexceptions.DataException, e, mtype)
            return

        reply_success(msg_id, mtype)
Example #8
0
def load_table_fits(private_key, sender_id, msg_id, mtype, params, extra):
    """
    load_table_fits

    
    """
    try:
        info("load_table_fits()")
        ui = SherpaSession()

        try:
            # native Sherpa command
            ui.session.load_table(params["url"])

        except Exception, e:
            reply_error(msg_id, sedexceptions.DataException, e, mtype)
            return

        reply_success(msg_id, mtype)