<commit_before>#! /usr/bin/env python

import django
from datetime import datetime
import pytz
django.setup()
from basaltApp.models import BasaltImageSet, BasaltSingleImage
from geocamTrack.utils import getClosestPosition

hawaiiStandardTime = pytz.timezone('US/Hawaii')
startTime = datetime(2016, 11, 8, 0, 0, 0, tzinfo=hawaiiStandardTime)
endTime = datetime(2016, 11, 9, 0, 0, 0, tzinfo=hawaiiStandardTime)

imgList = BasaltImageSet.objects.filter(creation_time__gte=startTime).filter(creation_time__lte=endTime)

print "Found %d images." % imgList.count()

for img in imgList:
    if img.flight:
        print img.flight.name
        singleImages = img.images
        print "  Images:"
        for si in singleImages.all():
            print "    Thumb: %s (%s x %s)" % (si.thumbnail, si.width, si.height)
    else:
        print "<none>"<commit_msg>Add postion lookup stuff to script.  Use acquistion_time for timestamp<commit_after>#! /usr/bin/env python

import django
from datetime import datetime
import pytz
django.setup()
from basaltApp.models import BasaltImageSet, BasaltSingleImage, BasaltResource
from geocamTrack.utils import getClosestPosition

hawaiiStandardTime = pytz.timezone('US/Hawaii')
startTime = datetime(2016, 11, 8, 0, 0, 0, tzinfo=hawaiiStandardTime)
endTime = datetime(2016, 11, 9, 0, 0, 0, tzinfo=hawaiiStandardTime)
ev1Resource = BasaltResource.objects.get(name="EV1")
print "Resource:", ev1Resource

imgList = BasaltImageSet.objects.filter(acquisition_time__gte=startTime).filter(acquisition_time__lte=endTime)

print "Found %d images." % imgList.count()

for img in imgList:
    position = getClosestPosition(resource=ev1Resource, timestamp=img.acquisition_time)
    if img.flight:
        print "F: %s, N: %s, P: %s" % (img.flight.name, img.name, position)
        singleImages = img.images
        print "  Images:"
        for si in singleImages.all():
            print "    Thumb: %s (%s x %s)" % (si.thumbnail, si.width, si.height)
    else:
        position = getClosestPosition(resource=ev1Resource, timestamp=img.acquisition_time)
        print "F: %s, N: %s, P: %s" % ("<none>", img.name, position)
        singleImages = img.images
        print "  Images:"
        for si in singleImages.all():
            print "    Thumb: %s (%s x %s)" % (si.thumbnail, si.width, si.height)
{'fraction_non_alphanumeric': 0.11762171477811288, 'fraction_numerical': 0.01938819474364498, 'mean_word_length': 3.909090909090909, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5312607', 'n_tokens_mistral': 824, 'n_tokens_neox': 767, 'n_words': 201}