Exemple #1
0
    def on_read_initial_file(self):
        a = P4Rm()
        b = ReadFile()
        if (os.path.exists(a.PathDict['DW_file']) and
           os.path.exists(a.PathDict['Strain_file']) and
           os.path.exists(a.PathDict['XRD_file'])) is True:
            try:
                """READING DW FILE"""
                b.read_dw_file(a.PathDict['DW_file'])
                """READING Strain FILE"""
                b.read_strain_file(a.PathDict['Strain_file'])
                """READING XRD FILE"""
                b.read_xrd_file(a.PathDict['XRD_file'])
                self.on_calc_from_xrd()

                P4Rm.ParamDictbackup['dwp'] = a.ParamDict['dwp']
                P4Rm.ParamDictbackup['sp'] = a.ParamDict['sp']

                P4Rm.ParamDict['sp_abrupt'] = a.ParamDict['sp']
                P4Rm.ParamDict['dwp_abrupt'] = a.ParamDict['dwp']

                P4Rm.ParamDict['sp_smooth'] = a.ParamDict['sp']
                P4Rm.ParamDict['dwp_smooth'] = a.ParamDict['dwp']

            except TypeError:
                logger.log(logging.WARNING, "!Please check your input file!")
            else:
                return True
        else:
            msg_ = "Please, check that the input files really exists"
            dlg = GMD.GenericMessageDialog(None, msg_,
                                           "Attention", agwStyle=wx.OK |
                                           wx.ICON_INFORMATION)
            dlg.ShowModal()
            return False
Exemple #2
0
 def calc_XRD(self, paths):
     """
     Loading and extracting of XRD data file with no default extension,
     but needed a two columns format file
     """
     b = ReadFile()
     P4Rm.DefaultDict['XRD_folder'] = os.path.split(paths[0])[0]
     P4Rm.PathDict['XRD_file'] = paths[0]
     self.on_update_config_file('XRD_folder')
     try:
         """READING XRD FILE"""
         b.read_xrd_file(paths[0])
         self.on_calc_from_xrd()
         pub.sendMessage(pubsub_Draw_XRD, b=1)
     except TypeError:
         logger.log(logging.WARNING, "!Please check your input file!")
Exemple #3
0
    def on_load_project(self, paths):
        a = P4Rm()
        b = ReadFile()
        b.on_read_init_parameters(paths, p4R.ExperimentFile)
        datafromini = b.read_result_value()

        self.on_reset_deformation_multiplication()
        self.on_init_dictionnaries()

        P4Rm.ProjectFileData = datafromini[5:]

        i = 0
        for k in p4R.Exp_file_all_section:
            if k in p4R.Exp_read_only:
                P4Rm.AllDataDict[k] = float(datafromini[i])
            else:
                P4Rm.AllDataDict[k] = datafromini[i]
            i += 1

        i = 0
        for name in ['Compound_name', 'substrate_name', 'DW_file',
                     'Strain_file', 'XRD_file']:
            P4Rm.PathDict[name] = datafromini[i]
            i += 1

        P4Rm.DefaultDict['project_folder'] = os.path.split(paths)[0]
        P4Rm.PathDict['path2ini'] = os.path.split(paths)[0]
        P4Rm.PathDict['path2inicomplete'] = paths
        P4Rm.PathDict['namefromini'] = os.path.splitext(
                                           os.path.basename(paths))[0]
        self.on_update_config_file('project_folder')
        if a.ProjectFileData == []:
            msg_ = ("Please, pay attention to your input files," +
                    "there are some mistakes in the data")
            dlg = GMD.GenericMessageDialog(None, msg_, "Attention",
                                           agwStyle=wx.OK |
                                           wx.ICON_INFORMATION)
            dlg.ShowModal()
        else:
            P4Rm.PathDict['project_name'] = os.path.splitext(
                                                os.path.basename(paths))[0]

        success = self.on_read_initial_file()
        if success:
            self.on_load_and_read_data()
Exemple #4
0
 def calc_DW(self, paths=None, choice=None):
     """
     Reading and calcul DW coefficient
     """
     if paths:
         P4Rm.DefaultDict['DW_folder'] = os.path.split(paths[0])[0]
         self.on_update_config_file('DW_folder')
     a = P4Rm()
     b = ReadFile()
     c = SaveFile4Diff()
     spline_DW = a.spline_DW
     if choice == 0:
         data = b.read_dw_xy_file(paths[0])
         if spline_DW == 2:
             t = data[0].max()
             P4Rm.ParamDict['t_l'] = t/a.AllDataDict['number_slices']
             P4Rm.ParamDict['z'] = (arange(a.AllDataDict['number_slices'] +
                                    1) * a.ParamDict['t_l'])
             P4Rm.ParamDict['depth'] = t - a.ParamDict['z']
         else:
             t = a.AllDataDict['damaged_depth']
         P4Rm.ParamDict['dwp'] = fit_input_DW(data,
                                              a.AllDataDict['dw_basis_func'],
                                              a.AllDataDict['damaged_depth'],
                                              spline_DW)
     else:
         t = a.AllDataDict['damaged_depth']
     P4Rm.ParamDictbackup['dwp'] = a.ParamDict['dwp']
     P4Rm.ParamDict['dw_basis'] = float(a.AllDataDict['strain_basis_func'])
     P4Rm.ParamDict['DW_i'] = f_strain(a.ParamDict['z'],
                                       a.ParamDict['dwp'],
                                       t, spline_DW)
     self.on_shifted_dwp_curves(t)
     P4Rm.from_calc_DW = 1
     self.draw_curves()
     if choice == 0:
         c.save_deformation('DW_file', 'DW', a.ParamDict['dwp'])