-
Notifications
You must be signed in to change notification settings - Fork 3
Developer documentation
gamma-sky.net is an open-source, open data webpage, released under the MIT license. You are welcome to use and modify it as you like. (Basically the MIT license says that you have to give attribution when copying and modifying the code).
We would love to receive contributions!
This page has some information for developers. If you would like to run the webpage on your local machine or contribute some data or feature, please read the instructions below. If you have any further questions or issues, please contact us; we're happy to help.
- gamma-sky.net is implemented as a single-page application.
- gamma-sky.net is a static website hosted on Github pages.
- Python scripts are used to prepare the input data.
- The single-page application is implemented with the Angular framework.
- For visualisation Aladin Lite is used.
To get started with gamma-sky net development, start by cloning the gamma-sky
git repo:
$ git clone https://github.com/gammapy/gamma-sky
$ cd gamma-sky
All the code to produce the website is there.
- To prepare the image and catalog data for the webpage Python scripts are used. The following packages are used for part of the process:
To install this software, we recommend you use Python 3.5 and get it from https://www.continuum.io/downloads .
conda config --add channels conda-forge
conda install cython numpy pandas click astropy healpy
pip install git+https://github.com/gammapy/gammapy.git#egg=gammapy
Once you have the Python packages installed, you can use these commands:
$ python make.py cat all
- Install Node (https://nodejs.org/). This will install the NPM (https://www.npmjs.com/) package management command line tool.
- Install the Angular CLI (https://cli.angular.io/) using this command:
npm install -g angular-cli
Install all NPM packages used by the website (this will take a few minutes and download 250 MB of files into the node_modules
folder, that's how modern Javascript works these days, it's normal).
$ npm install
Now you should be able to serve the gamma-sky app:
$ ng serve
This should compile the app and open up your web browser after a few seconds.
See steps here
When deploying the website, if any added files (that are not within src/app
) need to be sent to the gh-pages
branch (e.g. new data files), configure the "assets"
property in angular-cli.json
:
...
"assets": [
...
<add file/folder here - base directory is "src">
]
Our project's code uses LF line endings. If you are using OS X or Linux, this should not be something to worry about, as these operating systems are already configured in this way. However, if you are on a Windows machine, we ask you to change your line endings by running the following command. More information can be found here.
$ git config --global core.autocrlf true
If you pull from the repo and can't successfully build on ng serve
anymore, you will most likely have to update (or downgrade) your . Check to see if you're up-to-date with the project's packages by calling:
$ npm outdated
From here, you can update a specific package with:
$ npm update [package name]@[version]
Another solution is to reinstall and update your node modules in the project folder as a whole. You can do so by calling the following:
$ rm -rf node_modules
$ npm install
$ ng serve
We implemented tracking via Google Analytics in v0.3 of gamma-sky.net. The tracking code was simply added to the index.html
file and triggers when the user loads the webpage. However, since the website is a single-page Angular2 application, changing routes from e.g. the MapView to the CatView will not trigger a new pageview. A workaround must be implemented (many exist) in order to track the website's individual views.
Currently, only users with permission may view the status of gamma-sky.net on Google Analytics.