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
1 vote
0 answers
66 views

How do I estimate uncertainties in mass function?

I constructed a galaxy mass function in Python reading the stellar mass of galaxy in a numpy array, and the weights of each galaxy in another numpy array. Now, I want to propagate errors assuming a ...
Matías Liempi's user avatar
5 votes
0 answers
72 views
+100

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
  • 151
2 votes
1 answer
95 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
126 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
22 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
76 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
69 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
159 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
25 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
47 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
28 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
39 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
23 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
63 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
83 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
122 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
37 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
155 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
88 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
  • 839
0 votes
1 answer
143 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
30 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
113 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
123 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
98 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
  • 839
3 votes
1 answer
165 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
123 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
430 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
155 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
47 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
88 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
307 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
125 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
78 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
91 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
91 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
119 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
40 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,498
3 votes
0 answers
74 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
98 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
  • 839
2 votes
1 answer
236 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
78 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
1 vote
1 answer
249 views

The preferred way of binning (classifying) data for galaxy snapshots in Python

Let's say I have a galaxy snapshot that I load with some package (pynbody etc) and I store my spatial coordinates of stars in the galaxy in x, y, z arrays and also velocity in array vz. Now I want to ...
Jerome's user avatar
  • 155
2 votes
0 answers
711 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
1 vote
0 answers
57 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
2 votes
1 answer
101 views

How to fit LOSVD of a galaxy with gauss hermite parametrization

I have recovered the following LOSVD from an elliptical galaxy, that I now want to fit a gauss-hermite-parametrization to and derive the kinematical parameters rotational velocity, velocity dispersion ...
trynerror's user avatar
  • 839
1 vote
0 answers
400 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
4 votes
1 answer
484 views

Using Einsteinpy to plot the precession of a star orbiting a black hole?

I am currently trying to code the precession of a star orbiting around a black hole, the issue I am having though is that I have no clue what the values are and what they mean in the code, if anyone ...
Taffy's user avatar
  • 41
1 vote
1 answer
158 views

Determining when the sun shines on different sides of a building using astropy

I recently installed motorized solar blinds on various windows in our house to reduce solar gain during the summer months. I have integrated the blinds with my hubitat home automation system, and am ...
cayblood's user avatar
  • 115
1 vote
1 answer
324 views

Convert from spectral type to RGB color?

I'm writing a night sky simulator and I want to render stars using the correct color. Is there a formula that converts a two-character code (as seen in the Yale Star Catalog) to a RGB value?
prideout's user avatar
  • 203
4 votes
1 answer
70 views

How to build an adjacency matrix of stars connectivity from their physical kpc distances?

I'm probing into the Illustris API, and gathering information from a specific cosmos simulation, for a given redshift value. This is how I request the api: ...
8-Bit Borges's user avatar