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
29 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 ...
2 votes
1 answer
56 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 ...
1 vote
0 answers
16 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 ...
0 votes
1 answer
55 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: ...
  • 33
1 vote
0 answers
34 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 ...
  • 2,194
2 votes
0 answers
49 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 ...
1 vote
0 answers
22 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 ...
  • 389
2 votes
1 answer
71 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 ...
0 votes
0 answers
17 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/...
  • 389
3 votes
1 answer
47 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 ...
1 vote
1 answer
61 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 ...
  • 145
1 vote
0 answers
157 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 ...
  • 111
0 votes
0 answers
41 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 ...
  • 1
2 votes
1 answer
43 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 ...
  • 389
1 vote
0 answers
117 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 ...
  • 11
4 votes
1 answer
393 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 ...
  • 41
1 vote
1 answer
87 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 ...
  • 115
0 votes
1 answer
90 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?
  • 173
4 votes
1 answer
61 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: ...
2 votes
1 answer
107 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: ...
's user avatar
2 votes
0 answers
33 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 ...
  • 389
2 votes
0 answers
51 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 ...
2 votes
1 answer
130 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.
2 votes
0 answers
121 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 ...
  • 31
3 votes
0 answers
86 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 ...
  • 145
1 vote
0 answers
67 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 ...
  • 145
3 votes
2 answers
362 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 ...
  • 78
0 votes
0 answers
15 views

Power Spectral Response Method

Can any one suggest me how we can apply the power spectral response method to calculate the best fit spectral index in python ? And plot the probability vs spectral index ?? Or any reference to ...
  • 21
1 vote
0 answers
69 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. ...
  • 21
2 votes
1 answer
151 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 ...
  • 145
3 votes
1 answer
80 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): ...
1 vote
1 answer
79 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 ...
1 vote
0 answers
286 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 ...
  • 293
1 vote
1 answer
48 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 ...
1 vote
1 answer
266 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 ...
0 votes
0 answers
65 views

Why can I not get pymultinest running and what's the best way to generate CMD with coding?

I recently downloaded the isochrones environment for Python, and I installed pymultinest for sure, but when I import it in Jupyter Notebook it always says 'ERROR:root:Internal Python error in the ...
5 votes
1 answer
664 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 ...
  • 533
2 votes
0 answers
166 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 ...
2 votes
1 answer
298 views

Query Gaia by star name

I am attempting to query Gaia programmatically in python to get certain properties for specific stars. I can write a query which obtains some properties, but only for all stars, not a set of stars or ...
1 vote
0 answers
33 views

How to calculate S/N in galaxy absorption spectra?

I want to calculate the S/N of an galaxy absorption spectrum. I therefore chose a part of the spectrum which contains very little to none absorption features and should be only made up of noise and ...
  • 389
3 votes
0 answers
27 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 ...
  • 389
1 vote
1 answer
291 views

What objects can I search for using astropy.coordinates?

The spectacular Python package astropy allows the user to search for a celestial object using astropy.coordinates, querying ...
  • 2,194
3 votes
0 answers
126 views

How to remove redshift from galaxy spectra in Python?

Hello I extracted a spectrum from the central region of the 2D spectrum of the major axis from NGC 4697 (I just took a central row in the 2D data set, see this question for more information: How to ...
  • 389
0 votes
0 answers
70 views

Are there python packages to calculate mean line of sight velocity, linewidth and other distributions from galaxy simulation snapshots?

Does anyone know of any packages/functions in packages that can give mean line of sight velocities (losv) from a simulation snapshot (from the spatial and velocity coordinates or directly from the ...
  • 145
2 votes
2 answers
99 views

During aperture photometry when simulating an undetected star, why must an upper limit and standard deviation need to be calculated?

I am trying to learn aperture photometry using python I noticed the following logic in the image below, where an upper limit was determined by simulating an undetected star and the standard deviation ...
  • 31
2 votes
1 answer
166 views

Calculate the habitable zone of a star based on NASA Exoplanet Archive

I am completely new to this! I am trying to find if an exoplanet in the Exoplanet Archive is the habitable zone of its host star. My intention is to create a new boolean column in a Pandas Dataframe ...
-11 votes
2 answers
233 views

Is a Hertz ratio to 65M ☉ proof that Betelgeuse had a core collapse in 1491 from a gravitational wave on January 14, 2020? [closed]

By analysis of gravity waves GW150914 to S200114f when compared to a ratio from the Black Hole merger of 65 M ☉ at 260 Hz with Betelgeuse frequency of 64.698303 Hz the gravitational release on January ...
4 votes
1 answer
182 views

How to extract galaxy spectra for different radii in Python for spectra taken by long slit spectrograph?

I am trying to extract the kinematics from the elliptical galaxy NGC 4697 using the Fourier Correlation Quotient (FCQ) algorithm described by Bender (http://adsabs.harvard.edu/full/1990A%26A...229.....
  • 389
2 votes
0 answers
55 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 ...
  • 153
2 votes
0 answers
27 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 ...
  • 153