756 questions
0
votes
0
answers
54
views
Preventing matplotlib ax.annotate from overflowing with WCS projection
A scatter plot with an astropy wcs projection is limited to just the xlim/ylim of the axis, even if there are points outside that range:
import numpy as np
import matplotlib.pyplot as plt
import ...
0
votes
0
answers
96
views
What's wrong with my Syndyne-Synchrone (comet tail) PA output?
Been investigating the 3I/Atlas (or C/2025 N1) rabbit hole. Of note is its ''anti-tail'' with some arguing it isn't a perspective effect. So, to test this I'm trying to use a ''syndyne-synchrone'' ...
0
votes
0
answers
232
views
need help Replicating Stellarium-Style Constellation Maps with Python (Skyfield + Gaia) for given place time and date
I’m trying to plot constellations with Python using Gaia star data, but the constellation lines don’t look like they do in Stellarium. I’ve tried plotting in both Alt/Az and RA/Dec, even used a ...
4
votes
2
answers
110
views
How to save an Astropy QTable with a galactocentric skycoord to a FITS file?
Creating a SkyCoord object:
c_end = SkyCoord(
x=xf,
y=yf,
z=zf,
v_x=vxf,
v_y=vyf,
v_z=vzf,
frame='galactocentric'
)
and attempting to put this into an Astropy QTable with ...
1
vote
2
answers
171
views
Plot Matplotlib 2D patches with spherical projection
I am trying to create a slightly complex 2D plot with astronomical data, using Matplotlib, and Astropy. It involves a astronomical image, overlaid with a scatter plot, and Matplotlib patches. Using ...
2
votes
1
answer
100
views
How to scatter plot marker size based on astronomy image data?
For example, in this code I plot a astronomy FITS image:
import numpy as np
from astropy.io import fits
from astropy.visualization import simple_norm
from astropy.wcs import WCS
import matplotlib....
-1
votes
1
answer
68
views
Inserting a timestamp to a Data Frame in pandas
I've been working on this for two weeks. I have a data frame with 3,600 columns and 200 rows, which correspond to a frequency sweep performed with a detector. The file's original format is .fit, so I'...
0
votes
1
answer
36
views
KeyError using Astropy .differentials code
I keep getting KeyError: 'd_ρ' on my d_rho = ... line. I am trying to run the differentials so that I can put them in a table column (or single column per variable), to use for calculating velocity. ...
0
votes
1
answer
93
views
Discrepancy in distances returned by astropy AltAz
I am writing some code dealing with an aircraft locations with respect to an observer located at ground and I got a discrepancy between the distance calculated directly from geocentric Cartesian ...
1
vote
2
answers
125
views
Differences between transform_to(AltAz) between Astropy versions 4.0 and 5.3.1
I am trying to do the transfomation from ITRS to topocentric AltAz frame using SkyCoord.transform_to() functionality:
altazCoord = itrsCoord.transform_to(AltAz(obstime=time, location=obsGeoLocation)
...
0
votes
1
answer
68
views
change grid interval in astropy curved axis
import astropy.units as u
import numpy as np
from astropy.io import fits
from astropy.wcs import WCS
import matplotlib.pyplot as plt
from astropy.visualization import simple_norm
from astropy....
2
votes
1
answer
142
views
Scatter plot on a region of the sky with a circle
I am trying to do a scatter plot of a few data points on a region of the sky and then add a circle to the plot. Note, that I don't want a plot of the full sky, just of the region around the data ...
0
votes
1
answer
202
views
How to correctly make a 'rebinning' of a .fits file?
The thing is i'm working with two .fits images, but the pixscale of each one is different.
Let's say Image 1 has a
CDELT = +- 0.0013888888888889 [deg]
and Image 2 has a
CDELT = +- 0.00277778000000 [...
1
vote
1
answer
96
views
Add "+" sign in positive values using astropy and matplotlib
I'm using astropy, matplotlib, skyfield and astroquery to create sky charts with Python. With skyfield I do the stereographic projection of the sky. With astropy I use WCS, something like this:
fig = ...
-1
votes
1
answer
347
views
Import python packages astropy occur issues, how can i handle it?
My Python script is:
import numpy as np
import matplotlib.pyplot as plt
import cv2
from fil_finder import FilFinder2D
from astropy import units
skeleton = cv2.imread("./zhang.png", 0)
fil = ...
1
vote
1
answer
104
views
Control how many digits are printed for an astropy quantity in a jupyter notebook
I use astropy to make calculations with units and I normally do these calculations in a jupyter notebook so the results are printed nicely. I would like to know how to control the number of digits ...
2
votes
2
answers
499
views
Querying data from Simbad using astroquery
I'm making a script in Python to get information for all objects from the NGC and IC catalogs. Actually, I already have this information from OpenNGC, however, coordinates don't have the same ...
2
votes
2
answers
854
views
Plotting star maps with equatorial coordinates system
I'm trying to generate star maps with the equatorial coordinates system (RAJ2000 and DEJ2000). However, I only get a grid system where meridians and parallels are in parallel, while parallels should ...
1
vote
1
answer
116
views
Spaces in the object name for astroquery Simbad.query_object
I have a list of object names without any spaces, but the Simbad.query_object of astroquery requires spaces.
For example, with space works... see below:
from astroquery.simbad import Simbad
...
1
vote
1
answer
191
views
How to check for failed convergence when using astropy fitting (specifically LevMarLSQFitter())
The sequence:
fit_something = fitting.LevMarLSQFitter()
fitted = fit_something(initial_guess_and_model,x,y,acc=accuracy,maxiter=maximumum_iterations)
Will provide a fitted model, and in the ...
1
vote
1
answer
205
views
How can I save and load header information of FITS files suing pickle?
Background
I want to convert the header information of a FITS data into a dictionary and save it as a binary file using Python. And of course, the binary data has to be loaded later.
Problem
The ...
1
vote
1
answer
1k
views
Optimizing Lat/Lon Extraction from Astropy's GeocentricTrueEcliptic SkyCoord
I am facing a challenge that should be straightforward but has proven to be quite complex with the Astropy library. Specifically, I need to frequently compute the longitude and latitude from a ...
0
votes
1
answer
318
views
Astropy: using SkyCoord object to calculate the AltAz coordinates for an object in a time range, want to get the date of max altitude
I want to find the date in which an object will be at its maximum altitude in the sky for a set location.
Given an object's right ascension and declination, an observers location and a range of dates, ...
0
votes
1
answer
323
views
How to write a fits file from an ASCII file (astronomical spectrum)?
I have used iraf in the past to do this, and I have no problem when the pixel scale does not vary (although I have to manually edit the task parameters for it to work correctly). Now I am working with ...
0
votes
1
answer
301
views
How to convert MJD time in UTC (only date, no time) in order to make a plot
I have a list of MJD time. I need to convert it in list UTC but only the date (year/month/day) and no time, so a list that I can use to make a plot with time in x-axis.
Thanks
I tried with astropy and ...
1
vote
1
answer
165
views
Unable to change Astropy cache location
I'm running the latest version of Astropy in Python using a Mac. I'd like to change the directory where Astropy caches files.
I'm running:
astropy.config.set_temp_cache(path='/Users/josephprendergast/...
0
votes
0
answers
130
views
How to access the quasar spectrum from the FITS file in SDSS DR16 catalog
I am trying to access the SDSS catalog through the FITS file I downloaded here, I am looking at the DR16Q_v4.fits file.
Unfortunately I cannot seem to find where the actual spectrum data is located ...
2
votes
1
answer
886
views
How do I use Astropy to transform coordinates from J2000 to Lat, Lon, and Altitude
I've followed the instructions from questions present on this site pertaining to this issue, but the code all seems off. For one thing, the altitude seems far too low, and it doesn't appear that the ...
1
vote
1
answer
562
views
AstroPy to transform coordinates
I want to transform the icrs coordinates (ar and dr) from epoch 1991.25 to epoch 2016.0, also in the icrs system.
But I got this error. It's my first time using AstroPy.
<SkyCoord (ICRS): (ra, dec) ...
1
vote
2
answers
3k
views
Cannot import name 'update_default_config' from 'astropy.config.configuration'
When I imported aplpy,
I got this error:
ImportError Traceback (most recent call last)
Input In [12], in <cell line: 9>()
7 from astropy.coordinates import SkyCoord
...
0
votes
0
answers
288
views
How do I convert from cartesian ECEF coordinates to RA and Dec as seen from a specific earth location?
I have the x,y,z positions of a gps satellite from its precise ephemerides and I am not sure how I can convert from these cartesian ECEF coordinates (WGS-84 G2139 IERS2010 frame specifically) to RA ...
-1
votes
1
answer
93
views
Centroids (photutils.centroids) uncertainty
There is no way to get the uncertainty from the Centroids (photutils.centroids) function. I need to be able to retrieve uncertainty due to using the tool to measure velocities requiring an amount of ...
1
vote
1
answer
268
views
PIL does not visualise FITS files
I will start this post by saying that although I can code a little, I'm not super good at it yet so apologies if the answer is really obvious and I do not see it.
I have a series of .fits files that I ...
0
votes
0
answers
122
views
How to flatten 3d astronomical coordinates into 2d polar form in Python
I am making a 2d simulation of the solar system. For that you need a starting point for all planets. Right now I am storing that data in this form (ignore the color, radius, mass and Max_Trail_Length ...
0
votes
0
answers
62
views
astropy exits none zero on header update
I have an astronomical image fits format with WCS (World Coordinate System) in its header.
I want to do some morphological operations on the image and understandably I want to correct the WCS.
Say I ...
0
votes
0
answers
123
views
Astropy: SkyCoord.from_name() - module 'urllib.request' has no attribute 'HTTPSHandler'
I'm new to Python and just started learning this. I'm trying to figure out how to work with the Jupyter Notebook for searching for an object name in online databases. I wrote two versions of the code (...
2
votes
0
answers
836
views
Circular import error with astropy.coordinates.representation
I'm trying to import astropy.coordinates.representation in a Jupyter notebook and I get a circular import error:
> ImportError: cannot import name 'SphericalRepresentation' from partially ...
0
votes
1
answer
206
views
how to find the b and v colour filter magnitudes to get the temperature of a star
I'm trying to retrieve b and v magnitudes for a specific star from the Sloan Digital Sky Survey (SDSS) database, but I'm facing some challenges with my code.
Here are my requirements:
I need to input ...
0
votes
0
answers
878
views
ERROR: Could not build wheels for astropy, which is required to install pyproject.toml-based projects when installing Poliastro
I'm trying to install poliastro on windows 10 through pip. I have pip updated to the latest version; however, every time I try to install poliastro, I keep getting the error message in the title, ...
0
votes
1
answer
543
views
How to write an ascii table using Astropy without the column names?
I construct a table using Astropy as follows: data = astropy.table.Table(names=['Time', 'Rate (C/s)']). Then, I fill up the rows under the aforementioned columns using data.add_row. Finally, I intend ...
1
vote
1
answer
912
views
How can I get solar system body mass/radius in Python?
Can I use Astroquery/Astropy to get the radius and mass of solar system objects? Or another common library?
I've been trying to use astroquery.horizons
I've tried elements() and ephemeris() but no ...
2
votes
0
answers
157
views
importlib-metadata package not found for PIL (Pillow)
The little program below is almost a copy-paste for an example form Astropy website. The program works fine under PyCharm environment but when trying to make it executable using PyInstaller, I'm ...
0
votes
0
answers
224
views
Rotating Quadrangle in astropy?
I have been attempting to overplot a Quadrangle on a map that I have to replicate a slit with data on the sky, but I need to rotate the Quadrangle around some center point and have not been able to ...
1
vote
2
answers
139
views
How to generate numbers of 2D gaussian sources in an array?
I want to generate a number of Gaussian sources in a fits array. My code is below.
from astropy.io import fits
from numpy import *
xx=yy=1024
xc=xx/2.;yc=yy/2.
A=10.0
gau=zeros([xx,yy])
for i in range(...
1
vote
1
answer
190
views
Concatenate or add rows to an Astropy Timeseries
I'm trying to read multiple CSV files from nightly observations.
Each CSV file has a time and magnitude column and I want to be able to stack all my nightly files into a single Timeseries object.
It ...
-3
votes
1
answer
279
views
What part of the fits file from sdss contains the spectrum?
I'm working on a CNN quasar detector that takes the optical spectrum as input, and classifies it as Quasar or non-quasar.
I'm currently gathering data from this site:https://dr18.sdss.org/optical/...
1
vote
0
answers
129
views
What is the longest period/shortest frequency that can be reliably recovered using the Lomb-Scargle periodogram?
I have some astronomical light curves for which I'm trying to recover some periodicities. One of them (from TESS) has many thousand samples across ~23 days, with a ~1-day gap in the middle. The ...
2
votes
1
answer
780
views
Plotting space regions and points
I'm trying to plot regions using astropy, but at the same time plot points as scatter plot. But I'm not managing to understand what is happening with the coordinates or the matplotlib artists.
First ...
0
votes
1
answer
424
views
Creating Custom Complex Units with astropy.units and Custom Conversions
I am working with astronomical data and need to work with custom units, specifically in Mega Jansky per steradian. I would like to create these custom units using the astropy.units library and also ...
0
votes
0
answers
89
views
Error in CompImageHDU FITS file reading from pyfits
I am getting this error trying to read data from a FITS file. I can see that the file contains the correct data because DS9 viewer shows the image I would expect. The error I'm getting is below. Can ...