AnalyzeGridSearch

Bases: KPFTranslatorFunction

Description

Tool to analyze engineering data taken by the engineering.GridSearch or engineering.Run2DGridSearch scripts.

Parameters

None

Source code in kpf/engineering/analysis/AnalyzeGridSearch.py
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
class AnalyzeGridSearch(KPFTranslatorFunction):
    '''# Description
    Tool to analyze engineering data taken by the `engineering.GridSearch` or
    `engineering.Run2DGridSearch` scripts.

    # Parameters
    None
    '''
    @classmethod
    def pre_condition(cls, args, logger, cfg):
        pass

    @classmethod
    def perform(cls, args, logger, cfg):
        for logfile in args.get('logfile'):
            analyze_grid_search(logfile,
                                fiber=args.get('fiber'),
                                model_seeing=args.get('seeing'),
                                xfit=args.get('xfit'), yfit=args.get('yfit'),
                                generate_cred2=args.get('cred2'),
                                )

    @classmethod
    def post_condition(cls, args, logger, cfg):
        pass

    @classmethod
    def add_cmdline_args(cls, parser, cfg=None):
        parser.add_argument('logfile', type=str, nargs='*',
            help="The logfile or files of the grid search runs to analyze")
        ## add flags
        parser.add_argument("--cred2", dest="cred2",
            default=False, action="store_true",
            help="Generate CRED2 plots? (default = False)")
        ## add options
        parser.add_argument("--fiber", dest="fiber", type=str,
            default='Science',
            help="The fiber being examined (Science, Sky, or EMSky).")
        parser.add_argument("--seeing", dest="seeing", type=str,
            choices=['0.5', '0.7', '0.9'],
            default='0.7',
            help="The seeing model to overlay on the fiber coupling plot.")
        parser.add_argument("--xfit", dest="xfit", type=float,
            default=335.5,
            help="The X pixel position to use as the center when overlaying the model.")
        parser.add_argument("--yfit", dest="yfit", type=float,
            default=258,
            help="The X pixel position to use as the center when overlaying the model.")

        return super().add_cmdline_args(parser, cfg)