Пример #1
0
def fit_one_cube(plt,
                 ifu,
                 drpall_file=None,
                 directory_path=None,
                 analysis_path=None):
    # Grab the required input parameters
    config_file = '{0}-{1}.cfg'.format(plt, ifu)
    get_config(plt, ifu, config_file, drpall_file=drpall_file)

    # Read the datacube
    cube = MaNGADataCube.from_config(config_file,
                                     directory_path=directory_path)

    # Define how you want to analyze the data
    plan = AnalysisPlanSet([
        AnalysisPlan(
            drpqa_key='SNRG',
            bin_key='VOR10',  #'HYB10',
            continuum_key='MILESHCMPL10',
            elmom_key='EMOMMPL10',
            elfit_key='EFITMPL10',  #'EFITMPL9DB',
            spindex_key='INDXEN')
    ])

    # Run it!
    return manga_dap(cube,
                     plan,
                     verbose=2,
                     directory_path=directory_path,
                     analysis_path=analysis_path)
Пример #2
0
    def main(args):

        #        import warnings
        #        warnings.simplefilter('error', DeprecationWarning)
        from mangadap.config.analysisplan import AnalysisPlan
        from mangadap.survey.manga_dap import manga_dap
        from mangadap.datacube import DataCube
        from mangadap.util.pkg import load_object

        # Execute the MaNGA DAP for a single datacube

        #   - Import the module used to read the datacube
        if isinstance(args.cube_module, list) and len(args.cube_module) > 2:
            raise ValueError(
                'Provided cube module must be one or two strings.')
        if isinstance(args.cube_module, str) or len(args.cube_module) == 1:
            UserDataCube = load_object(args.cube_module if isinstance(
                args.cube_module, str) else args.cube_module[0])
        else:
            UserDataCube = load_object(args.cube_module[0],
                                       obj=args.cube_module[1])
        #   - Check that the class is derived from DataCube
        if not issubclass(UserDataCube, DataCube):
            raise TypeError(
                'Defined cube object must subclass from mangadap.datacube.DataCube.'
            )

        #   - Import the module used to set the analysis plan
        if isinstance(args.plan_module, list) and len(args.plan_module) > 2:
            raise ValueError(
                'Provided plan module must be one or two strings.')
        if isinstance(args.plan_module, str) or len(args.plan_module) == 1:
            UserPlan = load_object(args.plan_module if isinstance(
                args.plan_module, str) else args.plan_module[0])
        else:
            UserPlan = load_object(args.plan_module[0],
                                   obj=args.plan_module[1])
        #   - Check that the class is derived from AnalysisPlan
        if not issubclass(UserPlan, AnalysisPlan):
            raise TypeError('Defined plan object must subclass from '
                            'mangadap.config.analysisplan.AnalysisPlan')

        #   - Instantiate the datacube object using either the datacube file
        #     directly or a configuration file
        cube = UserDataCube(args.cubefile) if args.config is None \
                    else UserDataCube.from_config(args.config)

        #   - Read the analysis plan
        plan = UserPlan.default(cube=cube, analysis_path=args.output_path) if args.plan is None \
                    else UserPlan.from_toml(args.plan, cube=cube, analysis_path=args.output_path)

        #   - Run the pipeline
        status = manga_dap(cube,
                           plan,
                           dbg=args.dbg,
                           log=args.log,
                           verbose=args.verbose)
Пример #3
0
def fit_one_cube(plt, ifu, drpall_file=None, directory_path=None, analysis_path=None):
    # Grab the required input parameters
    obs = get_obsinput(plt, ifu, drpall_file='./data/drpall-v2_4_3.fits')

    # Define how you want to analyze the data
    plan = AnalysisPlanSet([ AnalysisPlan(drpqa_key='SNRG',
                                          bin_key='VOR10',
                                          continuum_key='GAU-MILESHC',
                                          elmom_key='EMOMM',
                                          elfit_key='EFITM-MIUSCATTHIN',
                                          spindex_key='INDXEN') ])
    # Run it!
    return manga_dap(obs, plan, verbose=2, directory_path='./data', analysis_path='./output')
Пример #4
0
def main(args):
    # Instantiate the DataCube
    #   - Try to import the module
    try:
        CubeModule = importlib.import_module(args.cube_module)
    except (ModuleNotFoundError, ImportError) as e:
        raise ImportError('Cube module {0} import failed!'.format(
            args.cube_module)) from e
    #   - Try to import the class
    UserDataCube = getattr(CubeModule, args.cube_object)
    #   - Check that the class is derived from DataCube
    if not issubclass(UserDataCube, DataCube):
        raise TypeError(
            'Defined cube object must subclass from mangadap.datacube.DataCube.'
        )
    #   - Instantiate using either the datacube file directly or a
    #     configuration file
    cube = UserDataCube(args.cubefile) if args.config is None \
                else UserDataCube.from_config(args.config, drpver=args.drpver,
                                              redux_path=args.redux_path,
                                              directory_path=args.directory_path)

    # Read the analysis plan
    analysisplan = AnalysisPlanSet.default() if args.plan is None \
                        else AnalysisPlanSet.from_par_file(args.plan)

    # Run the pipeline
    status = manga_dap(cube,
                       analysisplan,
                       dbg=args.dbg,
                       log=args.log,
                       verbose=args.verbose,
                       drpver=args.drpver,
                       redux_path=args.redux_path,
                       directory_path=args.directory_path,
                       dapver=args.dapver,
                       analysis_path=args.analysis_path)
Пример #5
0
        '--dap_src',
        type=str,
        help=
        'Top-level directory with the DAP source code; defaults to $MANGADAP_DIR',
        default=None)
    parser.add_argument(
        '-a',
        '--analysis_path',
        type=str,
        help=
        'Top-level output directory for the DAP results; defaults to $MANGA_SPECTRO_ANALYSIS/$MANGADRP_VER/$MANGADAP_VER',
        default=None)

    arg = parser.parse_args()
    obspar = ObsInputPar.from_par_file(arg.obs)
    analysisplan = AnalysisPlanSet.from_par_file(arg.plan)

    status = manga_dap(obspar,
                       analysisplan,
                       dbg=arg.dbg,
                       log=arg.log,
                       verbose=arg.verbose,
                       drpver=arg.drpver,
                       redux_path=arg.redux_path,
                       directory_path=arg.directory_path,
                       dapver=arg.dapver,
                       dapsrc=arg.dap_src,
                       analysis_path=arg.analysis_path)

    print('Elapsed time: {0} seconds'.format(clock() - t))