Exemplo n.º 1
0
 def __init__(self, frame, *args, **kwargs):
     Handler.__init__(self, *args, **kwargs)
     self.add_trait('frame', frame)
     self.add_trait('instrument', "")
     #Make it change the linked object to reflect the current instrument state.
     self.revert()
     self.check_validity()
Exemplo n.º 2
0
 def __init__(self, frame, *args, **kwargs):
     Handler.__init__(self, *args, **kwargs)
     self.add_trait('frame', frame)
     self.add_trait('instrument', "")
     #Make it change the linked object to reflect the current instrument state.
     self.revert()
     self.check_validity()
Exemplo n.º 3
0
 def closed(self,info,is_ok):
     trackParams = info.object
     par_path = trackParams.par_path
     Handler.closed(self,info,is_ok)
     if is_ok:
         par.TrackingParams(trackParams.dvxmin, trackParams.dvxmax,
         trackParams.dvymin, trackParams.dvymax,
         trackParams.dvzmin, trackParams.dvzmax,
         trackParams.angle, trackParams.dacc,
         trackParams.flagNewParticles, path = par_path).write()
Exemplo n.º 4
0
 def closed(self,info,is_ok):
     trackParams = info.object
     par_path = trackParams.par_path
     Handler.closed(self,info,is_ok)
     if is_ok:
         par.TrackingParams(trackParams.dvxmin, trackParams.dvxmax,
         trackParams.dvymin, trackParams.dvymax,
         trackParams.dvzmin, trackParams.dvzmax,
         trackParams.angle, trackParams.dacc,
         trackParams.flagNewParticles, path = par_path).write()
Exemplo n.º 5
0
    def closed(self,info,is_ok):
        calibParams = info.object
        par_path = calibParams.par_path
        Handler.closed(self,info,is_ok)
        if is_ok:
            img_cal_name = [calibParams.cam_1, calibParams.cam_2,calibParams.cam_3,calibParams.cam_4]
            img_ori =[calibParams.ori_cam_1,calibParams.ori_cam_2,calibParams.ori_cam_3,calibParams.ori_cam_4]
            nr1 = [calibParams.img_1_p1,calibParams.img_1_p2,calibParams.img_1_p3,calibParams.img_1_p4]
            nr2 = [calibParams.img_2_p1,calibParams.img_2_p2,calibParams.img_2_p3,calibParams.img_2_p4]
            nr3 = [calibParams.img_3_p1,calibParams.img_3_p2,calibParams.img_3_p3,calibParams.img_3_p4]
            nr4 = [calibParams.img_4_p1,calibParams.img_4_p2,calibParams.img_4_p3,calibParams.img_4_p4]
            
            nr = [nr1, nr2, nr3, nr4]
    

            if(calibParams.chfield == "Frame"):
                chfield = 0
            elif (calibParams.chfield == "Field odd"):
                chfield = 1
            else :
                chfield = 2
            par.PtvParams(calibParams.n_img, calibParams.img_name,\
                                 calibParams.img_cal, calibParams.hp_flag,\
                                 calibParams.allCam_flag, calibParams.tiff_head, calibParams.h_image_size, \
                                 calibParams.v_image_size,calibParams.h_pixel_size, calibParams.v_pixel_size, chfield,\
                                 calibParams.mmp_n1, calibParams.mmp_n2, \
                                 calibParams.mmp_n3, calibParams.mmp_d, path = par_path).write()

            par.CalOriParams(calibParams.n_img,calibParams.fixp_name,\
                                     img_cal_name,img_ori,calibParams.tiff_head,\
                                     calibParams.pair_head, chfield, path = par_path).write()

            par.DetectPlateParams(calibParams.grey_value_treshold_1, \
                                          calibParams.grey_value_treshold_2, \
                                          calibParams.grey_value_treshold_3, \
                                          calibParams.grey_value_treshold_4, \
                                          calibParams.tolerable_discontinuity, \
                                          calibParams.min_npix, calibParams.max_npix, \
                                          calibParams.min_npix_x, calibParams.max_npix_x, \
                                          calibParams.min_npix_y, calibParams.max_npix_y, \
                                          calibParams.sum_of_grey, \
                                          calibParams.size_of_crosses, path = par_path).write()

            par.ManOriParams(calibParams.n_img, 4, nr, path = par_path).write()
            par.ExamineParams(calibParams.Examine_Flag,calibParams.Combine_Flag, path = par_path).write()
            par.OrientParams(calibParams.point_number_of_orientation, calibParams.principle_distance,\
                                     calibParams.xp, calibParams.yp, calibParams.k1, calibParams.k2,\
                                     calibParams.k3, calibParams.p1, calibParams.p2,\
                                     calibParams.scx, calibParams.she,calibParams.interf, path = par_path).write()
            par.ShakingParams(calibParams.shaking_first_frame, calibParams.shaking_last_frame, \
                                    calibParams.shaking_max_num_points, calibParams.shaking_max_num_frames, path = par_path).write()
            
            par.DumbbellParams(calibParams.dumbbell_eps,calibParams.dumbbell_scale,\
                                    calibParams.dumbbell_gradient_descent,calibParams.dumbbell_penalty_weight,\
                                    calibParams.dumbbell_step,calibParams.dumbbell_niter, path = par_path).write()
Exemplo n.º 6
0
    def closed(self,info,is_ok):
        calibParams = info.object
        par_path = calibParams.par_path
        Handler.closed(self,info,is_ok)
        if is_ok:
            img_cal_name = [calibParams.cam_1, calibParams.cam_2,calibParams.cam_3,calibParams.cam_4]
            img_ori =[calibParams.ori_cam_1,calibParams.ori_cam_2,calibParams.ori_cam_3,calibParams.ori_cam_4]
            nr1 = [calibParams.img_1_p1,calibParams.img_1_p2,calibParams.img_1_p3,calibParams.img_1_p4]
            nr2 = [calibParams.img_2_p1,calibParams.img_2_p2,calibParams.img_2_p3,calibParams.img_2_p4]
            nr3 = [calibParams.img_3_p1,calibParams.img_3_p2,calibParams.img_3_p3,calibParams.img_3_p4]
            nr4 = [calibParams.img_4_p1,calibParams.img_4_p2,calibParams.img_4_p3,calibParams.img_4_p4]
            
            nr = [nr1, nr2, nr3, nr4]
    

            if(calibParams.chfield == "Frame"):
                chfield = 0
            elif (calibParams.chfield == "Field odd"):
                chfield = 1
            else :
                chfield = 2
            par.PtvParams(calibParams.n_img, calibParams.img_name,\
                                 calibParams.img_cal, calibParams.hp_flag,\
                                 calibParams.allCam_flag, calibParams.tiff_head, calibParams.h_image_size, \
                                 calibParams.v_image_size,calibParams.h_pixel_size, calibParams.v_pixel_size, chfield,\
                                 calibParams.mmp_n1, calibParams.mmp_n2, \
                                 calibParams.mmp_n3, calibParams.mmp_d, path = par_path).write()

            par.CalOriParams(calibParams.n_img,calibParams.fixp_name,\
                                     img_cal_name,img_ori,calibParams.tiff_head,\
                                     calibParams.pair_head, chfield, path = par_path).write()

            par.DetectPlateParams(calibParams.grey_value_treshold_1, \
                                          calibParams.grey_value_treshold_2, \
                                          calibParams.grey_value_treshold_3, \
                                          calibParams.grey_value_treshold_4, \
                                          calibParams.tolerable_discontinuity, \
                                          calibParams.min_npix, calibParams.max_npix, \
                                          calibParams.min_npix_x, calibParams.max_npix_x, \
                                          calibParams.min_npix_y, calibParams.max_npix_y, \
                                          calibParams.sum_of_grey, \
                                          calibParams.size_of_crosses, path = par_path).write()

            par.ManOriParams(calibParams.n_img, 4, nr, path = par_path).write()
            par.ExamineParams(calibParams.Examine_Flag,calibParams.Combine_Flag, path = par_path).write()
            par.OrientParams(calibParams.point_number_of_orientation, calibParams.principle_distance,\
                                     calibParams.xp, calibParams.yp, calibParams.k1, calibParams.k2,\
                                     calibParams.k3, calibParams.p1, calibParams.p2,\
                                     calibParams.scx, calibParams.she,calibParams.interf, path = par_path).write()
            par.ShakingParams(calibParams.shaking_first_frame, calibParams.shaking_last_frame, \
                                    calibParams.shaking_max_num_points, calibParams.shaking_max_num_frames, path = par_path).write()
            
            par.DumbbellParams(calibParams.dumbbell_eps,calibParams.dumbbell_scale,\
                                    calibParams.dumbbell_gradient_descent,calibParams.dumbbell_penalty_weight,\
                                    calibParams.dumbbell_step,calibParams.dumbbell_niter, path = par_path).write()
 def setattr(self, info, object, name, value):
     """Called when any attribute is set."""
     #The parent class actually sets the value
     Handler.setattr(self, info, object, name, value)
     self.changed_point(object)
     #Choosing another reflection, or a different detector,
     # or switching to arbitrary mode
     if name in ["hkl", "detector", "brute_search", 
                 "arbitrary_bool", "arbitrary_xyz", "arbitrary_width"]:
         #Make sure the plot detector points to the right one
         self.frame.detectorPlot.set_detector(self.frame.placer.get_detector())
         #Make the map recalculate
         self.frame.map_thread.reset()
Exemplo n.º 8
0
    def setattr(self, info, object, name, value):
        # if object._manphasing and name != 'ph_man_btn':
        #    print name, value
        #    return

        Handler.setattr(self, info, object, name, value)
        # if name == 'ph_man_btn':
        #    if not object._manphasing:
        #        info.ph_man_btn.label = 'Manual'
        #    elif object._manphasing:
        #        info.ph_man_btn.label = 'Manual*'

        if name == "ft_btn":
            if object.fid._flags["ft"]:
                info.ft_btn.label = "FT*"
Exemplo n.º 9
0
    def closed(self, info, is_ok):
        mainParams = info.object
        par_path = mainParams.par_path
        Handler.closed(self, info, is_ok)
        if is_ok:
            img_name = [mainParams.Name_1_Image, mainParams.Name_2_Image,\
               mainParams.Name_3_Image, mainParams.Name_4_Image]
            img_cal_name = [mainParams.Cali_1_Image, mainParams.Cali_2_Image,\
                mainParams.Cali_3_Image,mainParams.Cali_4_Image]

            gvthres = [mainParams.Gray_Tresh_1,mainParams.Gray_Tresh_2,\
                 mainParams.Gray_Tresh_3,mainParams.Gray_Tresh_4]
            base_name = [mainParams.Basename_1_Seq, mainParams.Basename_2_Seq,\
                mainParams.Basename_3_Seq, mainParams.Basename_4_Seq]
            X_lay = [mainParams.Xmin, mainParams.Xmax]
            Zmin_lay = [mainParams.Zmin1, mainParams.Zmin2]
            Zmax_lay = [mainParams.Zmax1, mainParams.Zmax2]

            #write ptv_par
            par.PtvParams(mainParams.Num_Cam, img_name, img_cal_name,\
                  mainParams.HighPass, mainParams.Accept_OnlyAllCameras,\
                  mainParams.tiff_flag, mainParams.imx, mainParams.imy,\
                  mainParams.pix_x, mainParams.pix_y, mainParams.chfield,\
                  mainParams.Refr_Air, mainParams.Refr_Glass, \
                  mainParams.Refr_Water, mainParams.Thick_Glass, path = par_path).write()
            #write calibration parameters
            par.CalOriParams(mainParams.Num_Cam,mainParams.fixp_name,\
                   mainParams.img_cal_name,mainParams.img_ori,mainParams.tiff_flag,\
                   mainParams.pair_Flag,mainParams.chfield, path = par_path).write()

            #write targ_rec_par
            par.TargRecParams(mainParams.Num_Cam, gvthres, mainParams.Tol_Disc,\
                    mainParams.Min_Npix ,mainParams.Max_Npix,\
                    mainParams.Min_Npix_x, mainParams.Max_Npix_x,\
                    mainParams.Min_Npix_y, mainParams.Max_Npix_y,\
                    mainParams.Sum_Grey, mainParams.Size_Cross, path = par_path).write()
            #write pft_version_par
            par.PftVersionParams(mainParams.Existing_Target,
                                 path=par_path).write()
            #write sequence_par
            par.SequenceParams(mainParams.Num_Cam, base_name,\
                     mainParams.Seq_First, mainParams.Seq_Last, path = par_path).write()
            #write criteria_par
            par.CriteriaParams(X_lay,Zmin_lay,Zmax_lay,mainParams.Min_Corr_nx,\
                    mainParams.Min_Corr_ny,mainParams.Min_Corr_npix ,\
                    mainParams.Sum_gv,mainParams.Min_Weight_corr ,\
                    mainParams.Tol_Band, path = par_path).write()
Exemplo n.º 10
0
    def closed(self,info,is_ok):
        mainParams = info.object
        par_path = mainParams.par_path
        Handler.closed(self,info,is_ok)
        if is_ok:
            img_name = [mainParams.Name_1_Image, mainParams.Name_2_Image,\
                        mainParams.Name_3_Image, mainParams.Name_4_Image]    
            img_cal_name = [mainParams.Cali_1_Image, mainParams.Cali_2_Image,\
                            mainParams.Cali_3_Image,mainParams.Cali_4_Image]

            gvthres = [mainParams.Gray_Tresh_1,mainParams.Gray_Tresh_2,\
                       mainParams.Gray_Tresh_3,mainParams.Gray_Tresh_4]
            base_name = [mainParams.Basename_1_Seq, mainParams.Basename_2_Seq,\
                         mainParams.Basename_3_Seq, mainParams.Basename_4_Seq]
            X_lay = [mainParams.Xmin, mainParams.Xmax]
            Zmin_lay = [mainParams.Zmin1, mainParams.Zmin2]
            Zmax_lay = [mainParams.Zmax1, mainParams.Zmax2]
            
            #write ptv_par
            par.PtvParams(mainParams.Num_Cam, img_name, img_cal_name,\
                                 mainParams.HighPass, mainParams.Accept_OnlyAllCameras,\
                                 mainParams.tiff_flag, mainParams.imx, mainParams.imy,\
                                 mainParams.pix_x, mainParams.pix_y, mainParams.chfield,\
                                 mainParams.Refr_Air, mainParams.Refr_Glass, \
                                 mainParams.Refr_Water, mainParams.Thick_Glass, path = par_path).write()
            #write calibration parameters
            par.CalOriParams(mainParams.Num_Cam,mainParams.fixp_name,\
                                     mainParams.img_cal_name,mainParams.img_ori,mainParams.tiff_flag,\
                                     mainParams.pair_Flag,mainParams.chfield, path = par_path).write()

            #write targ_rec_par
            par.TargRecParams(mainParams.Num_Cam, gvthres, mainParams.Tol_Disc,\
                                      mainParams.Min_Npix ,mainParams.Max_Npix,\
                                      mainParams.Min_Npix_x, mainParams.Max_Npix_x,\
                                      mainParams.Min_Npix_y, mainParams.Max_Npix_y,\
                                      mainParams.Sum_Grey, mainParams.Size_Cross, path = par_path).write()
            #write pft_version_par
            par.PftVersionParams(mainParams.Existing_Target, path = par_path).write()
            #write sequence_par
            par.SequenceParams(mainParams.Num_Cam, base_name,\
                                       mainParams.Seq_First, mainParams.Seq_Last, path = par_path).write()
            #write criteria_par
            par.CriteriaParams(X_lay,Zmin_lay,Zmax_lay,mainParams.Min_Corr_nx,\
                                      mainParams.Min_Corr_ny,mainParams.Min_Corr_npix ,\
                                      mainParams.Sum_gv,mainParams.Min_Weight_corr ,\
                                      mainParams.Tol_Band, path = par_path).write()
Exemplo n.º 11
0
    def test_demo_init_no_children_to_be_set(self):
        # Test if there are no children, nothing is selected.
        model = DemoVirtualDirectory(resources=[])
        demo = Demo(model=model)
        demo.selected_node = None

        # when
        info = UIInfo(ui=UI(handler=Handler()))
        demo.init(info)

        # then
        self.assertIsNone(demo.selected_node)
Exemplo n.º 12
0
    def test_demo_init_set_children(self):
        # Test if there are children, the first one will be selected.
        resources = [DemoPath(), DemoPath()]
        model = DemoVirtualDirectory(resources=resources)
        demo = Demo(model=model)
        demo.selected_node = None

        # when
        info = UIInfo(ui=UI(handler=Handler()))
        demo.init(info)

        # then
        self.assertIs(demo.selected_node, resources[0])
Exemplo n.º 13
0
 def setattr(self, info, object, name, value):
     Handler.setattr(self, info, object, name, value)
     info.object._updated = True
Exemplo n.º 14
0
 def close(self, info, is_ok):
     # would be nice to close the profile plot
     # but easier said than done
     # tip: info.ui.dispose()
     return Handler.close(self, info, is_ok)
Exemplo n.º 15
0
 def setattr(self, info, object, name, value):
     Handler.setattr(self, info, object, name, value)
Exemplo n.º 16
0
 def setattr(self, info, object, name, value):
     """Called when any attribute is set."""
     #The parent class actually sets the value
     Handler.setattr(self, info, object, name, value)
     #Do other checks
     self.check_validity()
Exemplo n.º 17
0
 def __init__(self, frame, *args, **kwargs):
     Handler.__init__(self, *args, **kwargs)
     self.add_trait('frame', frame)
     self.add_trait('user_clicked_okay', False)
Exemplo n.º 18
0
 def setattr(self, info, object, name, value):
     """Called when any attribute is set."""
     Handler.setattr(self, info, object, name, value)
     self.check_validity()
Exemplo n.º 19
0
 def perform(self, info, action, event):
     if action.id == 'Apply':
         self._save_configuration_changes(info)
     else:
         Handler.perform(self, info, action, event)
Exemplo n.º 20
0
 def setattr(self, info, object, name ,value):
     Handler.setattr(self, info, object, name, value)
     info.object._updated = True
Exemplo n.º 21
0
 def setattr(self, info, object, name, value):
     """Called when any attribute is set."""
     #The parent class actually sets the value
     Handler.setattr(self, info, object, name, value)
     #Do other checks
     self.check_validity()
Exemplo n.º 22
0
 def __init__(self, frame, *args, **kwargs):
     Handler.__init__(self, *args, **kwargs)
     self.add_trait('frame', frame)
     self.add_trait('user_clicked_okay', False)
Exemplo n.º 23
0
 def setattr(self, info, object, name, value):
     """Called when any attribute is set."""
     Handler.setattr(self, info, object, name, value)
     self.check_validity()
Exemplo n.º 24
0
	def closed(self,info,is_ok):
		Handler.closed(self,info,is_ok)
		if is_ok:
			print "Michael:", info.object.dvxmin, type(info.object.dvxmin)
			info.object.write()
 def edit_traits(self, *args, **kws):
     main(embedded=True)
     return UI(handler=Handler())
Exemplo n.º 26
0
 def closed(self, info, is_ok):
     Handler.closed(self, info, is_ok)
     if is_ok:
         print "Michael:", info.object.dvxmin, type(info.object.dvxmin)
         info.object.write()
Exemplo n.º 27
0
 def setattr(self, info, object, name, value):
     Handler.setattr(self, info, object, name, value)
 def __init__(self, frame, *args, **kwargs):
     Handler.__init__(self, *args, **kwargs)
     self.add_trait('frame', frame)