Skip to content

Commit

Permalink
Merge pull request #4 from pyobs/develop
Browse files Browse the repository at this point in the history
v1.1
  • Loading branch information
thusser authored Dec 4, 2020
2 parents 4d44b4c + 632e037 commit 57eed00
Show file tree
Hide file tree
Showing 7 changed files with 185 additions and 125 deletions.
24 changes: 16 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
pyobs-archive
=============
# pyobs-archive

A webservice for an archive for astronomical images. Implements most of the interfaces
defined by [Las Cumbres Observatory](https://developers.lco.global/#archive).

Quick start
-----------
## Quick start


Create a docker-compose.yaml:

Expand Down Expand Up @@ -52,8 +51,8 @@ that must be used when sending new images:

Now you can open a browser at http://localhost:8000/ and log in to the homepage.

Development environment
-----------------------
## Development environment

For development, it might be easier to not use Docker. In that case, create a
pyobs_archive/local_settings.py and override settings in the settings.py, like this:

Expand All @@ -72,10 +71,19 @@ pyobs_archive/local_settings.py and override settings in the settings.py, like t
ARCHIVE_ROOT = '/opt/pyobs/data/'
PATH_FORMATTER = '{SITEID}/{TELID}/{INSTRUME}/'
FILENAME_FORMATTER = None,


## Changelog

#### version 1.0 (2020-11-23)
- Initial release

#### version 1.1
- Added footer to page


Used packages
-------------
## Used packages

The following packages are used in this project.

Python:
Expand Down
4 changes: 4 additions & 0 deletions pyobs_archive/api/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ def ingest(filename):
root = settings.ARCHIVE_ROOT

# open file
log.info('Opening new file to ingest...')
fits_file = fits.open(filename)

# get path for archive
Expand All @@ -194,6 +195,7 @@ def ingest(filename):
else:
tmp = os.path.basename(fits_file['SCI'].header['FNAME'])
name = tmp[:tmp.find('.')] if '.' in tmp else tmp
log.info('Formatted filename to %s.', name)

# create new filename and set it in header
out_filename = name + '.fits.fz'
Expand All @@ -210,6 +212,7 @@ def ingest(filename):
img.add_fits_header(fits_file['SCI'].header)

# write to database
log.info('Writing to database...')
img.save()

# link related
Expand All @@ -222,6 +225,7 @@ def ingest(filename):

# write FITS file to byte stream and close
with io.BytesIO() as bio:
log.info('Writing file...')
fits_file.writeto(bio)
fits_file.close()

Expand Down
71 changes: 49 additions & 22 deletions pyobs_archive/frontend/static/css/styles.css
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
@font-face {
font-family: 'Alegreya';
src:
local('Alegreya'),
local('Alegreya-Regular'),
url('../fonts/Alegreya-Regular.ttf');
src: local('Alegreya'),
local('Alegreya-Regular'),
url('../fonts/Alegreya-Regular.ttf');
font-weight: normal;
font-style: normal;
}

@font-face {
font-family: 'Alegreya';
src:
local('Alegreya-Bold'),
url('../fonts/Alegreya-Bold.ttf');
src: local('Alegreya-Bold'),
url('../fonts/Alegreya-Bold.ttf');
font-weight: bold;
font-style: normal;
}

@font-face {
font-family: 'Roboto';
src:
local('Roboto')
local('Roboto-Regular'),
url('../admin/fonts/Roboto-Bold.ttf');
src: local('Roboto') local('Roboto-Regular'),
url('../admin/fonts/Roboto-Bold.ttf');
font-weight: bold;
font-style: normal;
}

html, body {
height: 100%;
}

body {
font-family: 'Roboto', serif;
}
Expand All @@ -35,8 +35,14 @@ h1, h2, h3, h4, h5, h6, th, nav, label {
font-family: 'Alegreya', serif;
}

#wrap {
min-height: 100%;
}

#main {
margin-top: 70px;
margin-top: 20px;
overflow: auto;
padding-bottom: 50px; /* this needs to be bigger than footer height*/
}

.datetext {
Expand All @@ -49,18 +55,39 @@ h1, h2, h3, h4, h5, h6, th, nav, label {
width: 100%;
}

.no-js #loader { display: none; }
.js #loader { display: block; position: absolute; left: 100px; top: 0; }
.no-js #loader {
display: none;
}

.js #loader {
display: block;
position: absolute;
left: 100px;
top: 0;
}

.loading {
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 100%;
z-index: 9999;
background: url('../img/ajax-loader.gif') center no-repeat #fff;
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 100%;
z-index: 9999;
background: url('../img/ajax-loader.gif') center no-repeat #fff;
}

table {
font-size: small;
}
}

footer {
background-color: black;
color: grey;
text-align: center;
position: relative;
margin-top: -40px; /* negative value of footer height */
height: 40px;
clear: both;
padding-top: 0.5em;
font-size: smaller;
}
Loading

0 comments on commit 57eed00

Please sign in to comment.