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
3 votes
2 answers
74 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
  • 799
0 votes
1 answer
53 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
22 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
22 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
96 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
59 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
  • 799
2 votes
1 answer
64 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
101 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
  • 43
2 votes
1 answer
146 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
133 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
34 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
62 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
  • 31
4 votes
1 answer
197 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
97 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
3 votes
0 answers
64 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
82 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
53 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
98 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
38 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,394
3 votes
0 answers
62 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
75 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
  • 799
2 votes
1 answer
146 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
0 votes
0 answers
51 views

Kinematical galaxy spectral analysis using ppxf?

I am trying to implement an Fourier based algorithm to derive the kinematics of an elliptical galaxy. To check/reproduce my results I wanted to use the open source ppxf tool (https://pypi.org/project/...
trynerror's user avatar
  • 799
3 votes
1 answer
61 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
162 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
1 vote
0 answers
441 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
  • 111
1 vote
0 answers
52 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
71 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
  • 799
1 vote
0 answers
281 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
445 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
127 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
183 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
65 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
3 votes
1 answer
198 views

Can you get motion data using astropy.coordinates.get_body()?

I am trying to use get_body() to get position and motion data for solar system objects. I’ve tried the following: ...
user avatar
3 votes
0 answers
57 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
  • 799
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
1 answer
392 views

How to calculate distance to other galaxies using type 1a supernova?

This is for a project in astronomy with extensive data analysis. How should I calculate the distance of galaxies using AGN and supernova Ia? I am using the data from dr17 of SDSS.
Nabiha Nadeem's user avatar
2 votes
0 answers
223 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
3 votes
0 answers
131 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
1 vote
0 answers
101 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
3 votes
2 answers
778 views

How to compute a Flux through a filter using SYNPHOT in Python

I am in the process of building an exposure time calculator to help nail down the exposure times I need for different targets in my observatory. In amateur astronomy imaging, we use a filter called ...
Adrian's user avatar
  • 98
1 vote
0 answers
106 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
2 votes
1 answer
182 views

How to interpret skewness and kurtosis plots of galaxy snapshots?

What I did:- I am analysing some simulation snapshots of the Milky Way and it is modelled as a dark matter halo – bulge – disc system. I produced some skewness (using ...
Jerome's user avatar
  • 155
3 votes
1 answer
123 views

Skyfield missing some rise and set dates

To compute the Andromeda Galaxy Risings and Settings I essentially use this code (in a more colplex code, but this serves the purpose): ...
Luca Berti's user avatar
1 vote
1 answer
148 views

How to compute rising / setting times for stars and deep sky objects with Skyfield?

I'm trying to compute rising and settings times for various objects with the Skyfield library. While the task is quite easy and well documented for planets (using the ...
Luca Berti's user avatar
1 vote
0 answers
492 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
1 answer
93 views

How to handle empty tables returned by astroquery Nist.query() in Python?

I'm writing a code to extract wavelengths of certain species of atoms/ions in a given wavelength range using the Nist.query() command of the Python package ...
ShaunakP's user avatar
1 vote
1 answer
591 views

How to access the raw time-series dataset of GOES X-Ray Flux?

I would like to access the time-series dataset of X-Ray Flux obtained by GOES. I expect that the flux units to be Watts / square-meter; this is because of the figure below (obtained from this Nature ...
mikeysflix's user avatar
5 votes
1 answer
723 views

Astropy units issue

hope you're all doing well. I'm not very familiarized with AstroPy and I'm having a problem computing the conversion between angular momentum units. If I define the ...
nuwe's user avatar
  • 605
2 votes
0 answers
277 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