当前位置: 首页>>代码示例>>Python>>正文


Python ConfigParser.getfloat方法代码示例

本文整理汇总了Python中six.moves.configparser.ConfigParser.getfloat方法的典型用法代码示例。如果您正苦于以下问题:Python ConfigParser.getfloat方法的具体用法?Python ConfigParser.getfloat怎么用?Python ConfigParser.getfloat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在six.moves.configparser.ConfigParser的用法示例。


在下文中一共展示了ConfigParser.getfloat方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setUp

# 需要导入模块: from six.moves.configparser import ConfigParser [as 别名]
# 或者: from six.moves.configparser.ConfigParser import getfloat [as 别名]
    def setUp(self):
        rid = '60754-10'
        config = ConfigParser()
        p = '/Users/ross/Sandbox/pychron_validation_data.cfg'
        config.read(p)

        signals = [list(map(float, x.split(','))) for x in [config.get('Signals-{}'.format(rid), k)
                        for k in ['ar40', 'ar39', 'ar38', 'ar37', 'ar36']]]

        blanks = [list(map(float, x.split(','))) for x in [config.get('Blanks-{}'.format(rid), k)
                        for k in ['ar40', 'ar39', 'ar38', 'ar37', 'ar36']]]

        irradinfo = [list(map(float, x.split(','))) for x in [config.get('irrad-{}'.format(rid), k) for k in ['k4039', 'k3839', 'ca3937', 'ca3837', 'ca3637', 'cl3638']]]

        j = config.get('irrad-{}'.format(rid), 'j')
        j = [float(x) for x in j.split(',')]
        baselines = [(0, 0), (0, 0), (0, 0), (0, 0), (0, 0)]
        backgrounds = [(0, 0), (0, 0), (0, 0), (0, 0), (0, 0)]

        ar37df = config.getfloat('irrad-{}'.format(rid), 'ar37df')
        t = math.log(ar37df) / (constants.lambda_37.nominal_value * 365.25)
        irradinfo.append(t)

        # load results
        r = 'results-{}'.format(rid)
        self.age = config.getfloat(r, 'age')
        self.rad4039 = config.getfloat(r, 'rad4039')
        self.ca37k39 = config.getfloat(r, 'ca37k39')


        self.age_dict = calculate_arar_age(signals, baselines, blanks, backgrounds, j, irradinfo,
                               )
开发者ID:NMGRL,项目名称:pychron,代码行数:34,代码来源:argon_calc.py

示例2: get_ic_factor

# 需要导入模块: from six.moves.configparser import ConfigParser [as 别名]
# 或者: from six.moves.configparser.ConfigParser import getfloat [as 别名]
    def get_ic_factor(self, det):
        # storing ic_factor in preferences causing issues
        # ic_factor stored in detectors.cfg

        p = os.path.join(paths.spectrometer_dir, 'detectors.cfg')
        # factors=None
        ic = 1, 0
        if os.path.isfile(p):
            c = ConfigParser()
            c.read(p)
            det = det.lower()
            for si in c.sections():
                if si.lower() == det:
                    v, e = 1, 0
                    if c.has_option(si, 'ic_factor'):
                        v = c.getfloat(si, 'ic_factor')
                    if c.has_option(si, 'ic_factor_err'):
                        e = c.getfloat(si, 'ic_factor_err')
                    ic = v, e
                    break
        else:
            self.debug('no detector file {}. cannot retrieve ic_factor'.format(p))

        r = ufloat(*ic)
        return r
开发者ID:NMGRL,项目名称:pychron,代码行数:27,代码来源:isotope_group.py

示例3: test_partial_dict

# 需要导入模块: from six.moves.configparser import ConfigParser [as 别名]
# 或者: from six.moves.configparser.ConfigParser import getfloat [as 别名]
    def test_partial_dict(self):
        name = self.make_empty_temp_file()
        to_config_file(name, "section.name", {"port_queue_dt": 1.})

        self.assertTrue(os.path.isfile(name))

        config = ConfigParser()
        config.read(name)
        self.assertTrue(config.has_section("section.name"))
        self.assertSetEqual(_VALID_KEYS, set(config.options("section.name")))
        self.assertEqual(1., config.getfloat("section.name", "port_queue_dt"))
开发者ID:csdms,项目名称:pymt,代码行数:13,代码来源:test_component_info.py

示例4: test_ignore_extra_params

# 需要导入模块: from six.moves.configparser import ConfigParser [as 别名]
# 或者: from six.moves.configparser.ConfigParser import getfloat [as 别名]
    def test_ignore_extra_params(self):
        name = self.make_empty_temp_file()
        to_config_file(
            name, "section.name", {"invalid_parameter": "empty", "port_queue_dt": 1.2}
        )

        self.assertTrue(os.path.isfile(name))

        config = ConfigParser()
        config.read(name)
        self.assertTrue(config.has_section("section.name"))
        self.assertSetEqual(_VALID_KEYS, set(config.options("section.name")))
        self.assertEqual(1.2, config.getfloat("section.name", "port_queue_dt"))
        self.assertFalse(config.has_option("section.name", "invalid_parameter"))
开发者ID:csdms,项目名称:pymt,代码行数:16,代码来源:test_component_info.py

示例5: load

# 需要导入模块: from six.moves.configparser import ConfigParser [as 别名]
# 或者: from six.moves.configparser.ConfigParser import getfloat [as 别名]
    def load(self):
        cfp = ConfigParser()
        # p = os.path.join(paths.spectrometer_dir, 'config.cfg')
        p = get_spectrometer_config_path()
        cfp.read(p)
        gs = []
        for section in cfp.sections():
            g = SpectrometerParametersGroup(name=section)
            ps = []
            for pp in cfp.options(section):
                v = cfp.getfloat(section, pp)
                ps.append(Parameter(name=pp, value=v))

            g.parameters = ps
            gs.append(g)

        self.groups = gs
开发者ID:NMGRL,项目名称:pychron,代码行数:19,代码来源:spectrometer_parameters.py

示例6: loadini

# 需要导入模块: from six.moves.configparser import ConfigParser [as 别名]
# 或者: from six.moves.configparser.ConfigParser import getfloat [as 别名]

#.........这里部分代码省略.........

    fill_config_with_default_values(config, defaults)
    if not config.read(config_path):
        # No config file. If the user has it in the old place then complain
        if os.path.isfile(os.path.expanduser('~/.bpython.ini')):
            sys.stderr.write("Error: It seems that you have a config file at "
                             "~/.bpython.ini. Please move your config file to "
                             "%s\n" % default_config_path())
            sys.exit(1)

    def get_key_no_doublebind(command):
        default_commands_to_keys = defaults['keyboard']
        requested_key = config.get('keyboard', command)

        try:
            default_command = default_keys_to_commands[requested_key]

            if (default_commands_to_keys[default_command] ==
                    config.get('keyboard', default_command)):
                setattr(struct, '%s_key' % default_command, '')
        except KeyError:
            pass

        return requested_key

    struct.config_path = config_path

    struct.dedent_after = config.getint('general', 'dedent_after')
    struct.tab_length = config.getint('general', 'tab_length')
    struct.auto_display_list = config.getboolean('general',
                                                 'auto_display_list')
    struct.syntax = config.getboolean('general', 'syntax')
    struct.arg_spec = config.getboolean('general', 'arg_spec')
    struct.paste_time = config.getfloat('general', 'paste_time')
    struct.single_undo_time = config.getfloat('general', 'single_undo_time')
    struct.highlight_show_source = config.getboolean('general',
                                                     'highlight_show_source')
    struct.hist_file = config.get('general', 'hist_file')
    struct.editor = config.get('general', 'editor')
    struct.hist_length = config.getint('general', 'hist_length')
    struct.hist_duplicates = config.getboolean('general', 'hist_duplicates')
    struct.flush_output = config.getboolean('general', 'flush_output')

    struct.pastebin_key = get_key_no_doublebind('pastebin')
    struct.copy_clipboard_key = get_key_no_doublebind('copy_clipboard')
    struct.save_key = get_key_no_doublebind('save')
    struct.search_key = get_key_no_doublebind('search')
    struct.show_source_key = get_key_no_doublebind('show_source')
    struct.suspend_key = get_key_no_doublebind('suspend')
    struct.toggle_file_watch_key = get_key_no_doublebind('toggle_file_watch')
    struct.undo_key = get_key_no_doublebind('undo')
    struct.reimport_key = get_key_no_doublebind('reimport')
    struct.up_one_line_key = get_key_no_doublebind('up_one_line')
    struct.down_one_line_key = get_key_no_doublebind('down_one_line')
    struct.cut_to_buffer_key = get_key_no_doublebind('cut_to_buffer')
    struct.yank_from_buffer_key = get_key_no_doublebind('yank_from_buffer')
    struct.clear_word_key = get_key_no_doublebind('clear_word')
    struct.backspace_key = get_key_no_doublebind('backspace')
    struct.clear_line_key = get_key_no_doublebind('clear_line')
    struct.clear_screen_key = get_key_no_doublebind('clear_screen')
    struct.delete_key = get_key_no_doublebind('delete')

    struct.left_key = get_key_no_doublebind('left')
    struct.right_key = get_key_no_doublebind('right')
    struct.end_of_line_key = get_key_no_doublebind('end_of_line')
    struct.beginning_of_line_key = get_key_no_doublebind('beginning_of_line')
开发者ID:daronwolff,项目名称:CHART_IN_REAL_TIME_socketio_python,代码行数:70,代码来源:config.py


注:本文中的six.moves.configparser.ConfigParser.getfloat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。