Пример #1
0
    def test1(self):
        """Testing the waypoint function for various arbitrary inputs"""

        comps = []
        intTimes = [] * u.d
        self.assertDictEqual(wp.waypoint(comps, intTimes, 365, None, None), {
            "numStars": 0,
            "Total Completeness": 0,
            "Total intTime": 0
        })

        comps = [1, 2, 3]
        intTimes = [1, 2, 3] * u.d
        self.assertDictEqual(wp.waypoint(comps, intTimes, 365, None, None), {
            "numStars": 3,
            "Total Completeness": 6,
            "Total intTime": 6 * u.d
        })

        comps = [3, 3, 3]
        intTimes = [180, 180, 180] * u.d
        self.assertDictEqual(wp.waypoint(comps, intTimes, 365, None, None), {
            "numStars": 2,
            "Total Completeness": 6,
            "Total intTime": 360 * u.d
        })
Пример #2
0
    def genWaypoint(self, duration=365, tofile=None):
        """generates a ballpark estimate of the expected number of star visits and
        the total completeness of these visits for a given mission duration
        
        Args:
            duration (int):
                The length of time allowed for the waypoint calculation, defaults to 365
            tofile (string):
                Name of the file containing a plot of total completeness over mission time,
                by default genWaypoint does not create this plot

        Returns:
            out (dictionary):
                Output dictionary containing the number of stars visited, the total completness
                achieved, and the amount of time spent integrating.

        """
        SS = self.SurveySimulation
        OS = SS.OpticalSystem
        ZL = SS.ZodiacalLight
        Comp = SS.Completeness
        TL = SS.TargetList
        Obs = SS.Observatory
        TK = SS.TimeKeeping

        # Only considering detections
        allModes = OS.observingModes
        det_mode = filter(lambda mode: mode['detectionMode'] == True,
                          allModes)[0]
        mpath = os.path.split(inspect.getfile(self.__class__))[0]

        startTimes = TK.currentTimeAbs + np.zeros(TL.nStars) * u.d
        sInds = np.arange(TL.nStars)
        fZ = ZL.fZ(Obs, TL, sInds, startTimes, det_mode)
        fEZ = ZL.fEZ0
        fEZ = np.ones(sInds.shape) * fEZ
        dMag = SS.dMagint
        WA = SS.WAint

        # sort star indices by completeness diveded by integration time
        intTimes = OS.calc_intTime(TL, sInds, fZ, fEZ, dMag, WA, det_mode)
        comps = Comp.comp_per_intTime(intTimes, TL, sInds, fZ, fEZ, WA[0],
                                      det_mode)
        wp = waypoint(comps, intTimes, duration, mpath, tofile)

        return wp
Пример #3
0
    def genWaypoint(self, duration=365, tofile=None):
        """generates a ballpark estimate of the expected number of star visits and
        the total completeness of these visits for a given mission duration
        
        Args:
            duration (int):
                The length of time allowed for the waypoint calculation, defaults to 365
            tofile (string):
                Name of the file containing a plot of total completeness over mission time,
                by default genWaypoint does not create this plot

        Returns:
            out (dictionary):
                Output dictionary containing the number of stars visited, the total completness
                achieved, and the amount of time spent integrating.

        """
        SS = self.SurveySimulation
        OS = SS.OpticalSystem
        ZL = SS.ZodiacalLight
        Comp = SS.Completeness
        TL = SS.TargetList
        Obs = SS.Observatory
        TK = SS.TimeKeeping

        # Only considering detections
        allModes = OS.observingModes
        det_mode = list(filter(lambda mode: mode['detectionMode'] == True, allModes))[0]
        mpath = os.path.split(inspect.getfile(self.__class__))[0]

        startTimes = TK.currentTimeAbs + np.zeros(TL.nStars)*u.d
        sInds = np.arange(TL.nStars)
        fZ = ZL.fZ(Obs, TL, sInds, startTimes, det_mode)
        fEZ = ZL.fEZ0
        fEZ = np.ones(sInds.shape) * fEZ
        dMag = SS.dMagint
        WA = SS.WAint

        # sort star indices by completeness diveded by integration time
        intTimes = OS.calc_intTime(TL, sInds, fZ, fEZ, dMag, WA, det_mode)
        comps = Comp.comp_per_intTime(intTimes, TL, sInds, fZ, fEZ, WA[0], det_mode)
        wp = waypoint(comps, intTimes, duration, mpath, tofile)

        return wp