Esempio n. 1
0
 def __init__(self,
              model_file_name=model_file_name,
              verbose=False,
              i_mag_lim=30):
     self.i_mag_lim = i_mag_lim
     self.model_file_name = model_file_name
     self.get_model(verbose=False)
     self.scarlet_param = btk_utils.Scarlet_resid_params(detect_coadd=True)
     self.iter_scarlet_param = btk_utils.Scarlet_resid_params(
         detect_centers=False)
Esempio n. 2
0
 def __init__(self,
              model_file_name=model_file_name,
              model_name=model_name,
              stretch=2731,
              input_model_mapping=True,
              input_pull=True,
              verbose=False):
     self.model_file_name = model_file_name
     self.model_name = model_name
     self.get_model(verbose=False)
     self.scarlet_param = btk_utils.Scarlet_resid_params()
     self.norm = [0., 1., 0, 1.]
     self.stretch = stretch
     self.input_model_mapping = input_model_mapping
def detection_coadd(Args):
    """Test performance for btk input blends"""
    norm = [
        1.9844158727667542, 413.83759806375525, 51.2789974336363,
        1038.4760551905683
    ]
    count = 15  #4000  # 40000
    catalog_name = os.path.join(DATA_PATH, 'OneDegSq.fits')
    # Define parameters for mrcnn model with btk here
    resid_model = btk_utils.Resid_btk_model(Args.model_name,
                                            Args.model_path,
                                            MODEL_DIR,
                                            training=False,
                                            images_per_gpu=1)
    # Load parametrs for dataset and load model
    meas_params = btk_utils.Scarlet_resid_params(detect_coadd=True)
    resid_model.make_resid_model(catalog_name,
                                 count=count,
                                 max_number=2,
                                 norm_val=norm,
                                 meas_params=meas_params)
    results = []
    # np.random.seed(0)
    for im_id in range(count):
        iter_detected, sep_detected, true = resid_model.get_detections(im_id)
        for i in range(len(true)):
            it_det, it_undet, it_spur = btk.compute_metrics.evaluate_detection(
                iter_detected[i], true[i])
            # print(it_det, it_undet, it_spur)
            if len(sep_detected[i]) == 0:
                sep_det, sep_undet, sep_spur = 0, len(true[i]), 0
            else:
                unique_sep_det_cent = np.unique(sep_detected[i], axis=0)
                sep_det, sep_undet, sep_spur = btk.compute_metrics.evaluate_detection(
                    unique_sep_det_cent, true[i])
            # print(sep_det, sep_undet, sep_spur)
            results.append([
                len(true[i]), it_det, it_undet, it_spur, sep_det, sep_undet,
                sep_spur
            ])
    arr_results = np.array(results).T
    print("Results: ", np.sum(arr_results, axis=1))
    save_file_name = f"sep_det_results_2gal_coadd_temp.txt"
    np.savetxt(save_file_name, arr_results)