How to search using python's astroquery and get fits images with skyview

I want to search with astroquery and save fits images

astroquery

As a starting point, use astroquery to find out the data and celestial bodies you want. For how to use it, refer to Searching the space astronomical catalog using python's astroquery and simple plotting method using galaxies.

change name

Skyview cannot determine NGC only by "N", but depending on the catalog, NGC is often omitted and only N is used. In the following, N is changed to NGC and I is changed to IC to generate a list of names.

skyview

astroquery's skyview provides the images at https://astroquery.readthedocs.io/en/latest/skyview/skyview.html. Here, an example shows an example in which an X-ray image of Rosat's HRI and a visible image of DSS are downloaded and saved in fits.

Sample code

Here, An X-ray catalog and atlas of galaxies. (Fabbiano +,) at http://vizier.u-strasbg.fr/viz-bin/VizieR-3?-source=J/ApJS/80/531/gxfluxes 1992) is shown as a reference example.

python


#!/usr/bin/env python

from astroquery.vizier import Vizier 
v = Vizier(catalog="J/ApJS/80/531/gxfluxes",columns=['Name',"logLx","Bmag","dist","type"],row_limit=-1)
data = v.query_constraints()
sname = data[0]["Name"] 
namelist = []

olist=["HRI","DSS"]

def save(p,name,obs):
    for onep,oneo in zip(p,obs):
        onep.writeto(name+"_"+oneo+".fits",overwrite=True)

for one in sname:
    name=one.strip().split()[0]
    name=name.replace("N","NGC").replace("I","IC")
    namelist.append(name)

from astroquery.skyview import SkyView
for i,name in enumerate(namelist):
    print(i,name)
    try:
        paths = SkyView.get_images(position=name, survey=olist)
        save(paths,name,olist)
    except:
        print("..... ERROR ",i,name)


Plot method

How to plot the fits image downloaded in this way How to plot multiple fits images side by side using python. Astronomical tools such as ds9 may be used, but batch processing is often troublesome with ds9.

Advanced version

How to get an image of a supernova remnant

The database is https://vizier.u-strasbg.fr/viz-bin/VizieR?-Source=VII/272 A catalog of Galactic supernova remnants (Green, 2014) A catalog of Galactic supernova remnants (Green, 2014) Seems to be the latest, so I will use this.

Code and notes

It's basically the same as above, but the name given to the SkyView positon must be a name recognized by SIMBAD or NED, so for example, G016.2-02.7 is not enough, and SNR is added before it. I have to.

Other than that, in the case of X-rays and visible light of distant galaxies, the apparent diameters are almost the same, but since the supernova remnants are celestial bodies in the system, the apparent diameters vary widely, so the optimum image is automatically acquired as below. Not really (will be revised somewhere).

python


#!/usr/bin/env python

from astroquery.vizier import Vizier 

v = Vizier(catalog="VII/272/snrs",columns=["SNR","type","S","Names"],row_limit=-1)
#https://vizier.u-strasbg.fr/viz-bin/VizieR?-source=VII/272
#A catalogue of Galactic supernova remnants (Green, 2014) A catalogue of Galactic supernova remnants (Green, 2014)
data = v.query_constraints()

sname = data[0]["SNR"] 
namelist = []

olist=["HRI","DSS","Fermi 5"]

def save(p,name,obs):
    for onep,oneo in zip(p,obs):
        onep.writeto(name+"_"+oneo+".fits",overwrite=True)

for one in sname:
    name=one.strip().split()[0]
    namelist.append(name)

from astroquery.skyview import SkyView
for i,name in enumerate(namelist):
    print(i,name)
    try:
        paths = SkyView.get_images(position="SNR " + name, survey=olist)

Recommended Posts

How to search using python's astroquery and get fits images with skyview
How to get started with Scrapy
How to get started with Python
How to get followers and followers from python using the Mastodon API
How to get parent id with sqlalchemy
How to get started with laravel (Linux)
How to process camera images with Teams and Zoom Sentiment analysis with Tensorflow
How to get the date and time difference in seconds with python
Get tweets with Google Cloud Function and automatically save images to Google Photos
[Python] Try to recognize characters from images with OpenCV and pyocr
Try to make it using GUI and PyQt in Python
Try using pytest-Overview and Samples-
Send messages and images using LineNotify
Try using pynag to configure Nagios
Try to get statistics using e-Stat
[Python] I tried using YOLO v3
How to search using python's astroquery and get fits images with skyview
How to get started with the 2020 Python project (windows wsl and mac standardization)
How to plot multiple fits images side by side in galactic coordinates using python
Automatically save images and videos hit by Twitter search to iPhone using Pythonista3
How to deal with SessionNotCreatedException when using Selenium
How to read an array with Python's ConfigParser
How to get article data using Qiita API
How to display images continuously with matplotlib Note
How to search HTML data using Beautiful Soup
Upload images to S3 with GUI using tkinter
[For beginners] How to display maps and search boxes using the GoogleMap Javascript API
How to process camera images with Teams or Zoom
[Rails] How to get location information using Geolocation API
Get media timeline images and videos with Python + Tweepy
How to get a logged-in user with Django's forms.py
How to share folders with Docker and Windows with tensorflow
How to get more than 1000 data with SQLAlchemy + MySQLdb
How to extract null values and non-null values with pandas
How to loop and play gif video with openCV
How to get mouse wheel verdict with Python curses
How to analyze with Google Colaboratory using Kaggle API
[How to!] Learn and play Super Mario with Tensorflow !!
How to get RGB and HSV histograms in OpenCV
How to parse Java source code with AST (Abstract Syntax Tree) using ANTLR and Python
[Python / Ruby] Understanding with code How to get data from online and write it to CSV
How to process camera images with Teams and Zoom Volume of processing in animation style
How to kill a process instantly with Python's Process Pool Executor
Cloud Functions to resize images using OpenCV with Cloud Storage triggers
[Python] How to play with class variables with decorator and metaclass
I tried to get Web information using "Requests" and "lxml"
How to print characters as a table with Python's print function
Send experiment results (text and images) to slack with Python
How to resolve CSRF Protection when using AngularJS with Django
How to add new data (lines and plots) using matplotlib
How to do Bulk Update with PyMySQL and notes [Python]
How to get all the keys and values in the dictionary
How to update FC2 blog etc. using XMLRPC with python
How to create dataframes and mess with elements in pandas
How to get temperature from switchBot thermo-hygrometer using raspberry Pi
Get additional data to LDAP with python (Writer and Reader)
How to output additional information when logging with python's logging module
Convert pixiv to mp4 and download from pixiv using python's pixivpy
[Introduction to Python] How to get data with the listdir function
How to log in to AtCoder with Python and submit automatically
How to use search sorted
How to update with SQLAlchemy?
How to cast with Theano
How to Alter with SQLAlchemy?
How to separate strings with','
How to RDP with Fedora31
How to Delete with SQLAlchemy?
How to set a shortcut to switch full-width and half-width with IBus