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
1 answer
27 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 ...
user avatar
  • 317
1 vote
0 answers
64 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 ...
user avatar
  • 11
4 votes
1 answer
363 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 ...
user avatar
  • 41
1 vote
1 answer
66 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 ...
user avatar
  • 115
0 votes
1 answer
65 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?
user avatar
  • 133
4 votes
1 answer
60 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: ...
user avatar
2 votes
1 answer
63 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
2 votes
0 answers
26 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 ...
user avatar
  • 317
2 votes
0 answers
49 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 ...
user avatar
2 votes
1 answer
86 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.
user avatar
2 votes
0 answers
90 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 ...
user avatar
  • 31
2 votes
0 answers
59 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 ...
user avatar
  • 119
1 vote
0 answers
54 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 ...
user avatar
  • 119
3 votes
2 answers
176 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 ...
user avatar
  • 68
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 ...
user avatar
  • 21
1 vote
0 answers
47 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. ...
user avatar
  • 21
2 votes
1 answer
134 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 ...
user avatar
  • 119
3 votes
1 answer
73 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): ...
user avatar
1 vote
1 answer
54 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 ...
user avatar
1 vote
0 answers
120 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 ...
user avatar
  • 293
1 vote
1 answer
38 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 ...
user avatar
1 vote
1 answer
175 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 ...
user avatar
0 votes
0 answers
47 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 ...
user avatar
5 votes
1 answer
649 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 ...
user avatar
  • 525
2 votes
0 answers
128 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 ...
user avatar
2 votes
1 answer
139 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 ...
user avatar
1 vote
0 answers
27 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 ...
user avatar
  • 317
3 votes
0 answers
24 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 ...
user avatar
  • 317
1 vote
1 answer
245 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 ...
user avatar
  • 1,931
3 votes
0 answers
84 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 ...
user avatar
  • 317
0 votes
0 answers
47 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 ...
user avatar
  • 119
2 votes
2 answers
66 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 ...
user avatar
  • 31
2 votes
1 answer
117 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 ...
user avatar
-11 votes
2 answers
206 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 ...
user avatar
4 votes
1 answer
146 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.....
user avatar
  • 317
2 votes
0 answers
35 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 ...
user avatar
  • 153
2 votes
0 answers
21 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 ...
user avatar
  • 153
0 votes
0 answers
33 views

What is the formula to input date, time and longitude. Where I can get latitude of the civil twilight back?

I am making a watch app, where I need to know where there is currently sun, and where it's not. I need to have some sort of formula/function to insert: date, time and longitude, and get back the ...
user avatar
  • 101
1 vote
1 answer
66 views

Derive LOSVD from galaxy spectrum, using fourier method

I am trying to implement a programm, that derives the kinematics (specifically the kinematic parameters: mean rotation velocity, velocity, dispersion, hermite coefficients h3 and h4) from an ...
user avatar
  • 317
0 votes
0 answers
38 views

How to create synthetic galaxy spectrum by broadening stellar spectra with a gaussian

I am trying to create a synthetic galaxy spectrum, by convolving a gaussian-velocity-distribution f(v) with my stellar spectra S. I have already logarithmically rebinned the spectrum and removed the ...
user avatar
  • 317
1 vote
0 answers
24 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 ...
user avatar
-2 votes
2 answers
170 views

Calculate exact date and time from position of the sun - 88° degrees

I am currently working on an astrology project and need to figure out the exact date and time based on the sun's position of birth - 88° degree (approx. 89 days) before the moment of birth. I am using ...
user avatar
2 votes
0 answers
156 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 ...
user avatar
  • 317
1 vote
1 answer
798 views

working with stellar spectra in fits format in python

Hey I am new to working with astronomical data in Python. I wanted to start working with stellar spectra and I am having trouble with the data. To get a first look I just wanted to plot a spectra (...
user avatar
  • 317
4 votes
1 answer
138 views

Accessing SDSS server SQL server via python

Is there a way to directly access any of the Sloan Digital Sky Survey servers via SQL via Python? Currently I have been able to run SQL queries from the website they provide (for example https://...
user avatar
  • 299
3 votes
2 answers
523 views

Open source code for the maths behind a heliostat?

Theoretically, using a Raspberry Pi, (at least) one mirror, and two motors, one should be able to build a heliostat, i.e. a device which redirects sunlight to a fixed spot, like a scrub in the shadow ...
user avatar
  • 5,284
3 votes
1 answer
121 views

Open source library to calculate image from signals of a distributed set of radio dishes?

The National Radio Astronomy Observatory's Q&A "How To Make Images With a Radio Telescope" says The most straightforward way to make a radio image with your satellite antenna system, ...
user avatar
  • 5,284
21 votes
3 answers
5k views

Why won't the Sun set for days at N66.2 which is below the arctic circle?

Correct me if I am wrong, but if we count sunsets by the center of the Sun apparently crossing the horizon then the Sun is supposed to set every day at latitudes under the arctic circle. (Yes if you ...
user avatar
  • 313
3 votes
1 answer
88 views

Lightkurve nan values after bin light curve

I am using lightkurve 2.0.2 library with Python 3.8.5 and astropy 4.2 for processing exoplanet transits. However when I want to bin light curve to fixed number of points, all values in ...
user avatar
  • 293
1 vote
0 answers
309 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 ...
user avatar