How to use the astroplan.scheduling.Slot function in astroplan

To help you get started, we’ve selected a few astroplan 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 astropy / astroplan / astroplan / scheduling.py View on Github external
Will return the new slots created, which can either
        be one, two or three slots depending on if there is
        space remaining before or after the inserted slot.

        Parameters
        ----------
        early_time : `~astropy.time.Time`
            The start time of the new slot to insert.
        later_time : `~astropy.time.Time`
            The end time of the new slot to insert.
        """
        # check if the new slot would overwrite occupied/other slots
        if self.occupied:
            raise ValueError('slot is already occupied')

        new_slot = Slot(early_time, later_time)
        new_slot.middle = True
        early_slot = Slot(self.start, early_time)
        late_slot = Slot(later_time, self.end)

        if early_time > self.start and later_time < self.end:
            return [early_slot, new_slot, late_slot]
        elif early_time > self.start:
            return [early_slot, new_slot]
        elif later_time < self.end:
            return [new_slot, late_slot]
        else:
            return [new_slot]
github astropy / astroplan / astroplan / scheduling.py View on Github external
Parameters
        ----------
        early_time : `~astropy.time.Time`
            The start time of the new slot to insert.
        later_time : `~astropy.time.Time`
            The end time of the new slot to insert.
        """
        # check if the new slot would overwrite occupied/other slots
        if self.occupied:
            raise ValueError('slot is already occupied')

        new_slot = Slot(early_time, later_time)
        new_slot.middle = True
        early_slot = Slot(self.start, early_time)
        late_slot = Slot(later_time, self.end)

        if early_time > self.start and later_time < self.end:
            return [early_slot, new_slot, late_slot]
        elif early_time > self.start:
            return [early_slot, new_slot]
        elif later_time < self.end:
            return [new_slot, late_slot]
        else:
            return [new_slot]
github astropy / astroplan / astroplan / scheduling.py View on Github external
space remaining before or after the inserted slot.

        Parameters
        ----------
        early_time : `~astropy.time.Time`
            The start time of the new slot to insert.
        later_time : `~astropy.time.Time`
            The end time of the new slot to insert.
        """
        # check if the new slot would overwrite occupied/other slots
        if self.occupied:
            raise ValueError('slot is already occupied')

        new_slot = Slot(early_time, later_time)
        new_slot.middle = True
        early_slot = Slot(self.start, early_time)
        late_slot = Slot(later_time, self.end)

        if early_time > self.start and later_time < self.end:
            return [early_slot, new_slot, late_slot]
        elif early_time > self.start:
            return [early_slot, new_slot]
        elif later_time < self.end:
            return [new_slot, late_slot]
        else:
            return [new_slot]
github astropy / astroplan / astroplan / scheduling.py View on Github external
def __init__(self, start_time, end_time, constraints=None):
        """
        Parameters
        -----------
        start_time : `~astropy.time.Time`
            The starting time of the schedule; the start of your
            observing window.
        end_time : `~astropy.time.Time`
           The ending time of the schedule; the end of your
           observing window
        constraints : sequence of `~astroplan.constraints.Constraint` s
           these are constraints that apply to the entire schedule
        """
        self.start_time = start_time
        self.end_time = end_time
        self.slots = [Slot(start_time, end_time)]
        self.observer = None