How to use the radis.misc.basics.list_if_float function in radis

To help you get started, we’ve selected a few radis examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github radis / radis / radis / tools / database.py View on Github external
"isotope is now a string). Fixed this time, but regenerate " +
                 "database ASAP.") #, DeprecationWarning)
            # Fix it:
            sload['conditions']['isotope'] = ','.join([str(k) for k in
                                                       list_if_float(isotope)])
            fixed = True

    if 'dbpath' in sload['conditions']:
        dbpath = sload['conditions']['dbpath']
        if not isinstance(dbpath, string_types):
            printr("File {0}".format(basename(file))+" has a deprecrated structure (key " +
                 "dbpath is now a string). Fixed this time, but regenerate " +
                 "database ASAP.") #, DeprecationWarning)
            # Fix it:
            sload['conditions']['dbpath'] = ','.join([str(k).replace('\\', '/') for k in
                                                      list_if_float(dbpath)])  # list_if_float or just list??
            fixed = True

    if 'selfabsorption' in sload['conditions']:
        self_absorption = sload['conditions']['selfabsorption']
        sload['conditions']['self_absorption'] = self_absorption
        del sload['conditions']['selfabsorption']
        fixed = True

    # Fix all path names (if / are stored it screws up the JSON loading)
    # -----------------
    def fix_path(key):
        fixed = False
        if key in sload['conditions']:
            path = sload['conditions'][key]
            if not isinstance(path, string_types):
                printr("File {0}".format(basename(file))+" has a deprecrated structure (key " +
github radis / radis / radis / tools / database.py View on Github external
printr("File {0}".format(basename(file))+" has a deprecrated structure (key " +
             "air_pressure_mbar replaced with pressure_mbar). Fixed this time, but regenerate " +
             "database ASAP.") #, DeprecationWarning)
        sload['conditions']['pressure_mbar'] = sload['conditions'].pop(
            'air_pressure_mbar')
        fixed = True
        
    if 'isotope' in sload['conditions']:
        isotope = sload['conditions']['isotope']
        if not isinstance(isotope, string_types):
            printr("File {0}".format(basename(file))+" has a deprecrated structure (key " +
                 "isotope is now a string). Fixed this time, but regenerate " +
                 "database ASAP.") #, DeprecationWarning)
            # Fix it:
            sload['conditions']['isotope'] = ','.join([str(k) for k in
                                                       list_if_float(isotope)])
            fixed = True

    if 'dbpath' in sload['conditions']:
        dbpath = sload['conditions']['dbpath']
        if not isinstance(dbpath, string_types):
            printr("File {0}".format(basename(file))+" has a deprecrated structure (key " +
                 "dbpath is now a string). Fixed this time, but regenerate " +
                 "database ASAP.") #, DeprecationWarning)
            # Fix it:
            sload['conditions']['dbpath'] = ','.join([str(k).replace('\\', '/') for k in
                                                      list_if_float(dbpath)])  # list_if_float or just list??
            fixed = True

    if 'selfabsorption' in sload['conditions']:
        self_absorption = sload['conditions']['selfabsorption']
        sload['conditions']['self_absorption'] = self_absorption
github radis / radis / radis / lbl / factory.py View on Github external
woutrange = np.in1d(wavenumber_calc, wavenumber, assume_unique=True)
        self.wbroad_centered = wbroad_centered
        self.wavenumber = wavenumber
        self.wavenumber_calc = wavenumber_calc
        self.woutrange = woutrange

        # Init variables
        # --------------

        # Get molecule name
        if isinstance(molecule, int):
            molecule == get_molecule(molecule)

        # Store isotope identifier in str format (list wont work in database queries)
        if not isinstance(isotope, string_types):
            isotope = ','.join([str(k) for k in list_if_float(isotope)])

        # Initialize input conditions
        self.input.wavenum_min = wavenum_min
        self.input.wavenum_max = wavenum_max
        self.input.Tref = Tref
        self.input.pressure_mbar = pressure*1e3
        self.input.mole_fraction = mole_fraction

        self.input.path_length = path_length
        self.input.molecule = molecule  # if None, will be overwritten after reading database
        self.input.state = 'X'              # for the moment only ground-state is used
        # (but the code is electronic state aware)
        self.input.isotope = isotope    # if 'all', will be overwritten after reading database
        self.input.self_absorption = self_absorption

        # Initialize computation variables