def test_save_and_read_excel_without_name(tmpdir):
    original_fitting_data = FittingData(data=RAW_DATA)
    original_fitting_data.save_excel(tmpdir, sheet=SHEET_NAME)
    loaded_fitting_data = FittingData.read_from_excel(
        Path(tmpdir / "fitting_data.xlsx"), SHEET_NAME)

    assert_fitting_data_are_equal(original_fitting_data, loaded_fitting_data)
Exemple #2
0
    def read_excel(self, filepath, sheet):
        """
        Read data from excel file.

        :param filepath: path of the excel file
        :param sheet: sheet from which to read the data.
        """
        self.fitting_data = FittingData.read_from_excel(filepath, sheet)
Exemple #3
0
    def select_default_sheet(self):
        """
        Automatically choose the first valid sheet.

        If it fails to find a valid sheet, resets the input file.
        """
        for sheet in self.input_file_box.sheets_options:
            if sheet != NO_VALUE:
                try:
                    self.data_columns_box.fitting_data = FittingData.read_from_excel(
                        Path(self.input_file_box.file_path), sheet)
                    self.input_file_box.selected_sheet = sheet
                    return
                except FittingDataError:
                    pass

        if self.data_columns_box.fitting_data is None:
            self.main_window.error_dialog(
                title="Input data error",
                message=("No sheet available with valid data.\n"
                         "Please fix the file or load another one."),
            )
            self.input_file_box.file_path = None
 def actual_read(file_path, **kwargs):
     return FittingData.read_from_excel(file_path, SHEET_NAME, **kwargs)
Exemple #5
0
 def read_method(**kwargs):
     return FittingData.read_from_excel(EXCEL_FILE, sheet_name, **kwargs)