Module Expr Str Assign NameStore Str Import alias ImportFrom alias identifier Import alias Import alias Import alias ImportFrom alias alias Assign NameStore Call AttributeLoad NameLoad attr Str ClassDef bases NameLoad body Expr Str Assign NameStore NameLoad Assign NameStore NameLoad FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad NameLoad body Expr Str Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Return AttributeLoad NameLoad attr decorator_list Assign NameStore NameLoad Assign NameStore NameLoad Assign NameStore NameLoad FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str If Call NameLoad NameLoad NameLoad body Assign NameStore Call NameLoad NameLoad Str If Call NameLoad NameLoad NameLoad body Assign NameStore Call NameLoad NameLoad Str If Call NameLoad NameLoad NameLoad body Assign NameStore Call NameLoad NameLoad Str Return TupleLoad NameLoad NameLoad NameLoad decorator_list NameLoad FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Assign TupleStore NameStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad Return NameLoad decorator_list NameLoad FunctionDef arguments args NameParam NameParam NameParam defaults Call AttributeLoad NameLoad attr keyword Num body Expr Str If CompareIs NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Return ListLoad TupleLoad NameLoad BinOpAdd NameLoad NameLoad If CompareIs NameLoad NameLoad body Return ListLoad TupleLoad NameLoad BinOpAdd NameLoad NameLoad Return ListLoad TupleLoad NameLoad NameLoad decorator_list NameLoad FunctionDef arguments args NameParam defaults body Expr Str Return Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr decorator_list NameLoad FunctionDef arguments args NameParam defaults body Expr Str If CompareIs NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Return Call AttributeLoad NameLoad attr Str decorator_list NameLoad FunctionDef arguments args NameParam defaults body Expr Str Return TupleLoad Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list NameLoad FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Assign AttributeStore AttributeLoad NameLoad attr attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign AttributeStore AttributeLoad NameLoad attr attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign AttributeStore AttributeLoad NameLoad attr attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign AttributeStore AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign AttributeStore NameLoad attr NameLoad Assign TupleStore NameStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Assign TupleStore NameStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad Return Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad decorator_list NameLoad FunctionDef arguments args defaults body Expr Str Return Call AttributeLoad NameLoad attr keyword Num decorator_list NameLoad FunctionDef arguments args defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Return TupleLoad SubscriptLoad NameLoad Index Num BinOpAdd SubscriptLoad NameLoad Index Num Call AttributeLoad NameLoad attr decorator_list NameLoad FunctionDef arguments args defaults body Expr Str Return Call AttributeLoad NameLoad attr keyword Num decorator_list NameLoad FunctionDef arguments args defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore BinOpSub BinOpAdd Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr keyword Num Return TupleLoad NameLoad NameLoad decorator_list NameLoad FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore ListLoad For NameStore NameLoad body Assign NameStore Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num Assign NameStore SubscriptLoad NameLoad Index Num Expr Call AttributeLoad NameLoad attr TupleLoad NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults Call AttributeLoad NameLoad attr keyword Num body Expr Str If AttributeLoad NameLoad attr body If AttributeLoad NameLoad attr body Raise Call NameLoad Str Return Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore ListLoad Assign AttributeStore AttributeLoad NameLoad attr attr Call AttributeLoad NameLoad attr NameLoad Assign NameStore NameLoad While CompareLt NameLoad NameLoad body Assign TupleStore NameStore NameStore NameStore NameStore NameStore NameStore Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr If BoolOpOr UnaryOpNot NameLoad UnaryOpNot NameLoad body Return NameLoad Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr If CompareGt NameLoad NameLoad body Break If CompareGt NameLoad NameLoad body Assign NameStore NameLoad orelse Assign NameStore NameLoad If CompareGt BinOpSub NameLoad NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr TupleLoad NameLoad NameLoad Assign AttributeStore AttributeLoad NameLoad attr attr BinOpAdd NameLoad AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Assign NameStore ListLoad Assign NameStore Num For NameStore NameLoad body Assign NameStore SubscriptLoad NameLoad Index NameLoad Assign NameStore SubscriptLoad NameLoad Index NameLoad Expr Call AttributeLoad NameLoad attr Dict Str Str Str NameLoad NameLoad NameLoad AugAssignAdd NameStore Num Return NameLoad decorator_list NameLoad FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad Call NameLoad keyword Num body Expr Str If UnaryOpNot NameLoad body Assign NameStore Call AttributeLoad NameLoad attr If AttributeLoad NameLoad attr body If AttributeLoad NameLoad attr body Raise Call NameLoad Str Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore ListLoad Assign NameStore SubscriptLoad NameLoad Index Num While CompareLt NameLoad SubscriptLoad NameLoad Index Num body Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad NameLoad attr Dict Str Str Str NameLoad NameLoad NameLoad AugAssignAdd NameStore NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd Str Call NameLoad AttributeLoad NameLoad attr Str AttributeLoad AttributeLoad NameLoad attr attr Str AttributeLoad AttributeLoad NameLoad attr attr Str AttributeLoad AttributeLoad NameLoad attr attr Str Str Call NameLoad AttributeLoad AttributeLoad NameLoad attr attr Str Call NameLoad AttributeLoad AttributeLoad NameLoad attr attr Str Str Call NameLoad AttributeLoad AttributeLoad NameLoad attr attr Str Call NameLoad AttributeLoad AttributeLoad NameLoad attr attr Str Call NameLoad AttributeLoad AttributeLoad NameLoad attr attr decorator_list FunctionDef arguments args NameParam defaults body Return Call AttributeLoad NameLoad attr decorator_list decorator_list
N/A N/A 
   Copyright 2013, 2014 Ricardo Tubio-Pardavila

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
 N/A __author__ rtubiopa@calpoly.edu N/A datetime datetime timedelta py_td N/A ephem N/A logging N/A numpy services.common gis misc N/A logger N/A N/A logging getLogger common OrbitalSimulator N/A object N/A N/A 
    This class holds all the methods necessary for the simulation of the
    passes of the Spacecraft over GroundStations.
     N/A _test_mode False N/A _fail_test False set_debug N/A N/A self on fail N/A True False N/A N/A 
        This method sets the OrbitalSimulator debug mode ON (on=True) or OFF
        (on=False). Default: on=True

        :param on: Flag that enables/disables the debug mode
        :param fail: Flag that triggers a simulated exception
         N/A N/A self _test_mode on N/A N/A self _fail_test fail N/A get_debug N/A N/A self N/A N/A N/A Returns the debug flag for the Simulation object.
        :return: boolean debug flag.
         N/A N/A self _test_mode N/A N/A _observer None N/A _body None N/A _tle None normalize_string N/A N/A l0 l1 l2 N/A N/A N/A Static method
        Normalizes the three parameters from unicode to string, in case it is
        necessary.
        :param l0: Line#0 of the TLE file
        :param l1: Line#1 of the TLE file
        :param l2: Line#2 of the TLE file
        :return: Tuple (l0, l1, l2)

        OLD encoding change from str to 'ascii', Python 2.7
        if isinstance(l0, str):
            l0 = unicodedata.normalize('NFKD', l0).encode('ascii', 'ignore')
        if isinstance(l1, str):
            l1 = unicodedata.normalize('NFKD', l1).encode('ascii', 'ignore')
        if isinstance(l2, str):
            l2 = unicodedata.normalize('NFKD', l2).encode('ascii', 'ignore')
         N/A N/A isinstance l0 bytes N/A N/A l0 N/A str l0 ascii N/A N/A isinstance l1 bytes N/A N/A l1 N/A str l1 ascii N/A N/A isinstance l2 bytes N/A N/A l2 N/A str l2 ascii N/A N/A l0 l1 l2 N/A staticmethod check_tle_format N/A N/A l0 l1 l2 N/A N/A N/A Static method
        Checks whether the format for a given TLE is correct or not.
        :param l0: Line#0 of the TLE file
        :param l1: Line#1 of the TLE file
        :param l2: Line#2 of the TLE file
        :return: True if the operation could succesuffly be completed
         N/A N/A l0 l1 l2 N/A N/A OrbitalSimulator normalize_string l0 l1 l2 N/A N/A N/A ephem readtle l0 l1 l2 N/A True N/A staticmethod _create_test_operational_slots N/A N/A start end minimum_duration N/A N/A N/A datetime timedelta minutes 5 N/A N/A 
        Static method that creates the OperationalSlots to be used for
        testing purposes.
        :return: List with the testing OperationalSlots.
         N/A N/A start None N/A N/A now N/A N/A misc get_now_utc N/A N/A N/A now N/A now minimum_duration N/A N/A end None N/A N/A N/A N/A start N/A start minimum_duration N/A N/A N/A start end N/A staticmethod ephem_date_2_utc_datetime N/A N/A e_date N/A N/A N/A 
        Method that converts an Ephem.date object into a Python Datetime object
        located in the UTC timezone.
        :param e_date: The Ephem.date object to be converted.
        :return: The resulting Python UTC-aware Datetime object.
         N/A N/A N/A misc localize_datetime_utc N/A N/A e_date datetime N/A staticmethod datetime_2_ephem_string N/A N/A dt N/A N/A N/A 
        Converts a datetime object into a string that can be used as an input
        for the Ephem implementation of the Date object: 'yyyy/mm/dd hh:ii:ss'
        # ### Datetime object does not
        :param dt: Datetime object to be converted.
        :return: String to be used as an input for the date object.
         N/A N/A dt None N/A N/A dt N/A N/A misc get_today_utc N/A N/A N/A dt strftime %Y/%m/%d %H:%M:%S N/A staticmethod dbtle_2_ephem_str N/A N/A spacecraft_tle N/A N/A N/A 
        Converts into the proper format required by the Ephem objects the TLE
        information contained in the database object.
        :param spacecraft_tle: TLE object from the database.
        :return: (name, line_1, line_2) in str format.
         N/A N/A N/A N/A misc unicode_2_string N/A spacecraft_tle identifier N/A N/A misc unicode_2_string N/A spacecraft_tle first_line N/A N/A misc unicode_2_string N/A spacecraft_tle second_line N/A staticmethod set_groundstation N/A N/A self groundstation N/A N/A N/A 
        Creates an PyEphem observer object with the data from a GroundStation
        object.
        :param groundstation: Object from where to take the data required
         N/A N/A self _observer N/A N/A ephem Observer N/A N/A N/A self _observer lat N/A N/A gis decimal_2_degrees N/A groundstation latitude N/A N/A N/A self _observer lon N/A N/A gis decimal_2_degrees N/A groundstation longitude N/A N/A N/A self _observer horizon N/A N/A gis decimal_2_degrees N/A groundstation contact_elevation N/A N/A N/A self _observer elevation N/A groundstation altitude N/A set_spacecraft N/A N/A self spacecraft_tle N/A N/A N/A 
        Creates an PyEphem body object with the data from a Spacecraft object.
        :param spacecraft_tle: Spacecraft's tle as obtained by invoking the
        method "get" of the <services.configuration.models.TwoLineElement>.
         N/A N/A self _tle spacecraft_tle N/A N/A l0 l1 l2 N/A N/A OrbitalSimulator dbtle_2_ephem_str spacecraft_tle N/A N/A self _body N/A N/A OrbitalSimulator create_spacecraft l0 l1 l2 N/A create_spacecraft N/A N/A l0 l1 l2 N/A N/A N/A 
        Method to convert a Spacecraft object from the database into a PyEphem
        spacecraft that can be used with that same library for simulation
        purposes.
        :param l0: Line#0 of the TLE file.
        :param l1: Line#1 of the TLE file.
        :param l2: Line#2 of the TLE file.
        :return: The object that has to be used with the PyEphem library.
        :raises: ObjectDoesNotExist in case there is no cush tle_id in the
        database.
         N/A N/A l0 l1 l2 N/A N/A OrbitalSimulator normalize_string l0 l1 l2 N/A N/A N/A ephem readtle l0 l1 l2 N/A staticmethod get_update_duration N/A N/A N/A N/A N/A Update window duration.
        This method returns the number of days for which the slots should be
        populated in the future.
        :return: Number of days as a datetime.timedelta object.
         N/A N/A N/A datetime timedelta days 1 N/A staticmethod get_update_window N/A N/A N/A N/A N/A Population window slot.
        Static method that returns the time window for which the slots should
        be populated. Initially the slots should be populated from the end of
        the simulation window to N days after.
        :return: 2-tuple object with the start and the end of the window.
         N/A s_window N/A N/A OrbitalSimulator get_simulation_window N/A N/A N/A s_window N/A 1 N/A N/A s_window N/A 1 N/A N/A OrbitalSimulator get_update_duration N/A staticmethod get_window_duration N/A N/A N/A N/A N/A Simulation window duration.
        Static method that returns the duration of the window for the
        Simulation calculations of the slots.
         N/A N/A N/A datetime timedelta days 3 N/A staticmethod get_simulation_window N/A N/A N/A N/A N/A Simulation window slot.
        Static method that returns the current 'in-use' simulation window,
        this is, the start and end datetime objects for the simulation of the
        slots that is currently being used.
        :return: Tuple (start, end) with the simulation window currently in
                use (UTC localized).
         N/A start N/A N/A misc get_now_utc N/A end N/A N/A N/A N/A misc get_next_midnight N/A N/A OrbitalSimulator get_window_duration N/A N/A datetime timedelta days 1 N/A N/A start end N/A staticmethod calculate_passes N/A N/A self availability_slots N/A N/A N/A 
        Calculates the passess for the given spacecraft over the ground_station,
        for all the availability slots included in the list.
        :param availability_slots: List of tuples with UTC DateTime objects
        defining the slots of availability.
        :return: A list with all the pass slots linked with the AvailabilitySlot
        that generated them.
         N/A pass_slots N/A N/A a_slot_i availability_slots N/A N/A pass_i N/A N/A self calculate_pass_slot N/A a_slot_i N/A 0 N/A a_slot_i N/A 1 N/A pass_i_id N/A a_slot_i N/A 2 N/A N/A N/A pass_slots append N/A pass_i pass_i_id N/A pass_slots N/A calculate_pass_slot N/A N/A self start end minimum_slot_duration N/A N/A N/A datetime timedelta minutes 1 N/A N/A 
        Calculates the passes available for the given spacecraft in between the
        start and end dates.
        :param start: The datetime object (UTC) that defines the start of the
        simulation.
        :param end: The datetime object (UTC) that defines the end of the
        simulation.
        :param minimum_slot_duration: The minimum duration of a slot
        :return: List with the datetime objects (UTC) with the passess for
        the given Spacecraft over the given GroundStation
        :raises ephem.CircumpolarError: Raised whenever a pass for a given
        simulation is either always up or the satellite never shows up above the
        defined horizon.
         N/A N/A self _test_mode N/A N/A N/A self _fail_test N/A N/A N/A Exception TEST TEST TEST EXCEPTION N/A N/A N/A OrbitalSimulator _create_test_operational_slots start end N/A pass_slots N/A N/A N/A N/A self _observer date N/A N/A OrbitalSimulator datetime_2_ephem_string start N/A last_end start N/A N/A last_end end N/A N/A N/A tr azr tt altt ts azs N/A N/A N/A self _observer next_pass N/A self _body N/A N/A N/A N/A self _body compute N/A self _observer N/A N/A N/A tr N/A ts N/A N/A pass_slots N/A dt_tr N/A N/A misc localize_datetime_utc N/A N/A tr datetime N/A dt_ts N/A N/A misc localize_datetime_utc N/A N/A ts datetime N/A N/A dt_tr end N/A N/A N/A N/A dt_ts end N/A N/A slot_end end N/A N/A slot_end dt_ts N/A N/A N/A slot_end dt_tr minimum_slot_duration N/A N/A N/A N/A pass_slots append N/A dt_tr slot_end N/A N/A N/A self _observer date N/A ts N/A ephem minute N/A last_end N/A N/A misc localize_datetime_utc N/A N/A N/A N/A self _observer date datetime N/A pass_slots N/A arrays_2_groundtrack N/A N/A timestamps latitudes longitudes N/A N/A N/A 
        Converts the 3 oArrays into a single groundtrack array with objects as
        items.
        :param timestamps: array with the timestamps
        :param latitudes: array with the latitudes
        :param longitudes: array with the longitudes
        :return: Array where each element is { timestamp, latitude, longitude }.
                    The first timestamp is "start" and the last one is
                    "start+floor(duration/timestamp)*timestamp".
         N/A gt N/A N/A i 0 N/A ts_i timestamps N/A N/A lat_i N/A latitudes N/A i N/A lng_i N/A longitudes N/A i N/A N/A N/A gt append N/A timestamp latitude longitude ts_i lat_i lng_i N/A i 1 N/A gt N/A staticmethod calculate_groundtrack N/A N/A self spacecraft_tle interval timestep N/A None N/A py_td seconds 20 N/A N/A 
        Calculates the GroundTrack for the spacecraft with the given tle object.
        :param spacecraft_tle: TLE for the spacecraft
        :param interval: simulation interval
        :param timestep: time ellapsed for the calculation of two subsequent
                            points in the ground track
        :return: Array where each element is { timestamp, latitude, longitude }.
                    The first timestamp is "start" and the last one is
                    "start+floor(duration/timestamp)*timestamp".
         N/A N/A interval N/A N/A interval N/A N/A OrbitalSimulator get_simulation_window N/A N/A self _test_mode N/A N/A N/A self _fail_test N/A N/A N/A Exception TEST TEST TEST EXCEPTION N/A N/A N/A self set_spacecraft spacecraft_tle N/A groundtrack N/A N/A date_i N/A interval N/A 0 N/A N/A date_i N/A interval N/A 1 N/A N/A N/A N/A N/A self _body compute date_i N/A lat_i N/A N/A numpy rad2deg N/A N/A self _body sublat N/A lng_i N/A N/A numpy rad2deg N/A N/A self _body sublong N/A N/A N/A groundtrack append N/A timestamp latitude longitude date_i lat_i lng_i N/A date_i timestep N/A groundtrack N/A __unicode__ N/A N/A self N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A # ### Body (Spacecraft):  N/A str N/A self _body 
* l0 =  N/A N/A self _tle identifier 
* l1 =  N/A N/A self _tle first_line 
* l2 =  N/A N/A self _tle second_line 
# ### Observer (Ground Station): 
* (lat, long) = ( N/A str N/A N/A self _observer lat ,  N/A str N/A N/A self _observer lon ) 
* elevation =  N/A str N/A N/A self _observer elevation 
* horizon =  N/A str N/A N/A self _observer horizon 
* date =  N/A str N/A N/A self _observer date N/A __str__ N/A N/A self N/A N/A N/A N/A N/A self __unicode__ N/A N/A