Skip to content

Commit

Permalink
Merge pull request #3 from LCOGT/hotfix/0.1.1
Browse files Browse the repository at this point in the history
I've check these and they all look good. I'll deploy it once merged.
  • Loading branch information
zemogle committed May 5, 2015
2 parents d7bc016 + ab552f2 commit 62b60a2
Show file tree
Hide file tree
Showing 15 changed files with 597 additions and 77 deletions.
42 changes: 40 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
NEO Exchange
============

Portal for scheduling observations of NEOs using LCOGT (Version 0.1.0)
Portal for scheduling observations of NEOs using LCOGT (Version 0.1.1)

Setup
-----
Expand All @@ -16,4 +16,42 @@ or:
`source <path to virtualenv>/bin/activate.csh # for (t)csh-shells`
`pip install -r pip-requirements.txt`


Local Testing
-------------

For local testing you will probably want to create a
`neoexchange/neox/local_settings.py` file to point at a local test database and
to switch on `DEBUG` for easier testing. An example file would look like:
```
import sys, os
CURRENT_PATH = os.path.dirname(os.path.realpath(__file__))
BASE_DIR = os.path.dirname(CURRENT_PATH)
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'neox.db', # Or path to database file if using sqlite3.
'USER': '', # Not used with sqlite3.
'PASSWORD': '', # Not used with sqlite3.
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
}
}
DEBUG = True
# Use a different database file when testing or exploring in the shell.
if 'test' in sys.argv or 'test_coverage' in sys.argv or 'shell' in sys.argv:
DATABASES['default']['ENGINE'] = 'django.db.backends.sqlite3'
DATABASES['default']['NAME'] = 'test.db'
DATABASES['default']['USER'] = ''
DATABASES['default']['PASSWORD'] = ''
STATIC_ROOT = os.path.abspath(os.path.join(BASE_DIR, '../../static/'))
```

To prepare the local SQLite DB for use, you should follow these steps:
1. `cd neoexchange\neoexchange`
2. Run `python manage.py syncdb`
3. Migrate the apps with `python manage.py migrate`
6 changes: 3 additions & 3 deletions neoexchange/ingest/ephem_subs.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ def determine_darkness_times(site_code, utc_date=datetime.utcnow(), debug=False)
utc_date = datetime.combine(utc_date, time())
(start_of_darkness, end_of_darkness) = astro_darkness(site_code, utc_date)
end_of_darkness = end_of_darkness+timedelta(hours=1)
logger.debug("Start,End of darkness=", start_of_darkness, end_of_darkness)
logger.debug("Start,End of darkness=%s %s", start_of_darkness, end_of_darkness)
if utc_date > end_of_darkness:
logger.debug("Planning for the next night")
utc_date = utc_date + timedelta(days=1)
Expand All @@ -517,10 +517,10 @@ def determine_darkness_times(site_code, utc_date=datetime.utcnow(), debug=False)
utc_date = utc_date + timedelta(days=-1)

utc_date = utc_date.replace(hour=0, minute=0, second=0, microsecond=0)
logger.debug("Planning observations for", utc_date, "for", site_code)
logger.debug("Planning observations for %s for %s", utc_date, site_code)
# Get hours of darkness for site
(dark_start, dark_end) = astro_darkness(site_code, utc_date)
logger.debug("Dark from ", dark_start, "to", dark_end)
logger.debug("Dark from %s to %s", dark_start, dark_end)

return dark_start, dark_end

Expand Down
2 changes: 1 addition & 1 deletion neoexchange/ingest/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ def clean_target(self):
elif body.count() == 0:
raise forms.ValidationError("Object not found.")
elif body.count() > 1:
raise forms.ValidationError("Multiple objects found.")
raise forms.ValidationError("Multiple objects found.")
Binary file not shown.
Loading

0 comments on commit 62b60a2

Please sign in to comment.