Skip to main content

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.

64 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
6 votes
0 answers
131 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
366 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
4 votes
0 answers
96 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
81 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
  • 849
3 votes
0 answers
195 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
30 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
  • 849
3 votes
0 answers
741 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
414 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
104 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
74 views

Using prospector for jwst data

I am working with JWST data. I want to estimate the redshift of the sources I have identified with SEXtractor with the help of prospector. Can somebody guide me in this?
Walker's user avatar
  • 79
2 votes
0 answers
33 views

How to convert .exp files from NRAO VLA Archive to .fits format

I recently downloaded some observational data files from the NRAO VLA Archive, and they have the extension .exp. These are old observations. I need to convert these files to .fits format for further ...
Eduardo Quiroz's user avatar
2 votes
0 answers
34 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
91 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
44 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
852 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
58 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
392 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
159 views

Simulating Light Curve with the Timmer & Koenig method in Python

How can I 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 it doesn't show the error in the ...
unicorn's user avatar
  • 31
2 votes
0 answers
371 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
36 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
108 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
548 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
  • 849
2 votes
0 answers
297 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
112 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
91 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
160 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
  • 30.6k
2 votes
0 answers
115 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
391 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
144 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
561 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
26 views

CASA: Parsing RA and Dec output of imfit using au.imfitparseCLB

Currently working on a project in CASA where I want to make a position, velocity and intensity table for some images I've been analyzing, and applying imfit to get Gaussian fits. Specifically, these ...
user58538's user avatar
1 vote
0 answers
14 views

Efficient sky searches with HEALPix-alchemy

I am trying to implement a cone search for a catalog with the HEALPix-alchemy package. I have the following models set up, based on the examples here: https://arxiv.org/pdf/2112.06947 ...
jm22b's user avatar
  • 157
1 vote
0 answers
45 views

Tiling the sky with astropy-healpix

I have a bunch of files containing sources with galactic l and b values. What I want is to redistribute the sources such that each new file contain sources that fall within 15 degrees of a central l,b ...
Debajyoti Sengupta's user avatar
1 vote
1 answer
61 views

Calculating field rotation between two times

I have the formulae to calculate the rate of field rotation at any given time, and using a python script with Skyfield I can generate a a value incrementing every 10th of a second based on the live ...
Tanenthor's user avatar
  • 623
1 vote
0 answers
67 views

Python Lightkurve Module -- How to combine different TESS sectors into one graph

I'm building a pipeline to look at several thousand eclipsing binary systems for my master's thesis, and I've run into an issue I am having a hard time fixing. I'm using the Python module Lightkurve. ...
Erika Dunning's user avatar
1 vote
0 answers
364 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
25 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
38 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
199 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
125 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
  • 849
1 vote
0 answers
62 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
  • 79
1 vote
0 answers
523 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
141 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
764 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
  • 323
1 vote
0 answers
46 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
1k 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
93 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
392 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
557 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
  • 30.6k
1 vote
0 answers
278 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