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.

Filter by
Sorted by
Tagged with
2 votes
0 answers
20 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
2 answers
107 views

python question-discrepancy between number of stars found

Ok, I get that this is a long question but it's ok if you don't know just thought I'd give this a try anyway. I get that it's a long shot. Basically I'm trying to replicate a methodology used in the ...
Rjs2312's user avatar
  • 29
2 votes
1 answer
56 views

"inconsistent TLE object name (LINE IGNORED)" error while using JPL Horizons API in python

I have troubles with usage of JPL Horizons API to generate ephemeris of more than one satellites. I'm not using and don't want to use any external libraries to do this. Currently I have this piece of ...
jlipinski's user avatar
  • 297
1 vote
0 answers
40 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
51 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
2 votes
1 answer
64 views

Inconsistency between Horizons data retrieved via Astroquery and Horizons web interface

I am attempting to obtain the x, y, z coordinates of the Sun-asteroid vector using Horizons. The code I wrote is: ...
Milagros Colazo's user avatar
0 votes
0 answers
63 views

calculating Sun's J band mag via integrating the Planck’s law

...
questionhang's user avatar
  • 3,137
4 votes
1 answer
81 views

How to speed up REBOUND python simulations on a Jupyter notebook?

I'm running Python based computational astrophysics simulations on a Jupyter notebook, with the help of a library called REBOUND (also using REBOUNDx), to create a simulation containing the solar ...
poseidon24's user avatar
4 votes
1 answer
54 views

Efficient method for generating combined spectra from N-body simulation data using Python (convolution)

(I asked this same question also in StackOverflow, due to being both astronomy/coding problem, here link : https://stackoverflow.com/questions/78166419/efficient-method-for-generating-combined-spectra-...
mamark's user avatar
  • 43
5 votes
2 answers
604 views

How to calculate the true distance of the sun and the earth using skyfield?

I'm trying to calculate the true distance between the sun and the Earth using skyfield. To estimate the distance at a time instance I use the barycentric coordinates of the sun and earth using the ...
Klaus Rohe's user avatar
7 votes
1 answer
199 views

Attempting to plot solar terminator using Python and Skyfield library

Problem I would like to plot the small circle defining the visible portion of Earth for an observer at position $P$ away from the Earth, on a 2D map. In the case of the Sun, this would be the solar ...
Hunter's user avatar
  • 321
2 votes
1 answer
114 views

Implementing polar coordinates correctly in solar system model?

I am working on a 2d solar system model using Python, but I'm unsure if my implementation of planet data is correct. I have the planet data stored in polar form (distance, velocity and angle), and I ...
Tmpecho's user avatar
  • 45
4 votes
2 answers
143 views

Resolving variance between Skyfield-generated sun vectors and test data when both use same ephemeris

I have two functions that get TEME and GCRS Earth-Sun position vectors using Skyfield: earth_sun_vectors.py ...
Michael Bonnet's user avatar
1 vote
0 answers
45 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
1 answer
84 views

Plotting scatter graphs with fits binary file?

Basically I'm trying to create code in python which will allow me to open a Fit's binary file, read it and create a scatter diagram with it. Hopefully plotting LogG vs Teff. But it seems like ...
Rob1's user avatar
  • 37
2 votes
1 answer
79 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
335 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
0 votes
0 answers
33 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
2 votes
1 answer
55 views

Help with simulating long-term orbital dynamics of exoplanetary systems using Rebound

I am a junior in high school working on an independent research project and I need help because I've reached the limits of my knowledge. My goal is to simulate the long-term orbital dynamics of ...
HSStudent's user avatar
2 votes
0 answers
32 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
0 votes
0 answers
41 views

Looking for feedback for my python GUI: visualise exoplanet transit and simulate atmospheric temperature

This isn't necessarily an astronomy question (although there may be plenty of astronomy errors in my GUI), and I apologise in advance if this kind of thing is not allowed here and the question is to ...
Marco Leonardi's user avatar
1 vote
0 answers
24 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
2 votes
0 answers
82 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
0 votes
0 answers
95 views

PYTHON calculation of conversion coefficients for UBVRI filters to standard photometric system

First of all hello, I am new to this forum and I apologize in advance if I am wrong. I am doing open cluster observations and as a result of these observations I am trying to find the conversion ...
houst's user avatar
  • 17
0 votes
0 answers
174 views

Compute rotation angle of fits image

I have a fits image and the header has the keys PC1_1, PC1_2, PC2_1, PC2_2. I want to compute the angle by which my image is rotated so that North will be up. I use the formula below: angle = np....
Sketos's user avatar
  • 31
2 votes
0 answers
42 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
1 answer
190 views

What is the mathematics needed for understanding DE440 and translating it into xyz coordinates?

I would like to write my own code to process NASA's DE440/DE441 ephemerides, but I do not know the mathematics needed to do this. I understand packages such as pyephem have implemented variations of ...
Ana's user avatar
  • 181
3 votes
2 answers
103 views

How to construct optimal Wiener Filter?

I am trying to construct a Wiener Filter, to filter the ratio of the peak from the cross-correlation function, between a galaxy spectra and a template spectra, with the peak of the auto-correlation ...
trynerror's user avatar
  • 849
0 votes
1 answer
225 views

Plot several FITS files in one graph

At the moment, I get three separate graphs. Ideally I would like to overlay all graphs, so that I only have one plot with multiple FIT files. I have a folder on my desktop with the HARPS-N data, the ...
AlbPet's user avatar
  • 1
1 vote
0 answers
35 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
159 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
3 answers
141 views

Getting (variable) apparent magnitude of Algol

I've heard that in ancient Egypt they had a calendar to determine the lucky and less lucky days, which alternated approximately every 2.8 days. According to researchers, this may have been related to ...
velkyvont's user avatar
0 votes
1 answer
116 views

2D Galaxy Spectrum taken by long-slit-spectrograph

I have the 2D data (shape(1125,2058) taken by a long slit spectrograph, which looks as follows: The y-axis corresponds to the distance from the center, where the center is at the most bright green ...
trynerror's user avatar
  • 849
5 votes
1 answer
254 views

How can I get a list of the closest x stars and their distances from the Gaia ESA Archive using Python?

I've been trying to find this out for a while now, but I'm making zero progress. I really struggle to find good documentation for the query language, and even in the astroquery library I can't find ...
Outis Nemo's user avatar
4 votes
1 answer
133 views

Different results for the same JPL Horizons query

On JPL Horizons website, I'm using the following query to get vector state for Earth: ...
Claudiu's user avatar
  • 73
2 votes
1 answer
550 views

How to slice WCS in a FITS file?

I have three WCS axes in a FITS image. I want to slice the axes and use only the first one. Note that though there are three axes, the WCS is superimposable. So there is no worry about a shift in WCS ...
SlightDecoy's user avatar
2 votes
1 answer
168 views

Python Program for Synodic months

I am trying to make an astronomical program for celestial bodies in our solar system (and beyond!). However I want it to show how many Synodic months since New moon. Example: Since last 2022 there ...
user avatar
0 votes
0 answers
52 views

How do I code the formula for the minimum mass of a stellar fragment from Whitworth & Stamatellos, 2006?

I was researching the formation of brown dwarfs, and I stumbled into the paper "The minimum mass for star formation, and the origin of binary brown dwarfs", and I am attempting to code a ...
Ankit Biswas's user avatar
1 vote
1 answer
97 views

Which catalogue has identified objects from Gaia DR3?

I am trying to match objects from a Gaia DR3 dataset having 1 million rows with simbad. I find it difficult to find object type for all the rows as queries using astroquery becomes insanely slow after ...
VADeR's user avatar
  • 51
4 votes
1 answer
423 views

Determining period of an exoplanet using radial velocity data

I've spent an incredibly large amount of time trying to wrap my head around how the period is computed using just solely the raw data for the radial velocity. I've tried my hand with some nonlinear ...
chuffyduffy's user avatar
6 votes
0 answers
129 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
4 votes
0 answers
82 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
1 answer
94 views

How do I create well a weighted black hole mass function?

I'm running a set of simulations to study the evolution of Super Massive black holes. In principle, I have the black hole masses and other property called merger tree weight in Mpc-3 unit which is ...
Matías Liempi's user avatar
1 vote
0 answers
114 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
1 answer
130 views

python skyfield hipparcos sun mean longitude (L)

I calculate the ra and decl or the stars as below. Can I add the sun's mean longitude L (=M+w) to: ...
sybe's user avatar
  • 63
2 votes
0 answers
41 views

What sort of exploratory procedures should be carried out on astronomical data? [closed]

Upon downloading an astronomical dataset such as SDSS DR12 from VizieR, what kind of exploratory techniques should be performed? I start with the basics, like this tutorial, and how much missing data ...
Jim421616's user avatar
  • 2,570
3 votes
0 answers
81 views

Kolmogorov–Smirnov test p-value [closed]

I carried out a 2 sample Kolmogorov–Smirnov or "KS" test. I got a p-value of 0.11. That means the probability of 2 samples being of the same population is 0.11. Is it correct to say that the ...
SlightDecoy's user avatar
1 vote
0 answers
117 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
2 votes
1 answer
274 views

How to use Astropy to edit a keyword (not value) in batches of FITS file headers to be used in AstroimageJ (AIJ)? (summer undergrad research project)

I would be so grateful if someone could help me. I am stuck for over a week now trying to find some way to use Astropy to write some small code to edit one keyword in batches of FITS file headers so ...
strange_octopi's user avatar
3 votes
1 answer
91 views

Evaluating Potentials using Galpy

I am trying to model galactic disks. From the past research we have discovered that the halo follows the logarithmic potential, the disk follows the Miyamoto-Nagai potential and the bulge follows the ...
CTZenScientist's user avatar