Exemplo n.º 1
0
        objLinesDF = sr.import_emission_line_data(
            lineLog_file, include_lines=objParams[obj]['input_lines'])

        # Load previous measurements to compare
        true_values = check_previous_measurements(
            obj, objParams['inference_model_configuration']['parameter_list'],
            results_dict, obsData)

        # Declare extinction properties
        objRed = sr.ExtinctionModel(
            Rv=objParams['simulation_properties']['R_v'],
            red_curve=objParams['simulation_properties']['reddenig_curve'],
            data_folder=objParams['data_location']['external_data_folder'])
        # Declare ion properties
        objIons = sr.IonEmissivity(
            tempGrid=objParams['simulation_properties']['temp_grid'],
            denGrid=objParams['simulation_properties']['den_grid'])

        # Generate interpolator from the emissivity grids
        ionDict = objIons.get_ions_dict(np.unique(objLinesDF.ion.values))
        objIons.computeEmissivityGrids(objLinesDF,
                                       ionDict,
                                       combined_dict=combined_line_dict)

        # Declare chemical model
        objChem = sr.DirectMethod(
            linesDF=objLinesDF,
            highTempIons=objParams['simulation_properties']
            ['high_temp_ions_list'])

        # Declare region physical model
Exemplo n.º 2
0
                       'obsFluxErr'] = lm.linesDF.loc[~idcs_blended,
                                                      'intg_err'] / flux_Hbeta
        lm.linesDF.rename(columns={'wavelength': 'obsWave'}, inplace=True)
        lm.save_lineslog(lm.linesDF, simFolder / inputLinesLog)

        # Load emission lines
        objLinesDF = sr.import_emission_line_data(
            simFolder / inputLinesLog, include_lines=objParams['input_lines'])

        # Declare simulation physical properties
        objRed = sr.ExtinctionModel(
            Rv=objParams['R_v'],
            red_curve=objParams['reddenig_curve'],
            data_folder=objParams['external_data_folder'])

        objIons = sr.IonEmissivity(tempGrid=objParams['temp_grid'],
                                   denGrid=objParams['den_grid'])

        # Generate interpolator from the emissivity grids
        ionDict = objIons.get_ions_dict(np.unique(objLinesDF.ion.values))
        objIons.computeEmissivityGrids(
            objLinesDF,
            ionDict,
            linesDb=sr._linesDb,
            combined_dict={'O2_3726A': 'O2_3726A-O2_3729A'})

        # Declare chemical model
        objChem = sr.DirectMethod(
            linesDF=objLinesDF, highTempIons=objParams['high_temp_ions_list'])

        # Declare region physical model
        obj1_model.define_region(objLinesDF, objIons, objRed, objChem)
        n_voxels = idcs_voxels.shape[0]
        print(
            f'\nTreating {region_label} consisting of {n_voxels}. The estimated time is {(n_voxels*1.85)/60:0.1f} hrs'
        )

        # Region chemical configuration
        chem_conf_file = dataFolder / f'{obj}_chemical_model_region_{idx_region}.txt'
        chem_conf = sr.loadConfData(chem_conf_file, group_variables=False)

        # Load emission lines
        input_lines = chem_conf['inference_model_configuration']['input_lines']
        ion_array, wave_array, latex_array = lime.label_decomposition(
            input_lines)

        objIons = sr.IonEmissivity(
            tempGrid=chem_conf['simulation_properties']['temp_grid'],
            denGrid=chem_conf['simulation_properties']['den_grid'])

        ionDict = objIons.get_ions_dict(ion_array)

        # Generate interpolator from the emissivity grids
        objIons.computeEmissivityGrids(input_lines,
                                       ionDict,
                                       combined_dict=merge_dict)

        for idx_voxel, idx_pair in enumerate(idcs_voxels):

            idx_j, idx_i = idx_pair
            print(
                f'\nTreating voxel {idx_j}-{idx_i}: ({idx_voxel}/{n_voxels})')
Exemplo n.º 4
0
# Prepare dataframe with the observed lines labeled
objLinesDF = ss.import_emission_line_data(linesLogPath, include_lines=objParams['input_lines'])

# Declare extinction properties
objRed = ss.ExtinctionModel(Rv=objParams['R_v'],
                            red_curve=objParams['reddenig_curve'],
                            data_folder=objParams['external_data_folder'])

# Compute the flambda value for the input emission lines
lineFlambdas = objRed.gasExtincParams(wave=objLinesDF.obsWave.values)
lineWaves = objLinesDF.pynebCode.values

# Establish atomic data references
ftau_file_path = os.path.join(ss._literatureDataFolder, objParams['ftau_file'])
objIons = ss.IonEmissivity(ftau_file_path=ftau_file_path, tempGrid=objParams['temp_grid'],
                           denGrid=objParams['den_grid'])

# Define the dictionary with the pyneb ion objects
ionDict = objIons.get_ions_dict(np.unique(objLinesDF.ion.values))

# Compute the emissivity surfaces for the observed emission lines # TODO this database is not necesary since we duplicate the logs
objIons.computeEmissivityGrid(objLinesDF, ionDict, linesDb=ss._linesDb)

# Declare the paradigm for the chemical composition measurement
objChem = ss.DirectMethod()

# Tag the emission features for the chemical model implementation
objChem.label_ion_features(linesDF=objLinesDF, highTempIons=objParams['high_temp_ions_list'])

# Declare a dictionary with the synthetic abundances
abundDict = {}