In [1]:
import filters
import pickle
import datetime
import intervaltree as iv

In [2]:
# passes = pickle.load(open('passes_new.pkl', 'rb'))

In [3]:
#fact = filters.passes_per_gs(passes, 'FACT')
#oscar = filters.passes_per_sat(passes, 'OSCAR 7 (AO-7)')
#both = filters.passes_gs_sat(passes, 'FACT', 'OSCAR 7 (AO-7)')

In [4]:
import sys

#adds folder to the search path for 'import'
sys.path.append('../python-files')

In [5]:
import db

tree = db.getpasses('allpasses.db', gs='KB9JHU')
print(len(tree))

# '%' character in SQL means 'any 0 or more characters'
# lazy way instead of using the exact full string
tree = db.getpasses('allpasses.db', gs='KB9JHU', sat='%AO-7%')
print(len(tree))


96441
3246

In [25]:
# calc_access_time() function definition
def calc_access_time(passtree):
    """Calculates Access Time in seconds/day.

    Arguments:
    passtree - interval tree containing all intervals for access time
    """
    # Find total access time for tree
    #     Including: one gs tree, one sat tree, one gs/one sat tree
    accesstime_total = 0
    for item in passtree:
        accesstime_total = accesstime_total + item.data.duration


    # Find access time per day for tree
    if len(passtree) > 0:

        # Including: one gs tree, one sat tree, one gs/one sat tree
        start, end = passtree.begin(), passtree.end()

        # get day of first pass, start at midnight
        q = start.replace(hour=0, minute=0, second=0, microsecond=0)

        # get day of last pass, end at midnight
        c = end.replace(hour=0, minute=0, second=0, microsecond=0)

        # define one day as timedelta
        day = datetime.timedelta(days=1)

        accesstime_days = []
        while q <= c:
            dayend = q + day

            # TODO: chop bug workaround
            try:
                new_tree = passtree.search(q, dayend)
                new_tree.chop(q, dayend)
            except:
                new_tree = passtree.search(q, dayend)
                # accept the overhangs

            access = 0
            for item in new_tree:
                access = access + item.data.duration
            accesstime_days.append(access)
            q = dayend

    return accesstime_total, accesstime_days

In [26]:
total, day_total = calc_access_time(tree)

In [27]:
print(total)
print(day_total)
print(len(day_total))


2061955.8406699984
[6196.943033999999, 5685.3233, 5581.673176, 5534.804601, 5813.2824709999995, 5917.695073999999, 5777.43845, 5535.883331999999, 5492.093043, 5997.853443000001, 5805.745294, 6144.973489000001, 5326.639493000001, 5947.331663000001, 5522.313093000001, 6262.700376, 5706.103193999999, 5821.984401, 5578.498237, 5728.3182480000005, 5890.674260999999, 5831.842829, 5582.730873, 5615.102122, 5672.671472999999, 5818.295443999999, 6098.553921000001, 5439.659624999999, 5973.119293, 5250.4593079999995, 6226.629352999999, 5627.409838, 5901.598862, 5485.572577, 5696.3962089999995, 5786.690746, 5815.812810999999, 5560.998893, 5507.339789, 5492.914444, 5757.296759, 5931.194962, 5471.825508, 5752.205859, 5292.93772, 6113.373464, 5449.0321, 5901.456022, 5281.811197999999, 5734.437216, 5625.455587, 5771.58355, 5498.0643070000015, 5444.055655, 5422.806062, 5640.755309, 5763.02509, 5542.459553999999, 5660.450397, 5302.649858, 5912.614979, 5536.39563, 6010.163216000001, 5179.594002, 5737.262213, 5365.567495000001, 5982.862196, 5620.012487, 5445.086985, 5366.1020690000005, 5503.603504, 5744.758489999999, 5694.741193, 5437.978625000001, 5313.235116000001, 5779.665255, 5605.876238, 6093.962587999999, 5162.786048999999, 5829.367946000001, 5305.857675, 6054.446277000001, 5668.236467, 5605.859235, 5465.740879999999, 5524.770347000001, 5732.76938, 5797.581061999999, 5544.374443, 5503.728044, 5664.373235, 5656.459766, 6130.770173999999, 5465.449192, 5900.631092, 5152.090073, 6086.053183, 5681.548712000001, 5978.936057, 5438.684746, 5516.144053, 5700.433265, 5867.195002, 5757.131123, 5469.537364999999, 5502.732603, 5663.239957, 6092.322947999999, 5680.834266, 5838.903480000001, 5241.470276999999, 6042.536816999999, 5618.882826, 6152.781797, 5406.348127, 5877.384766, 5515.029596, 5874.907759000001, 5829.414811000001, 5548.938007999999, 5635.350692999999, 5531.5870620000005, 5853.177582, 5780.241562, 5829.034764, 5468.5749940000005, 5881.661174, 5422.464946, 6208.298616, 5370.70765, 5889.575173, 5418.262944, 5913.238875, 5813.925922, 5563.581378, 5465.062277, 5471.992427, 5780.482712, 5794.4244260000005, 5694.874883, 5376.267936, 5754.182097, 5519.761359, 6175.628164000001, 5315.906796, 5826.597428, 5459.12747, 5935.291966000001, 5735.390916, 5648.702413999999, 5466.129548, 5560.585485, 5477.203046, 5756.7600569999995, 5677.341233, 5418.983247, 5677.546356, 5325.486306999999, 6088.334516000001, 5406.409082, 5838.891815999999, 5222.637237, 5780.229709000001, 5624.03443, 5906.491438999999, 5433.474361, 5420.873805, 5443.700948999999, 5698.293616, 5725.5024730000005, 5439.487539999999, 5378.714443000001, 5361.735504, 5963.319893999999, 5557.536556999999, 5828.182771, 4927.018577999999, 5969.656018999999, 5484.176168, 6049.001616, 5399.911813000001, 5483.083425, 5529.437577000001, 5502.82736, 5768.034688, 5620.094409000001, 5413.350643, 5404.47635, 5702.7429520000005, 5673.271269000001, 6022.076217000001, 5216.626487, 5820.514314999999, 5278.523519, 6149.449755999999, 5625.087887, 5728.149512, 5397.091571, 5550.650045, 5801.99419, 5796.556852, 5503.899458, 5525.243057000001, 5570.030405, 5763.496123999999, 6096.403622, 5390.696442, 5956.930494, 5537.981456, 6203.929522, 5669.723285, 5981.97801, 5533.327321, 5998.641662, 5568.9712979999995, 5897.6989349999985, 5729.093803, 5622.1382810000005, 5784.798721, 5584.971138999999, 6023.24291, 5707.700991, 5830.5411189999995, 5574.422352, 5981.067096, 5573.688586, 6190.126867999999, 5393.091633999999, 5988.8628309999995, 5531.501366, 5913.09652, 5824.570333000001, 5578.66816, 5770.726604, 5585.216826, 5906.539012, 5821.4593669999995, 5803.893787000001, 5600.3634839999995, 6236.016312, 5668.814944, 6236.9560630000005, 5330.1676, 5978.01784, 5722.615768999999, 5786.243243, 5802.303935, 5588.709494, 5547.615771000001, 5797.081558, 5531.869107, 5831.817837999999, 5566.529598, 5424.6928020000005, 5996.318123, 5380.489679, 6182.865013, 5270.945146, 5852.250459999999, 5432.9720720000005, 5814.624859, 5704.905946, 5774.095516999999, 5442.598369, 5542.078372000001, 5815.501019, 5782.027682, 5662.630448, 5451.249298999999, 5563.361251, 5697.504978, 6064.2910679999995, 5504.332681, 5834.446714, 5067.845248, 6085.647016, 5286.852862999999, 5968.776556000001, 5389.6357370000005, 5417.938697, 5659.401847, 5463.959167, 5709.301286, 5453.244008000001, 5368.906590999999, 5589.23116, 5691.3286259999995, 5609.904113, 5791.921901, 5097.309149, 5938.676114000001, 5223.0283739999995, 6065.852882, 5443.883202, 5571.601975, 5436.180221, 5806.161033, 5736.046646000001, 5647.8688950000005, 5396.969004999999, 5402.307064, 5786.222624, 5400.333489000001, 5976.320901, 5266.219746, 5764.794058, 5369.344024000001, 5855.892919000001, 5557.867869, 5748.9768730000005, 5312.422468, 5768.052798000001, 5493.519149, 5793.007275000001, 5477.93242, 5546.013064, 5768.479375000001, 5507.961590000001, 5974.4759730000005, 5508.650842999999, 5887.943195999999, 5531.784746000001, 6290.92193, 5541.641564, 6042.005264, 5423.804563, 5969.72426, 5873.500397999999, 5863.8996290000005, 5743.718726, 5484.748689, 5679.581472, 5910.355653, 5527.908847000001, 5740.965669, 5752.630174, 5563.237129000001, 6251.325828000001, 5244.556655, 6194.264894, 5327.342179, 6013.400463, 5785.680859, 5734.292244, 5813.035237, 5559.30964, 5631.605697000001, 5844.453959, 5978.444584, 5825.829100999999, 5567.753041, 5511.277641, 6089.98445, 5769.760252000001, 6214.694802, 5151.423592, 5845.144372999999, 5578.159381, 6218.121870999999, 5381.2905789999995, 5624.886831, 5482.355107, 5657.462165, 4543.911449]
364

In [9]:
import db
a_tree = db.getpasses('allpasses.db', gs='KB9JHU')

In [10]:
total, day_total = calc_access_time(a_tree)

In [11]:
print(total)
print(day_total)
print(len(day_total))


43048701.74046362
[120486.044392, 119781.00450100006, 117118.46198399997, 118181.80294200001, 120605.70220499997, 123412.385351, 122840.63775799998, 118420.80031799992, 119976.97621899999, 120870.98988599991, 121484.70609300002, 118747.01392299995, 121629.804834, 125322.6141860001, 123270.80335700006, 120600.33168500011, 117933.87158199989, 118752.77788899998, 118836.040669, 124622.466673, 122536.73378200008, 120301.7836279999, 122172.45822999999, 122717.14538000007, 119324.90612200007, 121750.32687499998, 119242.58400199999, 121623.05128500002, 123221.26668100004, 122922.01809900001, 123561.47857099999, 120378.50609700002, 122333.81817799997, 122630.40118200002, 124030.73049599989, 118648.61221300004, 119663.80659599997, 122355.54980600004, 121940.26962199999, 117705.27272500008, 121232.01283100006, 122875.57902699994, 118747.58410699994, 119625.83607600005, 119263.96261700001, 123484.88794399999, 121260.62374100005, 120391.32352199998, 120179.82318299999, 117950.83080599993, 118759.90666800001, 120547.177489, 124306.44007899998, 120841.90065800001, 116631.99355899998, 119210.11455899994, 121102.39996300008, 122713.40113599999, 118397.7003189999, 117644.99223800004, 120034.21642299998, 116645.053843, 119098.19531800003, 119238.51204100002, 119994.81890999999, 120535.01046699997, 120760.34451599994, 120922.44272500004, 116481.31433600001, 118268.94690900006, 119103.17156700006, 121433.016096, 121932.32008900003, 115904.60025400008, 119434.86273199997, 118032.13677000006, 117864.99114100002, 117436.83464100011, 117950.8803099999, 118804.35480699997, 115917.65948299998, 117893.20858300004, 118514.942455, 116008.924973, 116275.65846099997, 117892.48524399998, 119383.284241, 120814.82705399996, 119634.57121500005, 116924.28639299993, 116935.50982399996, 117683.72192899996, 118464.17908200009, 121906.63328199992, 121088.78118100003, 120934.14283200004, 117929.70217199984, 116304.24043199999, 120813.736491, 116224.67008799997, 115773.14037299999, 120919.85187000003, 118744.37281500007, 116715.04109900005, 115937.57389299995, 118497.69909000005, 116795.48220799993, 118848.80258900003, 119998.11159799996, 118663.62607199994, 118760.08530999995, 121761.02780099999, 119453.354733, 121624.02220700002, 121225.53042300006, 120342.56097500007, 118849.47963999996, 120353.12325899996, 117926.72235899998, 119968.94422899996, 120538.31699099994, 118483.63066400001, 120740.27112500004, 117824.94466600004, 119215.44831199992, 119353.50163100002, 115621.63326399996, 118005.76720400009, 119721.26247299995, 121091.41940000006, 120499.14475100001, 120932.96800400001, 118851.53755799995, 119840.55249400002, 117253.33920300005, 118967.66015599995, 120492.84099600006, 122313.16323199995, 119744.22018399996, 121234.51435999999, 119029.38894499994, 120242.08772399997, 119616.52483799987, 119512.36556899999, 118853.74385199994, 118357.52398000004, 120747.88624500002, 119384.29687100013, 118087.75185899998, 119236.994576, 121801.52734699994, 120809.36326500002, 120706.28946600005, 120671.27474800005, 117971.23521399997, 115701.46553599999, 116621.24598699996, 118219.03762700003, 124386.21236700007, 121356.66948500006, 120030.97605699998, 120462.032202, 121604.57790399999, 117774.71777100005, 118292.5046330001, 117013.23222500004, 119595.747149, 118695.450837, 123031.02323700007, 126245.40867699998, 117767.31213300001, 116362.50823099996, 120088.376239, 119899.98940000002, 115885.23514899993, 119411.59838500003, 123036.87847400006, 123579.74437500004, 117165.30905400001, 119217.89392000006, 118412.48068400002, 118826.75889800003, 119162.5170080001, 120933.47471200004, 122407.60107399999, 117396.34804100005, 118222.55131799995, 117823.86959099995, 120794.69970599994, 120581.66713600003, 121222.044363, 119894.79534400007, 118920.44149499992, 117762.78810400002, 120605.55428299999, 121119.14949900005, 120187.84455799997, 121241.667798, 121038.99437499994, 116849.26020199993, 118275.81176700002, 117594.66577200002, 120265.21116600002, 120836.544673, 120565.9948889999, 121077.96561900007, 117915.49389099992, 119921.07597300004, 118997.00656499996, 122813.88787300007, 122755.49653400006, 119658.46440899996, 117528.0209769999, 118898.64880799997, 119088.55596199994, 120697.27718299993, 126309.43885000004, 121695.75895000009, 116169.89254400002, 115985.07133200002, 118506.44054099996, 118913.70016800005, 117187.64171699998, 119147.07202800005, 123950.85357700007, 120620.85554299998, 119972.62794499994, 115078.44069300011, 117332.30504899999, 120193.7509469999, 120076.41653800003, 119803.91546300003, 118303.02749000004, 120711.86490900004, 120377.85976900002, 123402.27462900002, 120074.44842199994, 115451.19236399999, 118120.50270199998, 120963.897215, 119939.20206399998, 120990.02257399996, 118444.31864600006, 116157.60119100004, 118464.090846, 121588.37036199997, 118553.37685500008, 119028.55559899998, 118555.52589900003, 117996.05784200007, 117424.92963799997, 118133.79896600009, 117059.89618300009, 117934.82096900005, 119553.34529199991, 120502.10041500001, 116471.57134400008, 115927.91404500001, 115787.81389800005, 119021.46761899997, 120243.152838, 117097.31007000002, 117853.502115, 115545.775763, 117632.87559099997, 117358.34715000003, 116702.28640000004, 118067.54622300007, 120294.98685100001, 120060.37460800004, 117174.83821000002, 118439.429219, 116821.74141299994, 118274.76431800007, 118367.09239199992, 118328.72883699994, 117435.23868799995, 116585.52731899994, 118571.85982099992, 117356.79650299996, 120135.96276100009, 119522.60245399999, 119145.00185099996, 117872.39879699996, 113989.89087399998, 117657.15720600002, 119950.538344, 117058.93274000008, 119656.99812400005, 116903.86736599999, 121915.734686, 119800.30080700011, 120953.98723900007, 116292.22790799994, 116483.88312899995, 118296.34228499998, 120234.27538200002, 118540.61705399994, 118710.39424400002, 119019.07751499997, 120816.24349700003, 117141.34079000002, 117402.91455499998, 120896.77805499999, 117793.28964199993, 118528.11381400005, 120990.62493, 120874.08166000001, 121229.89682800004, 118997.91451199996, 118986.61962099999, 124198.21631200005, 118065.83631099998, 117467.27033399999, 119923.63390799993, 120135.80013800004, 121230.44545799997, 119910.39186799993, 118320.135381, 119659.62704499999, 116918.18004000005, 118268.65964599994, 120493.09970000006, 118123.75537900004, 120044.35824599996, 120600.52424299996, 120156.41629999997, 117837.29936799998, 120496.033565, 121364.31644300008, 121128.0272290001, 120314.30096500006, 122596.63449700008, 118858.47865500003, 120436.97105299996, 121099.99669299996, 118604.74584499998, 121767.65759900001, 121685.01587399996, 119309.89619199996, 117149.18893100006, 116837.776314, 117502.55092400001, 119961.306586, 121228.152316, 116101.53393599999, 118995.9474759999, 123353.92747299993, 122539.19368300006, 117184.45584499999, 118583.80777200004, 119210.74997499996, 122383.50317000003, 118353.57227800002, 120086.03626600008, 121510.32957800005, 118416.17921499991, 122324.58210800005, 118784.219204, 118193.83048699996, 114599.16704599999, 119297.83653099996, 120016.53545800006, 91501.18765500002]
364

In [12]:
tree3 = db.getpasses('allpasses.db', sat='%AO-7%')
total, day_total = calc_access_time(tree3)
print(total)
print(day_total)
print(len(day_total))


31261178.98445309
[86494.92756499993, 88947.217572, 88258.23443800003, 87988.06977999998, 83092.23341400002, 88098.04770800001, 85749.81350999995, 91649.69107300001, 84498.95787900001, 88532.084968, 84214.69836699996, 92170.83809899996, 88319.17067900002, 89106.54525200003, 85096.18165799997, 86454.77216099999, 88793.12089399998, 89224.33056100005, 87778.54195100002, 84588.82420500001, 86627.73217299998, 86606.34221999996, 91125.454444, 84417.70719499997, 88478.89683000004, 81427.613957, 91519.55774999995, 87168.11234500003, 90293.95749199994, 84571.12057500005, 84655.31299199999, 87230.24599700002, 88661.55821400003, 87085.39320000002, 84955.10923499998, 83254.677674, 85447.08729000002, 89503.40095900002, 85020.90692499999, 87404.03772800001, 79477.85022400004, 89037.73115699999, 84564.08201800003, 90429.85430499999, 83663.39549399998, 84502.933718, 83837.33069299997, 87817.995362, 86705.53933199997, 85401.79221400002, 82415.34257299994, 83500.57052199997, 87585.99275100001, 85093.10236200003, 86771.45100100004, 79421.91296699998, 86362.96852299999, 83026.63821500006, 89940.641065, 82983.922737, 85765.977919, 82491.564623, 87169.73252999996, 85932.922102, 85684.282401, 82546.39439099995, 83222.20556199996, 85667.72045100002, 85448.47888699999, 86610.70890299998, 80915.59822700004, 85068.47927399994, 82336.348622, 89552.2974, 83205.42205599997, 86627.244714, 81005.57103499997, 87336.97525700004, 86161.75826300001, 87542.86740299998, 83276.21126500002, 82748.41092799998, 84713.541444, 86964.35975799996, 86767.75568900004, 83575.98733599999, 84078.18358599998, 82630.44424799997, 90009.34662400001, 84063.30694499997, 88425.61132200006, 79839.886732, 88435.44845699996, 86730.845623, 88747.32356400003, 85069.60019599996, 83412.24096, 85065.510048, 88256.40094200004, 87667.14997900004, 85553.62778599997, 84440.83679000003, 83681.38319599997, 90056.96771699996, 85020.01133399998, 89445.98230299997, 80816.40399700003, 88672.735407, 86313.491114, 91377.83110800003, 86861.99733399997, 85712.04587399994, 84802.08235800001, 88795.78401299995, 88513.06908099998, 88324.30731599999, 84822.77553000006, 84004.16223099998, 89237.54403300001, 86669.50589899998, 90650.28087900004, 81830.69798699999, 87222.59369999995, 84694.28182500004, 91844.16294399997, 86881.49256000001, 87130.31002399999, 82743.96032200004, 87902.65720300002, 87920.06329100006, 88301.43395200005, 85165.59452899998, 83307.614101, 86038.333039, 86470.05560200002, 89247.62916599991, 82218.53347800001, 86367.95552399998, 81592.89329799998, 90772.08622599998, 84689.81285500001, 89050.49382600002, 82826.793828, 85337.53374900002, 86695.36724899999, 87912.40109700002, 86197.86047700001, 83861.70558699997, 83460.54699700001, 85960.21739100003, 87833.23716499995, 84369.54221399999, 85379.466899, 79399.46206599996, 89076.13666599998, 83266.36938699997, 89278.879638, 81196.230942, 84974.93326900004, 85005.60378799998, 87285.174202, 85504.38698500005, 83323.46719799998, 81821.04577300002, 85014.30305399997, 86171.07850699997, 84647.70602200001, 84247.15814199999, 79286.42814900003, 86336.45273499994, 82825.49954499998, 89020.45704, 80592.12388, 84757.37277999995, 82827.63840499999, 88523.77037200001, 85394.75516000002, 85616.86360999997, 81422.98656099998, 84326.13209399999, 86163.23876200002, 85889.54069999995, 85326.99904000002, 79784.19726500004, 85827.88089000003, 83144.94945800003, 89225.69677300003, 82425.240058, 85199.26135900003, 82093.23852600003, 89690.58756899994, 86181.160482, 87347.298001, 82183.07226600005, 84671.71735499999, 86526.83253700004, 87696.72043200002, 86989.77839200001, 82484.912553, 85430.54997, 84809.20353099998, 90363.10460999998, 84361.37345900001, 88034.37625700003, 81207.08611199998, 90051.306433, 87107.86730900001, 91037.927979, 86011.33792799998, 84723.83263399995, 86010.28977899997, 89422.58943700002, 88481.96257300001, 87385.41687799996, 83630.941972, 85182.71187100005, 90670.074257, 86499.60829599999, 90469.127502, 80239.61466800001, 89581.769401, 86280.32468200003, 92417.62281100005, 87295.89455000001, 86273.93750700004, 85590.52638199998, 89914.0682, 89145.74564699999, 89074.39298299998, 84381.53791099996, 85493.23237100002, 89817.42388500001, 87679.55188999997, 90944.71584999995, 82125.02028799999, 88209.73193099999, 85252.50923499999, 92611.77427599998, 86963.888025, 89312.56200700002, 83375.02525000002, 89113.84852899998, 88463.725626, 89148.76867200003, 86011.29090300004, 83444.97417299998, 87094.87045500004, 87638.58933100001, 89363.70828299997, 84397.487876, 85116.467418, 82847.79083700001, 90958.98760700002, 84688.78573900001, 89834.4181, 81509.07087599998, 87228.12559000004, 86707.235267, 88361.890141, 86005.28745500001, 83254.98649200004, 83696.370731, 86826.94053900003, 86856.75681499996, 84922.23583199998, 85659.40411800005, 80737.20918500006, 88991.078264, 83386.433095, 89189.17002099998, 81112.367594, 85301.16534299997, 84745.69450400004, 87685.309908, 85067.35765900004, 84574.11517, 80552.37096300004, 85293.73089899996, 85896.13843200002, 85108.033432, 84693.24960800001, 78862.072588, 85947.62677100001, 82742.02480999999, 88597.18179499991, 80668.628558, 83685.53246799995, 81926.83741500002, 88830.58265999997, 85117.23238899997, 85797.50005300001, 80458.065962, 84341.36323200005, 85770.96311900001, 86169.780042, 85030.36361500001, 80976.534038, 84911.99198800005, 83933.328466, 88670.588863, 82361.19802500002, 85864.05999000001, 80007.50495100004, 89192.29515499994, 85447.64522700002, 88443.42144100003, 82739.40156600003, 83140.52279399997, 85538.05991900004, 87743.17160699998, 86567.419936, 83997.455829, 82123.314961, 84223.32603899996, 89324.34718900004, 84170.80626399997, 88366.94410499997, 78674.49390600002, 88671.79717800004, 85232.84704800004, 90839.19078000002, 85678.22395300002, 84293.88614900001, 84931.75758199998, 88923.83288600002, 87749.87311900004, 87356.08119799994, 83983.965594, 84581.51922000003, 89197.94207499998, 86457.99650700005, 89796.09512600001, 81564.440563, 86920.15249999995, 85175.04605600002, 91940.78947700004, 86668.61743900002, 88110.98316799999, 83496.190032, 89163.33008400002, 88471.31931499994, 88947.18114200003, 85597.87147600003, 83290.15230600002, 87831.29083200003, 87407.88423000003, 89710.207836, 83434.82208200001, 86374.43094499996, 84040.42690100001, 91577.39029799995, 85150.071514, 89901.28856000002, 83165.45938899997, 88559.22771500004, 87398.40525500005, 88610.66021000007, 86642.68920100004, 84819.227293, 83539.33766800001, 87242.24838399998, 88051.08482399993, 85237.38085499998, 82443.27614200003]
364

In [83]:
# plot_access_time() function definition
def plot_access_time(daily_totals, gs=None, sat=None):
    """Plots Access Time in seconds/day.

    Arguments:
    daily_totals - list of daily sec/day
    gs - Name of gs used for passes (default None)
    sat - Name of sat used for passes (default None)

    If both gs and sat specified, one gs/sat combo
    If gs not specified, means one sat all gs
    If sat not specified, means one gs all sats
    If neither, use generic "gs" and "sat"
    """
    import seaborn
    import matplotlib.pyplot as plt
    spd = 86400  # seconds/day
    numgs = 12  # num ground stations
    numsat = 74  # num sats

    fig = plt.figure(1)
    if gs is None and sat is not None:
        fig.suptitle('%s Access Time for All Ground Stations' % (sat))
        ymax = spd * numgs
    elif sat is None and gs is not None:
        fig.suptitle('All Satellite Access Time for %s Ground Station' % (gs))
        ymax = spd * numsat
    elif sat is None and gs is None:
        fig.suptitle('All Satellite Access time for All Ground Stations')
        ymax = spd * numgs * numsat
    else:
        fig.suptitle('%s Access time for %s Ground Station' % (sat, gs))
        ymax = spd

    s1 = plt.subplot()
    s1.plot(daily_totals, 'b-')
    s1.set_ylim(ymin=0, ymax=2000)
    plt.xlabel('Days from Epoch')
    plt.ylabel('Access time (sec/day)')

    #s2 = plt.subplot(222)
    #s2.plot(daily_totals, 'b-')
    #s2.set_ylim(ymin=0, ymax=ymax)
    #plt.xlabel('Days from Epoch')

    plt.show()

In [63]:
plot_access_time(day_total, sat='AO-7')


Out[63]:

In [20]:
ree3 = db.getpasses('allpasses.db', sat='%AO-7%')
total, day_total = calc_access_time(ree3)
print(total)
print(day_total)
print(len(day_total))


31261178.98445309
[86494.92756499993, 88947.217572, 88258.23443800003, 87988.06977999998, 83092.23341400002, 88098.04770800001, 85749.81350999995, 91649.69107300001, 84498.95787900001, 88532.084968, 84214.69836699996, 92170.83809899996, 88319.17067900002, 89106.54525200003, 85096.18165799997, 86454.77216099999, 88793.12089399998, 89224.33056100005, 87778.54195100002, 84588.82420500001, 86627.73217299998, 86606.34221999996, 91125.454444, 84417.70719499997, 88478.89683000004, 81427.613957, 91519.55774999995, 87168.11234500003, 90293.95749199994, 84571.12057500005, 84655.31299199999, 87230.24599700002, 88661.55821400003, 87085.39320000002, 84955.10923499998, 83254.677674, 85447.08729000002, 89503.40095900002, 85020.90692499999, 87404.03772800001, 79477.85022400004, 89037.73115699999, 84564.08201800003, 90429.85430499999, 83663.39549399998, 84502.933718, 83837.33069299997, 87817.995362, 86705.53933199997, 85401.79221400002, 82415.34257299994, 83500.57052199997, 87585.99275100001, 85093.10236200003, 86771.45100100004, 79421.91296699998, 86362.96852299999, 83026.63821500006, 89940.641065, 82983.922737, 85765.977919, 82491.564623, 87169.73252999996, 85932.922102, 85684.282401, 82546.39439099995, 83222.20556199996, 85667.72045100002, 85448.47888699999, 86610.70890299998, 80915.59822700004, 85068.47927399994, 82336.348622, 89552.2974, 83205.42205599997, 86627.244714, 81005.57103499997, 87336.97525700004, 86161.75826300001, 87542.86740299998, 83276.21126500002, 82748.41092799998, 84713.541444, 86964.35975799996, 86767.75568900004, 83575.98733599999, 84078.18358599998, 82630.44424799997, 90009.34662400001, 84063.30694499997, 88425.61132200006, 79839.886732, 88435.44845699996, 86730.845623, 88747.32356400003, 85069.60019599996, 83412.24096, 85065.510048, 88256.40094200004, 87667.14997900004, 85553.62778599997, 84440.83679000003, 83681.38319599997, 90056.96771699996, 85020.01133399998, 89445.98230299997, 80816.40399700003, 88672.735407, 86313.491114, 91377.83110800003, 86861.99733399997, 85712.04587399994, 84802.08235800001, 88795.78401299995, 88513.06908099998, 88324.30731599999, 84822.77553000006, 84004.16223099998, 89237.54403300001, 86669.50589899998, 90650.28087900004, 81830.69798699999, 87222.59369999995, 84694.28182500004, 91844.16294399997, 86881.49256000001, 87130.31002399999, 82743.96032200004, 87902.65720300002, 87920.06329100006, 88301.43395200005, 85165.59452899998, 83307.614101, 86038.333039, 86470.05560200002, 89247.62916599991, 82218.53347800001, 86367.95552399998, 81592.89329799998, 90772.08622599998, 84689.81285500001, 89050.49382600002, 82826.793828, 85337.53374900002, 86695.36724899999, 87912.40109700002, 86197.86047700001, 83861.70558699997, 83460.54699700001, 85960.21739100003, 87833.23716499995, 84369.54221399999, 85379.466899, 79399.46206599996, 89076.13666599998, 83266.36938699997, 89278.879638, 81196.230942, 84974.93326900004, 85005.60378799998, 87285.174202, 85504.38698500005, 83323.46719799998, 81821.04577300002, 85014.30305399997, 86171.07850699997, 84647.70602200001, 84247.15814199999, 79286.42814900003, 86336.45273499994, 82825.49954499998, 89020.45704, 80592.12388, 84757.37277999995, 82827.63840499999, 88523.77037200001, 85394.75516000002, 85616.86360999997, 81422.98656099998, 84326.13209399999, 86163.23876200002, 85889.54069999995, 85326.99904000002, 79784.19726500004, 85827.88089000003, 83144.94945800003, 89225.69677300003, 82425.240058, 85199.26135900003, 82093.23852600003, 89690.58756899994, 86181.160482, 87347.298001, 82183.07226600005, 84671.71735499999, 86526.83253700004, 87696.72043200002, 86989.77839200001, 82484.912553, 85430.54997, 84809.20353099998, 90363.10460999998, 84361.37345900001, 88034.37625700003, 81207.08611199998, 90051.306433, 87107.86730900001, 91037.927979, 86011.33792799998, 84723.83263399995, 86010.28977899997, 89422.58943700002, 88481.96257300001, 87385.41687799996, 83630.941972, 85182.71187100005, 90670.074257, 86499.60829599999, 90469.127502, 80239.61466800001, 89581.769401, 86280.32468200003, 92417.62281100005, 87295.89455000001, 86273.93750700004, 85590.52638199998, 89914.0682, 89145.74564699999, 89074.39298299998, 84381.53791099996, 85493.23237100002, 89817.42388500001, 87679.55188999997, 90944.71584999995, 82125.02028799999, 88209.73193099999, 85252.50923499999, 92611.77427599998, 86963.888025, 89312.56200700002, 83375.02525000002, 89113.84852899998, 88463.725626, 89148.76867200003, 86011.29090300004, 83444.97417299998, 87094.87045500004, 87638.58933100001, 89363.70828299997, 84397.487876, 85116.467418, 82847.79083700001, 90958.98760700002, 84688.78573900001, 89834.4181, 81509.07087599998, 87228.12559000004, 86707.235267, 88361.890141, 86005.28745500001, 83254.98649200004, 83696.370731, 86826.94053900003, 86856.75681499996, 84922.23583199998, 85659.40411800005, 80737.20918500006, 88991.078264, 83386.433095, 89189.17002099998, 81112.367594, 85301.16534299997, 84745.69450400004, 87685.309908, 85067.35765900004, 84574.11517, 80552.37096300004, 85293.73089899996, 85896.13843200002, 85108.033432, 84693.24960800001, 78862.072588, 85947.62677100001, 82742.02480999999, 88597.18179499991, 80668.628558, 83685.53246799995, 81926.83741500002, 88830.58265999997, 85117.23238899997, 85797.50005300001, 80458.065962, 84341.36323200005, 85770.96311900001, 86169.780042, 85030.36361500001, 80976.534038, 84911.99198800005, 83933.328466, 88670.588863, 82361.19802500002, 85864.05999000001, 80007.50495100004, 89192.29515499994, 85447.64522700002, 88443.42144100003, 82739.40156600003, 83140.52279399997, 85538.05991900004, 87743.17160699998, 86567.419936, 83997.455829, 82123.314961, 84223.32603899996, 89324.34718900004, 84170.80626399997, 88366.94410499997, 78674.49390600002, 88671.79717800004, 85232.84704800004, 90839.19078000002, 85678.22395300002, 84293.88614900001, 84931.75758199998, 88923.83288600002, 87749.87311900004, 87356.08119799994, 83983.965594, 84581.51922000003, 89197.94207499998, 86457.99650700005, 89796.09512600001, 81564.440563, 86920.15249999995, 85175.04605600002, 91940.78947700004, 86668.61743900002, 88110.98316799999, 83496.190032, 89163.33008400002, 88471.31931499994, 88947.18114200003, 85597.87147600003, 83290.15230600002, 87831.29083200003, 87407.88423000003, 89710.207836, 83434.82208200001, 86374.43094499996, 84040.42690100001, 91577.39029799995, 85150.071514, 89901.28856000002, 83165.45938899997, 88559.22771500004, 87398.40525500005, 88610.66021000007, 86642.68920100004, 84819.227293, 83539.33766800001, 87242.24838399998, 88051.08482399993, 85237.38085499998, 82443.27614200003]
364

In [74]:
tree_gs = db.getpasses('allpasses.db', gs='KB9JHU')
total_gs, day_total_gs = calc_access_time(tree_gs)
plot_access_time(day_total_gs, gs='KB9JHU')


Out[74]:

In [75]:
tree_gs = db.getpasses('allpasses.db', gs='FACT')
total_gs, day_total_gs = calc_access_time(tree_gs)
plot_access_time(day_total_gs, gs='FACT')


Out[75]:

In [77]:
tree_sat = db.getpasses('allpasses.db', sat='ITUPSAT 1')
print('# of passes:', len(tree_sat))
total_sat, day_total_sat = calc_access_time(tree_sat)
plot_access_time(day_total_sat, sat='ITUPSAT 1')


# of passes: 20928
Out[77]:

In [78]:
tree_sat2 = db.getpasses('allpasses.db', sat='%AO-7%')
print('# of passes:', len(tree_sat2))
total_sat, day_total_sat = calc_access_time(tree_sat2)
plot_access_time(day_total_sat, sat='AO-7')


# of passes: 49102
Out[78]:

In [79]:
tree_sat3 = db.getpasses('allpasses.db', sat='SOMP')
print('# of passes:', len(tree_sat3))
total_sat, day_total_sat = calc_access_time(tree_sat3)
plot_access_time(day_total_sat, sat='SOMP')


# of passes: 21415
Out[79]:

In [84]:
tree_both = db.getpasses('allpasses.db', gs='KB9JHU', sat='ITUPSAT 1')
total_both, day_total_both = calc_access_time(tree_both)
plot_access_time(day_total_both, gs='KB9JHU', sat='ITUPSAT 1')


Out[84]:

In [86]:
ree_both = db.getpasses('allpasses.db', gs='KB9JHU', sat='SOMP')
total_both, day_total_both = calc_access_time(ree_both)
plot_access_time(day_total_both, gs='KB9JHU', sat='SOMP')


Out[86]: