Questions tagged [python]

Questions about using the Python programming language to solve astronomical problems. General questions about Python are off-topic but might be asked on Stack Overflow.

57 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
6 votes
0 answers
117 views

Kepler ellipse orbit fit issues

I am helping my high schooler with a research paper that uses PyAstronomy to fit the orbit of stars around Sag A. It isn't working because the angles (parameters Omega, omega, and i) seem to have a ...
Emmy's user avatar
  • 61
5 votes
0 answers
330 views

Generate probability skymap

I am trying to generate skymaps for a set of Fermi GBM triggers, containing the probability that a trigger originated in a given part of the sky. For each trigger, I have access to the RA, dec, error ...
Mike's user avatar
  • 51
3 votes
0 answers
73 views

Keyerror: 0 while using astropy SkyCoord

I am facing a problem while using SkyCoord from astropy library. The scenario is as below, I have read the data from a fits file into a pandas dataframe. I have applied several quality cuts to the ...
CTZenScientist's user avatar
3 votes
0 answers
64 views

S/N binning of 2D spectral galactic data

I have the 2D spectrum of the ellipical galaxy NGC 4697 taken by a long slit spectrograph. The x-direction (horizontal) corresponds to wavelength and the y-direction (vertical) corresponds to distance ...
trynerror's user avatar
  • 829
3 votes
0 answers
159 views

Is there a tool to convert N-body RAMSES simulation file formats to GADGET 2 format in Python?

I am looking for a way to convert RAMSES files to GADGET-2 binary files because I want to use the package SimSpin (https://github.com/kateharborne/SimSpin/blob/master/R/make_simspin_file.R) which is ...
Jerome's user avatar
  • 155
3 votes
0 answers
29 views

How to find x-values of fourier-transformed correlation functions in velocity space?

I am trying to extract the kinematic parameters (rotation velocity, velocity dispersion, ...) of an elliptical galaxy by extracting the kinematical broadening function using the FCQ-Algortihm first ...
trynerror's user avatar
  • 829
3 votes
0 answers
588 views

Issues in dimensions and slicing while plotting contours over a FITS Image in Astronomical Plotting Library in python (APLpy)

I have been trying to plot the contours of a FITS image over itself in APLpy. The image was created in AIPS, and has dimensions (1024,1024,1,1), viz., right ascension (RA--SIN), declination (DEC--SIN),...
lordparthurnaax's user avatar
3 votes
0 answers
370 views

How do I plot field of view of an earth-based observatory in Galactic Coordinates?

I would like to plot in Galactic Coordinate the sky field-of-view of an earth-based observatory (e.g. MAGIC). Something like this from Liu et 2016. I already know how plot source positions on a 2D ...
Tutan's user avatar
  • 73
3 votes
0 answers
83 views

Detect sources near image edge with python photutils

As my question suggests, I 'm trying to use a python library photutils in order to detect sources from MUSE cube. MUSE (Multi Unit Spectroscopic Explorer) is an ...
Giuseppe Angora's user avatar
2 votes
0 answers
25 views

Sloan Digital Sky Survey - Obtaining Spectral and Photometric Datasets

I am working on a soft computing (fuzzy logic), genetic algorithm, explainable AI (XAI) classification system for astronomical objects from the Sloan Digital Sky Survey. The dataset I am currently ...
todd45040's user avatar
2 votes
0 answers
55 views

How can I compute reasonable errors on my Gaussian fits to the observed strong optical lines of interest?

I'm fitting Gaussians to optical lines spanning from H-beta to Sulfur using Astropy's Gaussian (https://docs.astropy.org/en/latest/api/astropy.modeling.functional_models.Gaussian1D.html) model with a ...
Astroturf's user avatar
  • 1,111
2 votes
0 answers
35 views

Colossus sigma function not reading the changes in the code

am currently using the colossus package on Python, which helps calculating functions that are relevant in Cosmology. I am interested in calculating a Matter power spectrum, and use it as a base to ...
Lorenzo's user avatar
  • 21
2 votes
0 answers
639 views

Calculating local solar time with python ephem library

I was learning to calculate local solar time with ephem. I must admit, unit conversion between radians, hours and days, which are all represented by a float in the ...
Sati's user avatar
  • 121
2 votes
0 answers
53 views

Contradictory errors in python package VESPA

VESPA is a python package that can calculate the False Positive Probability for Exoplanets. Here is the link to the repository https://pypi.org/project/VESPA/ https://github.com/timothydmorton/VESPA ...
Priyash Mistry's user avatar
2 votes
0 answers
287 views

How to subtract background correctly?

I want to perform sky background estimation and subtraction. To do that, I am adopting some libraries in python, i.e. photutils which does have *some support for background estimation. However, I ...
x12red's user avatar
  • 31
2 votes
0 answers
313 views

How to calculate orbital velocity of binary star?

I am trying to simulate the Alpha Centauri AB System. I built the simulation, it works flawlessly when trying to simulate our solar system, and I am now trying to simulate the AB System. I found all ...
Marc Klemm's user avatar
2 votes
0 answers
33 views

reference frames-healpix: projection parameters for smooth continuous tiles on a sky map

I am working on a newly completed survey which uses healpix fits files on 1/8th of the sky. I would like to set a flat skymap which covers the entire sky but it seems this will create artifacts and ...
triple7's user avatar
  • 153
2 votes
0 answers
81 views

healpix: creating isometric tiles for flat map of survey

I am currently tasked with creating a visual of a recently completed survey which is in HEALPix1 format. I am also required to use the DSS and Planck skymaps also in HEALPix, and would like to flatten ...
triple7's user avatar
  • 153
2 votes
0 answers
427 views

Logarithmic rebinning and continuum removal of stellar spectra

I am trying to learn how to derive the line of sight velocity distributions from galaxy spectrum to extract kinematical parameters like rotational velocity and velocity dispersion. Therefore I need to ...
trynerror's user avatar
  • 829
2 votes
0 answers
265 views

Using the 'exoplanet' module to fit a radial velocity curve for a binary star system

As part of a project, I am trying to fit a radial velocity curve using the tutorial for the binary star system (EBLM J0608-59) My code is quite similar to the tutorial, but as it is only one body ...
San's user avatar
  • 21
2 votes
0 answers
93 views

Should I fit a function to this lightcurve?

I am creating a light curve for the duration of a binary system in order to find out the duration of the eclipse. I am unsure as to whether to fit a function to the data (is it appropriate) as by ...
Owen Johnson's user avatar
2 votes
0 answers
77 views

PHOEBE 2.2 Documentation, components and semi-major axis definitions

I'm looking at PHOEBE 2.2 Documentation, specifically at a tutorial about constraints What are Constraints? Constraints live in their own context of the Bundle, and many are created by default - ...
Alex's user avatar
  • 155
2 votes
0 answers
152 views

How are small objects automatically identified and their locations determined in digital images?

I have a large quantity of old digital images of low energy electron diffraction (LEED) patterns that I must process to identify and locate small, sometimes elongated gaussian-like blobs of a few ...
uhoh's user avatar
  • 31.4k
2 votes
0 answers
105 views

How would I code to find the seeing of a binary star system in python?

I have fit images of binary systems and want a program that will help determine which ones are highest quality, the seeing. The simplest way is apparently to equate it to the FWHM of the Gaussian of ...
p. jlenp's user avatar
2 votes
0 answers
356 views

How to "slice" a fits table in astropy?

I have imported my fits table, hdul0, into python. I'm using astropy.table. I opened it with hdul0 = fits.open('filename'). hdul0data = Table(hdul0[1].data) I ...
Joey's user avatar
  • 21
2 votes
0 answers
122 views

Efficiently calculating power spectra from galaxy catalogs

I am dealing with a problem which requires calculating either the correlation function or the power spectrum. At times, the 2-point-correlator seems the better route, at others, the PS. Right now I am ...
Davis's user avatar
  • 193
2 votes
0 answers
539 views

Coordinates reduction python

How can I calculate position (alt, az) of star for observer at some station (longitude, latitude) on specific date and time? I need full coordinates reduction with all elements included in calculation ...
Prefect's user avatar
  • 21
1 vote
0 answers
33 views

Equation for calculating boolean answer to "is this Earth satellite in eclipse"

I have found plenty of math for determining duration of satellite eclipse, but I am having trouble finding an equation that produces a simple boolean answer to the question "Is this Earth ...
Michael Bonnet's user avatar
1 vote
0 answers
99 views

Three Body Problem using Python

I need help with an assignment. I'm doing a little project for a subject on my university and as the title says, its to find a solution to the three body problem restricted to a circular motion. The ...
diegoski01's user avatar
1 vote
0 answers
22 views

Obtaining Transit Spectrum for Celestial Bodies Using JWST NIRSPEC

I've recently been tasked with obtaining transit spectrum data for some fascinating celestial bodies, including Ceres, Enceladus, Ganymede, Io, and Titan. The goal is to compare their transit spectra ...
starry_explorer's user avatar
1 vote
0 answers
28 views

Computing Algol's apparent magnitude from TESS observation data

A helpful developer downloaded a light curve of Algol from STScI's MAST service of the TESS archive for me. Its content looks like this: ...
velkyvont's user avatar
1 vote
0 answers
93 views

Photometry in SExtractor vs Python

I wanted to find stars in the dwarf Spheroidal (dSph) galaxy. I performed photometry using SExtractor and in Python using DaoStarFinder and other astropy packages. However, while extracting the ...
Abhinna Sundar's user avatar
1 vote
0 answers
83 views

easy curve modeling package for transits that fits the data not just the parameters?

Does anyone have any recommendations for easy-to-use exoplanet transit light curve model fitting packages like batman, but that fits the data, not just the model parameters? Thank you so much. I need ...
strange_octopi's user avatar
1 vote
0 answers
91 views

Can this ppxf fit work?

I am trying to do kinematical analysis of spectra using ppxf-algorithm from Capellari. The velocity dispersion I get seems to be to high and I am not sure what the reason could be. On the website of ...
trynerror's user avatar
  • 829
1 vote
0 answers
56 views

How to plot matplotlib plots as tables in python(hdf5 tables)

I have extracted the data from a fits file and plotted a spectra.i need to do the same for multiple fits files .how can I store the resultant spectra's as a hdf5 table or fits table? And which ...
Walker's user avatar
  • 11
1 vote
0 answers
361 views

Nbody problem solving on python with Leapfrog

I am relatively new to astronomical programming and I am trying to code a simulation of the solar system as simplified as possible on python. To do so, I am using numpy in order to have one array ...
mkvb_78's user avatar
  • 11
1 vote
0 answers
123 views

how to plot Gauss-Hermite moment maps from arrays of star velocity values in Python?

I want to calculate Gauss-Hermite moments, such as h1,h2, h3, h4 moments from the values in an array of numbers which represent velocity distribution of stars in a galaxy. How would I fit a curve to ...
Jerome's user avatar
  • 155
1 vote
0 answers
129 views

Simulating Light Curve with the Timmer & Koenig method in Python

How to simulate the light curve using the Timmer & Koenig method in python with error bars in each counts generated by that method. I have used astro ML but I doesn't show the error in the counts. ...
unicorn's user avatar
  • 21
1 vote
0 answers
626 views

How to quickly loop through many small fits files for data analysis?

I need to extract information from a few columns in ~20k different fits files with python. Each file is relatively small, ~0.2MB. I have been doing this so far with a loop and ...
NeStack's user avatar
  • 313
1 vote
0 answers
32 views

Filtering local region in SIMBAD

I am completely new to astrophysics and currently writing a paper on Cepheid variables for high school physics. I would like to filter out all Cepheid variables in the local system which I would ...
Matthias G.'s user avatar
1 vote
0 answers
850 views

Schechter Luminosity Function fitting plot of galaxies

I would like to plot the Schechter Luminosity function of galaxies. Here is my data(I have the Luminosity L[Ha] in erg/s). I would like to plot like this figure from this paper. In this paper, they ...
astronerd's user avatar
1 vote
0 answers
78 views

Using lightkurve to identify a planet

I have gotten LightKurve to work and plot a lightcurve to allow for the identification of possible transits. However is there a way I can get it to run and tell me if there is a possible transit in ...
JuhBuh's user avatar
  • 11
1 vote
0 answers
353 views

Wavelength Calibration in Python - Line Identification algorithm

I was asked to develop a data reduction pipeline for a telescope and am facing a problem. I have the standard lamp spectra and need to identify the emission lines in order to find a wavelength ...
KurasaHakai's user avatar
1 vote
0 answers
508 views

Python interface for DMK 23U274 USB camera for astrophotography

I have access to a monochrome USB camera (DMK 23U274, The Imaging Source) and I'd like to record focal plane images from a small telescope with a python script that would control it by setting ...
uhoh's user avatar
  • 31.4k
1 vote
0 answers
230 views

Three Body Problem

I tried to solve the three body problem numerically. While after 1000 time steps the system looks stable (See Fig.1) it is completely unstable after 10000 time steps (See Fig.2). Is that an intrinsic ...
Elskrt's user avatar
  • 11
1 vote
0 answers
715 views

To show perihelion precession motion of Mercury in Python with matplotlib

I'm trying to make it more general code so I can trace even a parabola or hyperbola for $e=1, E=0$ and $e>1, E>0$ respectively. And after achieving that general code I want to make the same code ...
zircon's user avatar
  • 139
1 vote
0 answers
38 views

How can I get the fluxes of fetch_imaging_sample? - astroML

I'm working with astroML in Python and I need to get the fluxes from the magnitudes in r band of fetch_imaging_sample(). ...
klaudio's user avatar
  • 11
1 vote
0 answers
182 views

Plotting GAIA barycentric radial velocity data with python

Does anybody know of a good tutorial on how to use python and astropy to generate plots of GAIA, RAVE or any other database of barycentric (heliocentric) radial velocity data of stars in our galaxy? ...
Thomas Brennan's user avatar
1 vote
0 answers
628 views

Plot an AltAz grid over a square grid of RADec points

first post here. As I'm new, StackExchange won't let create or use the wcsaxes tag. wcsaxes looks like the most appropriate tool for the job, but astropy is closely related. I think the title says ...
Christopher Jordan's user avatar
0 votes
0 answers
21 views

How to plot different curves in the same polar cordinates in matplotlib?

I tried to plot the paths of particle of different sizes in the same polar coordinate using the code given below using matplotlib. somewhat like this: Instead I got this plot: while the path for ...
Lunthang Peter's user avatar