Skip to content

Instantly share code, notes, and snippets.

@ChrisBeaumont
Created August 23, 2012 17:49
Show Gist options
  • Save ChrisBeaumont/3439395 to your computer and use it in GitHub Desktop.
Save ChrisBeaumont/3439395 to your computer and use it in GitHub Desktop.
Scripting Glue
from glue import core
from glue.core.data_factories import auto_data, tabular_data
from glue.core.link_helpers import Galactic2Equatorial, MultiLink
from glue.qt.glue_application import GlueApplication
from convert_xyz import galactic2xyz
# Load data from files
d = tabular_data('irdcs.fits')
d.label = "IRDC Catalog"
d2 = auto_data('mips_nessie.fits')
d2.label = "MIPS"
# Create Data Collection
dc = core.DataCollection([d, d2])
#define the links
links1 = Galactic2Equatorial(d.id['_RAJ2000'], d.id['_DEJ2000'],
d2.id['World x: GLON-CAR'],
d2.id['World y: GLAT-CAR'])
dc.add_link(links1)
links2 = MultiLink([d2.id['World x: GLON-CAR'], d2.id['World y: GLAT-CAR']],
['gx', 'gy'], galactic2xyz)
dc.add_link(links2)
#start application
glue = GlueApplication(dc)
glue.start()
@ChrisBeaumont
Copy link
Author

Example of setting up Glue using a python script. Posted to discuss whether scripting API can be simplified

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment