Skip to content

Commit

Permalink
Release of 0.2.2
Browse files Browse the repository at this point in the history
Release of 0.2.2
  • Loading branch information
ManonMarchand authored May 26, 2023
2 parents 1398839 + 3ae870b commit 777dfb5
Show file tree
Hide file tree
Showing 14 changed files with 238 additions and 99 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ ipyaladin/labextension/
package.json
package-lock.json
js/yarn.lock
js/.yarn

# OS X
.DS_Store
Expand Down
38 changes: 38 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Memo on sections

* **Added** for new features.
* **Changed** for changes in existing functionality.
* **Deprecated** for soon-to-be removed features.
* **Removed** for now removed features.
* **Fixed** for any bug fixes.
* **Security** in case of vulnerabilities.

## [0.2.2]

### Added

* the `height` parameter can now be called at instantiation to shape the ipyaladin widget
* there is now a right-click menu with the following options:
* take snapshot
* add
* new image layer
* new catalog layer
* load local file
* FITS Image
* FITS MOC
* VOTable
* What is this?
* HiPS2FITS cutout
* Select sources
* the attribute "show_simbad_pointer_control" can now be set to `True` at the instantiation of the widget

### Fixed

* compatible with JupyterLab4
29 changes: 20 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# ipyaladin

## Description

A bridge between Jupyter and Aladin Lite, enabling interactive sky visualization in IPython notebooks.

![ipyaladin example](ipyaladin-screenshot.png)

With a couple of lines, you can display Aladin Lite, center it on the target of your choice, and overlay an Astropy table:

![ipyaladin example](ipyaladin-screencast.gif)
![ipyaladin example](assets/ipyaladin-screencast.gif)

- [ipyaladin](#ipyaladin)
- [Examples](#examples)
- [Installation](#installation)
- [New features corner](#new-features-corner)
- [Development installation](#development-installation)

## Examples

Expand Down Expand Up @@ -37,21 +38,31 @@ Additionny, for a jupyterlab usage you will need to:

There is also a conda package that can be installed with:

conda install -c bmatthieu3 ipyaladin==0.2.1
conda install -c bmatthieu3 ipyaladin==0.2.2

## Development
## New features corner

![new_features](assets/new_features.gif)

## Development installation

First, make sure you have installed jupyter on your python environnement: `pip install jupyter`.
For a development installation [Node.js](https://nodejs.org) and [Yarn version 1](https://classic.yarnpkg.com/) are also required,

git clone https://github.com/cds-astro/ipyaladin.git
cd ipyaladin
npm install yarn
cd js
npm install
cd ..
pip install -e .

For Jupyter Notebook, do

jupyter nbextension install --py --symlink --overwrite --sys-prefix ipyaladin
jupyter nbextension enable --py --sys-prefix ipyaladin

When actively developing your extension for JupyterLab, you will need to run this command too:
For JupyterLab, you will need to run this command too:

jupyter labextension develop --overwrite ipyaladin

Expand Down
File renamed without changes
File renamed without changes
Binary file added assets/new_features.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% set name = "ipyaladin" %}
{% set version = "0.2.1" %}
{% set version = "0.2.2" %}

package:
name: "{{ name|lower }}"
Expand Down
6 changes: 3 additions & 3 deletions conda-recipe/readme
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ conda skeleton pypi --extra-specs jupyter-packaging ipyaladin
// change the meta.yaml in ipyaladin/
cp post-link.* pre-unlink.* ipyaladin
conda build ipyaladin --output-folder distrib
conda convert --platform all distrib/linux-64/ipyaladin-0.2.1-py39_0.tar.bz2 -o distrib
conda convert --platform all distrib/linux-64/ipyaladin-0.2.2-py39_0.tar.bz2 -o distrib
anaconda login
anaconda upload distrib/osx-64/ipyaladin-0.2.1-py39_0.tar.bz2
anaconda upload distrib/linux-64/ipyaladin-0.2.1-py39_0.tar.bz2
anaconda upload distrib/osx-64/ipyaladin-0.2.2-py39_0.tar.bz2
anaconda upload distrib/linux-64/ipyaladin-0.2.2-py39_0.tar.bz2

rm -r distrib ipyaladin
1 change: 1 addition & 0 deletions examples/1_Getting_Started.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
" target=\"galactic center\",\n",
" coo_frame=\"galactic\",\n",
" fov=40,\n",
" height=600\n",
")\n",
"aladin"
]
Expand Down
4 changes: 2 additions & 2 deletions ipyaladin/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Module version
__version__ = '0.2.1'
__version__ = '0.2.2'

NPM_PACKAGE_RANGE='^0.2.1'
NPM_PACKAGE_RANGE='^0.2.2'
96 changes: 91 additions & 5 deletions ipyaladin/aladin_widget.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,63 @@
import ipywidgets as widgets
from traitlets import (Float, Unicode, Bool, List, Dict, default)
from ._version import NPM_PACKAGE_RANGE
import math

# See js/lib/example.js for the frontend counterpart to this file.

@widgets.register
class Aladin(widgets.DOMWidget):
"""An example widget."""
"""An instance of the Aladin widget.
Adaptative attributes can be updated later. The other ones can only
be written when creating the widget instance, i.e. when calling Aladin()
...
Attributes
----------
fov : float, default: 60
The desired initial field of view, expressed in degrees.
adaptative
target : string, default: "0 +0"
The desired target.
adaptative
coo_frame : string, default: "J2000"
Reference frame.
adaptative
survey : string, default: "P/DSS2/color"
Name of the survey.
adaptative
...
height : float, default: 400
Height of the Aladin widget in pixels
reticle_size : float, default: 22
Size of the reticle.
reticle_color : string, default: "rgb(178, 50, 178)"
The color of the reticle.
show_reticle : bool, default: True
Controls wether a reticle is present in the middle of the view
show_zoom_control : bool, default: True
show_fullscreen_control = bool, default: False
Wether the fullscreen button appears in the top right corner
Defaults to False because this does not work in retrolab.
Can safely be turned to True in Jupyterlab.
show_layers_control : bool, default: True
show_goto_control, bool, default: True
show_simbad_pointer_control : bool, default: True
Controls the quick search tool apparition on the left
side of the view.
show_share_control : bool, default: False
Controls the apparition of the share button in the bottom
right corner. This button opens a popup with a sharable link
to an Aladin previewer that starts with the actual state of the
view.
show_context_menu : bool, default: True
Controls wether a right click will open a menu. This menu is documented
here # TODO add link to documentation when it will exist.
TODO: finish docstring
"""

# Name of the widget view class in front-end
_view_name = Unicode('AladinView').tag(sync=True)
Expand Down Expand Up @@ -45,7 +96,9 @@ class Aladin(widgets.DOMWidget):
show_fullscreen_control = Bool(False).tag(sync=True, o=True)
show_layers_control = Bool(True).tag(sync=True, o=True)
show_goto_control = Bool(True).tag(sync=True, o=True)
show_simbad_pointer_control = Bool(True).tag(sync=True, o=True)
show_share_control = Bool(False).tag(sync=True, o=True)
show_context_menu = Bool(True).tag(sync=True, o=True)
show_catalog = Bool(True).tag(sync=True, o=True)
show_frame = Bool(True).tag(sync=True, o=True)
show_coo_grid = Bool(False).tag(sync=True, o=True)
Expand All @@ -55,6 +108,9 @@ class Aladin(widgets.DOMWidget):

options = List(trait=Unicode).tag(sync=True)

# this sets the height of the widget
height = Float(400).tag(sync=True)

# the following values are used in the classe's functions

# values used in the add_catalog_from_URL function
Expand Down Expand Up @@ -159,11 +215,35 @@ def add_moc_from_dict(self, moc_dict, moc_options = {}):
# 2 - It seems that the list.append() method does not work with traitlets,
# the affectation of the columns must be done at once by using a buffer.
def add_table(self, table):
""" load a VOTable -already accessible on the python side- into the widget
Args:
table: votable object"""
""" Load a table into the widget.
Parameters
----------
table : astropy.table.table.QTable or astropy.table.table.Table
table that must contain coordinates information
Examples
--------
Cell 1:
>>> from ipyaladin import Aladin
>>> from astropy.table import QTable
>>> aladin = Aladin(fov=2, target='M1')
>>> aladin
Cell 2:
>>> ra = [83.63451584700, 83.61368056017, 83.58780251600]
>>> dec = [22.05652591227, 21.97517807639, 21.99277764451]
>>> name = ["Gaia EDR3 3403818589184411648",
"Gaia EDR3 3403817661471500416",
"Gaia EDR3 3403817936349408000",
]
>>> table = QTable([ra, dec, name],
names=("ra", "dec", "name"),
meta={"name": "my sample table"})
>>> aladin.add_table(table)
And the table should appear in the output of Cell 1!
"""

# theses library must be installed, and are used in votable operations
# this library must be installed, and is used in votable operations
# http://www.astropy.org/
import astropy

Expand All @@ -179,7 +259,13 @@ def add_table(self, table):
if isinstance(item, bytes):
row_data.append(item.decode('utf-8'))
else:
if not isinstance(item, str):
# replace NaN by " ", this is a quick fix
# and should be questioned when doing a rework
# of this function
item = " " if math.isnan(item) else item
row_data.append(item)

table_columns.append(row_data)

self.table_columns = table_columns
Expand Down
Loading

0 comments on commit 777dfb5

Please sign in to comment.