Skip to content

Commit

Permalink
Merge pull request #7 from Athanaseus/MDGA
Browse files Browse the repository at this point in the history
update binary
  • Loading branch information
Athanaseus authored Aug 26, 2019
2 parents 2b85c15 + 6e8319e commit dd4a39f
Show file tree
Hide file tree
Showing 11 changed files with 83 additions and 33 deletions.
1 change: 1 addition & 0 deletions .travis/py2.docker
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ RUN pip install --upgrade pip setuptools
ADD . /code
WORKDIR /code
RUN pip install .[python-numpy,pytest]
RUN drasticali -h
1 change: 1 addition & 0 deletions .travis/py3.docker
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ RUN docker-apt-install \
ADD . /code
WORKDIR /code
RUN pip3 install .[python-numpy,testing]
RUN drasticali -h
4 changes: 2 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
include LICENSE
include README.md
include README.rst
recursive-include recipes *.json
recursive-include recipes/input *.txt
recursive-include drastic *.ipynb
recursive-include drasticali *.ipynb
18 changes: 9 additions & 9 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ drasticali

Diverse Radio Astronomy Software Tools for Imaging and Calibration

Main website: https://github.com/Athanaseus/Drastic/wiki
Main website: https://github.com/Athanaseus/drasticali/wiki

==============
Introduction
Expand All @@ -28,7 +28,7 @@ working directory where source is checked out
$ pip install .
This package will soon be available on *PYPI*, allowing
This package is available on *PYPI*, allowing

.. code-block:: bash
Expand All @@ -47,19 +47,19 @@ Contribute
Contributions are always welcome! Please ensure that you adhere to our coding
standards pep8_.

.. |Pypi Version| image:: https://img.shields.io/pypi/v/aimfast.svg
:target: https://pypi.python.org/pypi/aimfast
.. |Pypi Version| image:: https://img.shields.io/pypi/v/drasticali.svg
:target: https://pypi.python.org/pypi/drasticali
:alt:
.. |Build Version| image:: https://travis-ci.com/Athanaseus/Drastic.svg?branch=master
:target: https://travis-ci.com/Athanaseus/Drastic
.. |Build Version| image:: https://travis-ci.org/Athanaseus/drasticali.svg?branch=master
:target: https://travis-ci.org/Athanaseus/drasticali
:alt:

.. |Python Versions| image:: https://img.shields.io/pypi/pyversions/aimfast.svg
:target: https://pypi.python.org/pypi/aimfast/
.. |Python Versions| image:: https://img.shields.io/pypi/pyversions/drasticali.svg
:target: https://pypi.python.org/pypi/drasticali/
:alt:

.. |Project License| image:: https://img.shields.io/badge/license-GPL-blue.svg
:target: https://github.com/Athanaseus/Drastic/blob/master/LICENSE
:target: https://github.com/Athanaseus/drasticali/blob/master/LICENSE
:alt:

.. _source: https://github.com/Athanaseus/Drastic
Expand Down
54 changes: 51 additions & 3 deletions bin/drasticali
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env python

import os
import time
import argparse
from functools import partial

Expand All @@ -8,16 +10,62 @@ def get_argparser():
"""Get argument parser."""
parser = argparse.ArgumentParser(
description=("Diverse Radio Astronomy Tools for Imaging and Calibration"))
subparsers = parser.add_subparsers(help='commands')
list_parser = subparsers.add_parser('run', help='Run notebook server')
list_parser.add_argument('--port', action='store', help='Notebook server port')
argument = partial(parser.add_argument)
argument("-gn", "--generate_notebooks",
default=False, action='store_true',
help='Generate default notebook files (.ipynb format)')
return parser

def pull():
"""Use stimela to pull docker images"""
pass
def generate_notebooks():
"""Generate drasticali notebooks"""
time_start_load = time.time()
from shutil import copyfile
import drasticali
print("## Getting notebook files.")
drasticali_files = ['drasticali-add.ipynb',
'drasticali-edit.ipynb',
'drasticali-run.ipynb',
'drasticali-inspect.ipynb']
DRASTICALI_PATH = os.path.dirname(os.path.dirname(os.path.abspath(drasticali.__file__)))
copyfile('{}/{}/{}'.format(DRASTICALI_PATH, 'drasticali', drasticali_files[0]),
drasticali_files[0])
print(drasticali_files[0])
copyfile('{}/{}/{}'.format(DRASTICALI_PATH, 'drasticali', drasticali_files[1]),
drasticali_files[1])
print(drasticali_files[1])
copyfile('{}/{}/{}'.format(DRASTICALI_PATH, 'drasticali', drasticali_files[2]),
drasticali_files[2])
print(drasticali_files[2])
copyfile('{}/{}/{}'.format(DRASTICALI_PATH, 'drasticali', drasticali_files[3]),
drasticali_files[3])
print(drasticali_files[3])
print("## Done ({0:.3f}s)".format(time.time() - time_start_load))

def run_notebook(port):
"""Run the notebooks"""
import subprocess
bashCommand1 = "jupyter-nbextension enable --py widgetsnbextension --sys-prefix"
bashCommand2 = "jupyter-nbextension install --py jupyter_dashboards --sys-prefix"
bashCommand3 = "jupyter-nbextension enable --py jupyter_dashboards --sys-prefix"
bashCommand4 = "jupyter-notebook --NotebookApp.iopub_data_rate_limit=1000000000 --port={} --no-browser".format(port)
process = subprocess.Popen(bashCommand1.split(), stdout=subprocess.PIPE, shell=True)
process = subprocess.Popen(bashCommand2.split(), stdout=subprocess.PIPE, shell=True)
process = subprocess.Popen(bashCommand3.split(), stdout=subprocess.PIPE, shell=True)
process = subprocess.Popen(bashCommand4.split(), stdout=subprocess.PIPE, shell=True)

def main():
"""Main function."""
parser = get_argparser()
args = parser.parse_args()
if args.generate_notebooks:
generate_notebooks()
port = getattr(args, 'port', 0)
if port:
run_notebook(port)
elif port is None:
run_notebook('8888')

main()
11 changes: 5 additions & 6 deletions drasticali/drasticali-add.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
"import os\n",
"import json\n",
"import stimela\n",
"import drastic\n",
"import drasticali\n",
"import pkg_resources\n",
"from drastic import natural_keys, remove_cab\n",
"from drasticali import natural_keys, remove_cab\n",
"from ipywidgets import widgets, interact\n",
"from IPython.display import Javascript"
]
Expand Down Expand Up @@ -333,10 +333,9 @@
"metadata": {},
"outputs": [],
"source": [
"reload(drastic)\n",
"cab_num = cab_number.value\n",
"cab_func_name = cab.value\n",
"cab_func = getattr(drastic, cab_func_name, None)\n",
"cab_func = getattr(drasticali, cab_func_name, None)\n",
"for key, val in PAR.items():\n",
" if val.value in ['None']:\n",
" continue\n",
Expand Down Expand Up @@ -420,7 +419,7 @@
},
"outputs": [],
"source": [
"drastic.run_all(recipe, recipe_file.value)"
"drasticali.run_all(recipe, recipe_file.value)"
]
},
{
Expand All @@ -436,7 +435,7 @@
"metadata": {},
"outputs": [],
"source": [
"data = drastic.get_data(recipe_file.value)\n",
"data = drasticali.get_data(recipe_file.value)\n",
"recipe.jobs = []\n",
"data_keys = data.keys()\n",
"data_keys.sort(key=natural_keys)\n",
Expand Down
10 changes: 5 additions & 5 deletions drasticali/drasticali-edit.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
"import os\n",
"import json\n",
"import stimela\n",
"import drastic\n",
"import drasticali\n",
"import pkg_resources\n",
"from drastic import natural_keys\n",
"from drasticali import natural_keys\n",
"from ipywidgets import widgets, interact\n",
"from IPython.display import Javascript"
]
Expand Down Expand Up @@ -181,7 +181,7 @@
"metadata": {},
"outputs": [],
"source": [
"data = drastic.get_data(recipe_file.value)\n",
"data = drasticali.get_data(recipe_file.value)\n",
"recipe.jobs = []"
]
},
Expand Down Expand Up @@ -335,7 +335,7 @@
"\n",
"c = DATA[cab_func_name]\n",
"params = c['parameters']\n",
"cab_func = getattr(drastic, cab_func_name, None)\n",
"cab_func = getattr(drasticali, cab_func_name, None)\n",
"for key, val in PAR.items():\n",
" key = str(key)\n",
" if val.value in ['None', '', \"''\"]:\n",
Expand Down Expand Up @@ -391,7 +391,7 @@
},
"outputs": [],
"source": [
"drastic.run_all(recipe, recipe_file.value)"
"drasticali.run_all(recipe, recipe_file.value)"
]
}
],
Expand Down
File renamed without changes.
12 changes: 6 additions & 6 deletions drasticali/drasticali-run.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
"import os\n",
"import json\n",
"import stimela\n",
"import drastic\n",
"import drasticali\n",
"import pkg_resources\n",
"from drastic import natural_keys\n",
"from drasticali import natural_keys\n",
"from ipywidgets import widgets, interact\n",
"from IPython.display import Javascript"
]
Expand Down Expand Up @@ -176,7 +176,7 @@
"source": [
"Im = []\n",
"recipe.jobs = []\n",
"data = drastic.get_data(recipe_file.value)\n",
"data = drasticali.get_data(recipe_file.value)\n",
"cb_cont = widgets.HBox(background_color='red',height='200px',width='100%')\n",
"data_keys = data.keys()\n",
"data_keys.sort(key=natural_keys)\n",
Expand Down Expand Up @@ -217,7 +217,7 @@
" new_cab_params = dict()\n",
" cab_num = cab_value.split('_')[0]\n",
" cab_name = cab_value.split('{}_'.format(cab_num))[-1]\n",
" cab_func = getattr(drastic, 'cab_function', None)\n",
" cab_func = getattr(drasticali, 'cab_function', None)\n",
" for c in cb_cont.children:\n",
" if c.description == cab_value:\n",
" if c.value:\n",
Expand All @@ -227,7 +227,7 @@
" else cab_param_value)\n",
" cab_func(recipe, name=cab_name, num=cab_num, parameters=new_cab_params,\n",
" recipes_file=recipe_file.value, dump=False)\n",
"drastic.run_all(recipe, recipe_file.value)"
"drasticali.run_all(recipe, recipe_file.value)"
]
},
{
Expand Down Expand Up @@ -260,7 +260,7 @@
"source": [
"cab_ids, times = [], []\n",
"prefix = recipe_file.value.split('/')[-1].split('.')[0]\n",
"data = drastic.get_data('{}_time-it.json'.format(prefix))\n",
"data = drasticali.get_data('{}_time-it.json'.format(prefix))\n",
"data_keys = data.keys()\n",
"data_keys.sort(key=natural_keys)\n",
"for key in data_keys:\n",
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
aimfast
ipywidgets
stimela
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from setuptools import setup, find_packages

pkg = 'drasticali'
__version__ = '0.0.7'
__version__ = '0.0.8'

build_root = os.path.dirname(__file__)
scripts = ["bin/" + j for j in os.listdir("bin") ]
Expand All @@ -26,7 +26,7 @@ def requirements():
author="Athanaseus Ramaila",
author_email="[email protected]",
packages=find_packages(),
url="https://github.com/Athanaseus/Drastic",
url="https://github.com/Athanaseus/drasticali",
license="GNU GPL 3",
classifiers=["Intended Audience :: Developers",
"Programming Language :: Python :: 3",
Expand Down

0 comments on commit dd4a39f

Please sign in to comment.