Loads data from arbin .res files.

        Args:
            file_name (str): path to .res file.
            bad_steps (list of tuples): (c, s) tuples of steps s (in cycle c) to skip loading.

        Returns:
            new_tests (list of data objects)
964334
def loader(self, file_name, bad_steps=None, **kwargs):
        
        # TODO: @jepe - insert kwargs - current chunk, only normal data, etc

        new_tests = []
        if not os.path.isfile(file_name):
            self.logger.info("Missing file_\n   %s" % file_name)
            return None

        self.logger.debug("in loader")
        self.logger.debug("filename: %s" % file_name)

        filesize = os.path.getsize(file_name)
        hfilesize = humanize_bytes(filesize)
        txt = "Filesize: %i (%s)" % (filesize, hfilesize)
        self.logger.debug(txt)
        if filesize > prms.Instruments["max_res_filesize"] and not prms.Reader["load_only_summary"]:
            error_message = "\nERROR (loader):\n"
            error_message += "%s > %s - File is too big!\n" % (
                hfilesize, humanize_bytes(prms.Instruments["max_res_filesize"]))
            error_message += "(edit prms.Instruments['max_res_filesize'])\n"
            print(error_message)
            return None

        table_name_global = TABLE_NAMES["global"]
        table_name_stats = TABLE_NAMES["statistic"]
        table_name_normal = TABLE_NAMES["normal"]

        # creating temporary file and connection

        temp_dir = tempfile.gettempdir()
        temp_filename = os.path.join(temp_dir, os.path.basename(file_name))
        shutil.copy2(file_name, temp_dir)
        self.logger.debug("tmp file: %s" % temp_filename)

        use_mdbtools = False
        if use_subprocess:
            use_mdbtools = True
        if is_posix:
            use_mdbtools = True

        # windows with same python bit as windows bit (the ideal case)
        if not use_mdbtools:
            constr = self.__get_res_connector(temp_filename)

            if use_ado:
                conn = dbloader.connect(constr)
            else:
                conn = dbloader.connect(constr, autocommit=True)
            self.logger.debug("constr str: %s" % constr)

            self.logger.debug("reading global data table")
            sql = "select * from %s" % table_name_global
            self.logger.debug("sql statement: %s" % sql)
            global_data_df = pd.read_sql_query(sql, conn)
            # col_names = list(global_data_df.columns.values)

        else:
            import subprocess
            if is_posix:
                if is_macos:
                    self.logger.debug("\nMAC OSX USING MDBTOOLS")
                else:
                    self.logger.debug("\nPOSIX USING MDBTOOLS")
            else:
                self.logger.debug("\nWINDOWS USING MDBTOOLS-WIN")

            # creating tmp-filenames
            temp_csv_filename_global = os.path.join(temp_dir, "global_tmp.csv")
            temp_csv_filename_normal = os.path.join(temp_dir, "normal_tmp.csv")
            temp_csv_filename_stats = os.path.join(temp_dir, "stats_tmp.csv")

            # making the cmds
            mdb_prms = [(table_name_global, temp_csv_filename_global), (table_name_normal, temp_csv_filename_normal),
                        (table_name_stats, temp_csv_filename_stats)]

            # executing cmds
            for table_name, tmp_file in mdb_prms:
                with open(tmp_file, "w") as f:
                    subprocess.call([sub_process_path, temp_filename, table_name], stdout=f)
                    self.logger.debug(f"ran mdb-export {str(f)} {table_name}")

            # use pandas to load in the data
            global_data_df = pd.read_csv(temp_csv_filename_global)

        tests = global_data_df[self.headers_normal['test_id_txt']]  # OBS
        number_of_sets = len(tests)
        self.logger.debug("number of datasets: %i" % number_of_sets)

        for counter, test_no in enumerate(range(number_of_sets)):
            if counter > 0:
                self.logger.warning("***MULTITEST-FILE (not recommended)")
                if not ALLOW_MULTI_TEST_FILE:
                    break
            data = DataSet()
            data.test_no = test_no
            data.loaded_from = file_name
            fid = FileID(file_name)
            # data.parent_filename = os.path.basename(file_name)# name of the .res file it is loaded from
            data.channel_index = int(global_data_df[self.headers_global['channel_index_txt']][test_no])
            data.channel_number = int(global_data_df[self.headers_global['channel_number_txt']][test_no])
            data.creator = global_data_df[self.headers_global['creator_txt']][test_no]
            data.item_ID = global_data_df[self.headers_global['item_id_txt']][test_no]
            data.schedule_file_name = global_data_df[self.headers_global['schedule_file_name_txt']][test_no]
            data.start_datetime = global_data_df[self.headers_global['start_datetime_txt']][test_no]
            data.test_ID = int(global_data_df[self.headers_normal['test_id_txt']][test_no])  # OBS
            data.test_name = global_data_df[self.headers_global['test_name_txt']][test_no]
            data.raw_data_files.append(fid)

            self.logger.debug("reading raw-data")
            if not use_mdbtools:
                # --------- read raw-data (normal-data) -------------------------
                length_of_test, normal_df = self._load_res_normal_table(conn, data.test_ID, bad_steps)
                # --------- read stats-data (summary-data) ----------------------
                sql = "select * from %s where %s=%s order by %s" % (table_name_stats,
                                                                    self.headers_normal['test_id_txt'],
                                                                    data.test_ID,
                                                                    self.headers_normal['data_point_txt'])
                summary_df = pd.read_sql_query(sql, conn)
                if counter > number_of_sets:
                    self._clean_up_loadres(None, conn, temp_filename)
            else:
                normal_df = pd.read_csv(temp_csv_filename_normal)
                # filter on test ID
                normal_df = normal_df[normal_df[self.headers_normal['test_id_txt']] == data.test_ID]
                # sort on data point
                if prms._sort_if_subprocess:
                    normal_df = normal_df.sort_values(self.headers_normal['data_point_txt'])
                length_of_test = normal_df.shape[0]
                summary_df = pd.read_csv(temp_csv_filename_stats)
                # clean up
                for f in [temp_filename, temp_csv_filename_stats, temp_csv_filename_normal,
                          temp_csv_filename_global]:
                    if os.path.isfile(f):
                        try:
                            os.remove(f)
                        except WindowsError as e:
                            self.logger.warning(
                                f"could not remove tmp-file\n{f} {e}"
                            )

            if summary_df.empty and prms.Reader.use_cellpy_stat_file:
                txt = "\nCould not find any summary (stats-file)!"
                txt += "\n -> issue make_summary(use_cellpy_stat_file=False)"
                logging.debug(txt)
            # normal_df = normal_df.set_index("Data_Point")
            data.dfsummary = summary_df
            data.dfdata = normal_df
            data.raw_data_files_length.append(length_of_test)
            new_tests.append(data)
        return new_tests
793840
def load_data(filename):
    
    data = pandas.read_csv(filename, header=None, delimiter='\t', skiprows=9)
    return data.as_matrix()
611845
def load_datafile(name, search_path=('.'), codecs=get_codecs(), **kwargs):
    
    mod = find_datafile(name, search_path, codecs)
    if not mod:
        if 'default' in kwargs:
            return kwargs['default']
        raise IOError("file %s not found in search path %s" %(name, str(search_path)))

    (codec, datafile) = mod[0]
    return codec().load(open(datafile))
168330
def load(self, data_file = None):
        

        if not data_file:
            data_file = ''
        elif data_file[-1] != '/':
            data_file += '/'

        if data_file[-6:] != self.lazy_folder:
            data_file += self.lazy_folder
        
        data_file += self.data_filename

        self.data = self._load(data_file)
        return self
398224
def load(f, dict_=dict):
    
    if not f.read:
        raise ValueError('The first parameter needs to be a file object, ',
                         '%r is passed' % type(f))
    return loads(f.read(), dict_)
1305614
def load_rv_data(filename, indep, dep, indweight=None, dir='./'):

    

    if '/' in filename:
        path, filename = os.path.split(filename)
    else:
        path = dir

    load_file = os.path.join(path, filename)
    rvdata = np.loadtxt(load_file)

    d ={}
    d['phoebe_rv_time'] = rvdata[:,0]
    d['phoebe_rv_vel'] = rvdata[:,1]
    ncol = len(rvdata[0])

    if indweight=="Standard deviation":

        if ncol >= 3:
            d['phoebe_rv_sigmarv'] = rvdata[:,2]
        else:
            logger.warning('A sigma column is mentioned in the .phoebe file but is not present in the rv data file')
    elif indweight =="Standard weight":
                if ncol >= 3:
                    sigma = np.sqrt(1/rvdata[:,2])
                    d['phoebe_rv_sigmarv'] = sigma
                    logger.warning('Standard weight has been converted to Standard deviation.')
    else:
        logger.warning('Phoebe 2 currently only supports standard deviaton')

    return d
713826
def get_data(__pkg: str, __name: str) -> str:
    
    for dname in get_data_dirs(__pkg):
        test_path = path.join(dname, __name)
        if path.exists(test_path):
            return test_path
    raise FileNotFoundError('No data file {!r} for {!r}'.format(__name, __pkg))
1072591
def load(self, patterns, dirs, ignore=None):
        
        for _dir in dirs:
            data = self.read_file(_dir, ignore=ignore)
            if data:
                self.paths[_dir] = data
322315
def _load_version2(self,filename):
        
        self.lcount  = 0
        self.comments = {}
        self.prior_information = self.null_prior
        assert os.path.exists(filename), "couldn't find control file {0}".format(filename)
        f = open(filename, 'r')
        last_section = ""
        req_sections = {"* parameter data":False, "* observation data":False,
                        "* model command line":False,"* model input":False, "* model output":False}
        while True:

            next_section, section_lines, comments = self._read_section_comments(f, True)


            if "* control data" in last_section.lower():
                req_sections[last_section] = True
                iskeyword = False
                if "keyword" in last_section.lower():
                    iskeyword = True
                self.pestpp_options = self.control_data.parse_values_from_lines(section_lines, iskeyword=iskeyword)
                if len(self.pestpp_options) > 0:
                    ppo = self.pestpp_options
                    svd_opts = ["svdmode","eigthresh","maxsing","eigwrite"]
                    for svd_opt in svd_opts:
                        if svd_opt in ppo:
                            self.svd_data.__setattr__(svd_opt, ppo.pop(svd_opt))
                    for reg_opt in self.reg_data.should_write:
                        if reg_opt in ppo:
                            self.reg_data.__setattr__(reg_opt, ppo.pop(reg_opt))

            elif "* parameter groups" in last_section.lower():
                req_sections[last_section] = True
                self.parameter_groups = self._cast_df_from_lines(next_section, section_lines, self.pargp_fieldnames,
                                                                self.pargp_converters, self.pargp_defaults)
                self.parameter_groups.index = self.parameter_groups.pargpnme

            elif "* parameter data" in last_section.lower():
                req_sections[last_section] = True
                self.parameter_data = self._cast_df_from_lines(next_section, section_lines, self.par_fieldnames,
                                                               self.par_converters, self.par_defaults)
                self.parameter_data.index = self.parameter_data.parnme

            elif "* observation data" in last_section.lower():
                req_sections[last_section] = True
                self.observation_data = self._cast_df_from_lines(next_section, section_lines, self.obs_fieldnames,
                                                                self.obs_converters, self.obs_defaults)
                self.observation_data.index = self.observation_data.obsnme

            elif "* model command line" in last_section.lower():
                req_sections[last_section] = True
                for line in section_lines:
                    self.model_command.append(line.strip())

            elif "* model input" in last_section.lower():
                req_sections[last_section] = True
                if section_lines[0].strip().split()[0].lower() == "external":
                    filename = section_lines[0].strip().split()[1]
                    assert os.path.exists(filename),"Pst.flex_load() external template data file '{0}' not found".format(filename)
                    df = pd.read_csv(filename)
                    df.columns = df.columns.str.lower()
                    assert "pest_file" in df.columns,"Pst.flex_load() external template data file must have 'pest_file' in columns"
                    assert "model_file" in df.columns, "Pst.flex_load() external template data file must have 'model_file' in columns"
                    for pfile,mfile in zip(df.pest_file,df.model_file):
                        self.template_files.append(pfile)
                        self.input_files.append(mfile)

                else:
                    for iline,line in enumerate(section_lines):
                        raw = line.split()
                        self.template_files.append(raw[0])
                        self.input_files.append(raw[1])

            elif "* model output" in last_section.lower():
                req_sections[last_section] = True
                if section_lines[0].strip().split()[0].lower() == "external":
                    filename = section_lines[0].strip().split()[1]
                    assert os.path.exists(filename), "Pst.flex_load() external instruction data file '{0}' not found".format(
                        filename)
                    df = pd.read_csv(filename)
                    df.columns = df.columns.str.lower()
                    assert "pest_file" in df.columns, "Pst.flex_load() external instruction data file must have 'pest_file' in columns"
                    assert "model_file" in df.columns, "Pst.flex_load() external instruction data file must have 'model_file' in columns"
                    for pfile, mfile in zip(df.pest_file, df.model_file):
                        self.instruction_files.append(pfile)
                        self.output_files.append(mfile)
                else:
                    for iline, line in enumerate(section_lines):
                        raw = line.split()
                        self.instruction_files.append(raw[0])
                        self.output_files.append(raw[1])

            elif "* prior information" in last_section.lower():
                req_sections[last_section] = True
                self._cast_prior_df_from_lines(section_lines)

            elif len(last_section) > 0:
                print("Pst._load_version2() warning: unrecognized section: ", last_section)
                self.comments[last_section] = section_lines

            last_section = next_section
            if next_section == None or len(section_lines) == 0:
                break

        not_found = []
        for section,found in req_sections.items():
            if not found:
                not_found.append(section)
        if len(not_found) > 0:
            raise Exception("Pst._load_version2() error: the following required sections were"+\
                    "not found:{0}".format(",".join(not_found)))
657774
def handle_data(self, data, new_file=False, flush=True):
        '''
        '''
        for i, module_id in enumerate(self._selected_modules):
            if data[i] is None:
                continue
            self._raw_data_files[module_id].append(data_iterable=data[i], scan_parameters=self._scan_parameters[module_id]._asdict(), new_file=new_file, flush=flush)
255638
function loadFileData(fileName) {
    var testConfig = this.testConfig;
    if (!testConfig) {
        throw new Error('No test configuration found.\n' +
            'You can add one by adding a property called `testConfig` to the word object.');
    }
    var testDataRoot = testConfig.testDataRoot;
    if (!testDataRoot) {
        throw new Error('No test data root path found.\n' +
            'You can add one by adding a property called `testDataRoot` to the test configuration.');
    }
    var filePath = path.join(testDataRoot, fileName);
    this._log.trace({ path: filePath }, 'Loading file.');

    //Don't use `require` because that caches the returned object.
    var value = require('fs').createReadStream(filePath);
    this._log.trace({ loadedData: value }, 'File loaded.');
    return value;
}
701955
def load_from_filename(self, file_name, sep='\n'):
        """"""
        fp = open(file_name, 'rb')
        n = self.load_from_file(fp, sep)
        fp.close()
        return n
860823
def _load(self, data_file):
        

       # Load the data from a file.
        try:
            data = Schema().load(data_file)
        except (Exception, IOError, ValueError) as e:
            raise e

        return data
786048
def load_file(file_name)
      File.open(file_name, "r") do |f|
        f.each_line.collect do |line|
          parse_json(line)
        end
      end
    end
643962
def FindFileByName(self, file_name):
    

    try:
      return self._file_descriptors[file_name]
    except KeyError:
      pass

    try:
      file_proto = self._internal_db.FindFileByName(file_name)
    except KeyError as error:
      if self._descriptor_db:
        file_proto = self._descriptor_db.FindFileByName(file_name)
      else:
        raise error
    if not file_proto:
      raise KeyError('Cannot find a file named %s' % file_name)
    return self._ConvertFileProtoToFileDescriptor(file_proto)
1161526
def load_filename(self, filename, index=None):
        
        filename = str(filename)  # QString protection
        if index is None:
            index = self._get_tab_index()
        page = self.pages[index]

        # Maybe this is set on purpose before loading attempt to leave new load_dir set (?)
        self.load_dir, _ = os.path.split(filename)

        clss = page.clss_load
        if len(clss) == 1:
            # If there is only one class to handle the file, will load it in a way that eventual
            # load errors will raise
            f = clss[0]()
            f.load(filename)
        else:
            # At the moment, the multi-class alternative will not display particular error information
            # if the file does not load
            f = f311.load_with_classes(filename, page.clss_load)
            if f is None:
                raise RuntimeError("Could not load '{0!s}'".format(filename))

        self.load(f, index)
1356551
def step_a_file_named_filename_with(context, filename):
    """"""
    step_a_file_named_filename_and_encoding_with(context, filename, "UTF-8")

    # -- SPECIAL CASE: For usage with behave steps.
    if filename.endswith(".feature"):
        command_util.ensure_context_attribute_exists(context, "features", [])
        context.features.append(filename)