# 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.

153 questions
Filter by
Sorted by
Tagged with
115 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 ...
• 155
142 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 ...
• 41
258 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 ...
254 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 ...
250 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.....
• 711
67 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
28 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
43 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 ...
• 101
1 vote
99 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 ...
• 711
1 vote
31 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 ...
330 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 ...
310 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 ...
• 711
1 vote
2k 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 (...
• 711
275 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://...
• 299
836 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 ...
• 5,444
167 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, ...
• 5,444
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 ...
• 313
121 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 ...
• 313
1 vote
583 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 ...
1 vote
128 views

### How should I interpret this result obtained using lomb scargle?

I used lomb scargle for periodic analysis. The time interval used is constant at 500 seconds. #My data (x=time, y=intensity values) is : x= ( 00:28, 00:37, 00:45, 00:53, 01:02, 01:10, 01:19, 01:27, ...
1 vote
249 views

### RA expressed in degrees

Using the Python package Skyfield I thought that I could get the RA expressed in degrees simply by doing ra.degrees, but I get the following message this angle is usually expressed in hours, not ...
540 views

### How to Interpret Lomb Scargle periodogram

lomb scargle periodogram: ...
• 11
218 views

### Using the 'exoplanet' module to fit a radial velocity curve for a binary star system

As part of a project, I am trying to fit a radial velocity curve using the tutorial for the binary star system (EBLM J0608-59) My code is quite similar to the tutorial, but as it is only one body ...
• 21
461 views

### Issues in dimensions and slicing while plotting contours over a FITS Image in Astronomical Plotting Library in python (APLpy)

I have been trying to plot the contours of a FITS image over itself in APLpy. The image was created in AIPS, and has dimensions (1024,1024,1,1), viz., right ascension (RA--SIN), declination (DEC--SIN),...
73 views

### Should I fit a function to this lightcurve?

I am creating a light curve for the duration of a binary system in order to find out the duration of the eclipse. I am unsure as to whether to fit a function to the data (is it appropriate) as by ...
2k views

### "LinAlgError: SVD did not converge in Linear Least Squares" with eleanor.py

I'm doing some tests with eleanor module (i'm a novice). I'm using the example code written on eleanor.py website ...
• 21
2k views

### How to plot celestial equator in galactic coordinates? Why does my plot appear "backwards"? [duplicate]

I'm trying to plot celestial equator in galactic coordinates. Here is my code (based on this answer): ...
1 vote
71 views

### Using lightkurve to identify a planet

I have gotten LightKurve to work and plot a lightcurve to allow for the identification of possible transits. However is there a way I can get it to run and tell me if there is a possible transit in ...
• 11
162 views

### Technique for folding sparse event data in order to detect an underlying periodicity?

@JamesK's answer to When will the next transit of Earth be visible from Mars? Was the last one really on May 11, 1984? lists dates of 18 transits which I've converted to days since 1500-Jan-01 as <...
• 31k
556 views

### Cannot identify mistake in calculating orbital eccentricity vector; magnitude equals one instead of zero (with python code)

I have a gravitational nbody simulation, for which I would like to determine various orbital parameters. For each body, I have 3-D vectors (x,y,z -space) for position, velocity, and acceleration. I am ...
1k views

### How can I calculate the apparent position of stars as seen from a location on Earth at a specific time?

I'd like to be able to generate star maps using Python, similar to what is done at YourSky. I believe this is possible with Astropy and the details provided in this question. I can import stars from ...
• 123
240 views

### How to recognize exoplanet transit

I am using Python package lightkurve for exoplanets searching by the transit method. When I download light curve of some star and apply periodogram, I find frequency and power of periodic components ...
• 313
335 views

### How can I calculate the right ascension of an observer on Earth's surface in the TEME frame with python.skyfield?

I would like to calculate the right ascension of a point on earth as specified above with the Skyfield Python library, and I can not figure out how to do this. I know that calculating the geocentric ...
• 43
4k views

### Why does the Fourier transform of this CMB image have a hole in it?

The BBC's Desert telescope takes aim at ageing our Universe contains the image below of the Cosmic Microwave Background from the Atacama Cosmology Telescope or ACT. It looks like this is plotted with ...
• 31k
1 vote
140 views

### Specutils Gaussian1D fitter and estimators

I am running the "simple example" from specutils to do some line-fitting. The demo code is here: https://specutils.readthedocs.io/en/stable/fitting.html This runs and does what it says. ...
• 31
1 vote
100 views

### trouble installing drizzlepac

I'm trying to install drizzlepac to follow this tutorial on aligning hst images: https://spacetelescope.github.io/notebooks/notebooks/DrizzlePac/align_to_catalogs/align_to_catalogs.html However, I get ...
• 13
1 vote
675 views

### Convert dates to julian day number in astropy?

I'm using astropy and I need to convert dates like this: 2012.06.22_17:56:15_TAI into julian day number. I tried: ...
• 21
1 vote
828 views

### Calculate depth and duration of exoplanet's transit using Python, astropy or lightkurve

I am creating a program for the analysis of exoplanets in Python using Astropy and Lightkurve libraries. I have light curve of specified star and I would like to calculate depth and duration of planet ...
• 313
429 views

### What does "additive fringing from the (multiplicative) twilights" mean?

The question How can I make the fringing pattern visible in my flat (twilight) images for filter i? includes: I have a bunch of twilight flats that have been preprocessed (dark, bias, overscan etc.)...
• 31k
206 views

### How can the IAU 2000A vs IAU 2000B nutation comparison be reproduced?

I am attempting to plot how the IAU 2000A nutation model degrades as its terms are omitted. As a spot-check, I decided to compare it to IAU 2000B, which includes only the 77 most important lunisolar ...
898 views

### Get orbital period of exoplanet from light curve using astropy.timeseries

I am using astropy and I would like to calculate orbital period of an exoplanet by its star's light curve. I follow tutorial in astropy docs and I use data from Kepler in Nasa Exoplanet Archive. ...
• 313
1 vote
287 views

### Wavelength Calibration in Python - Line Identification algorithm

I was asked to develop a data reduction pipeline for a telescope and am facing a problem. I have the standard lamp spectra and need to identify the emission lines in order to find a wavelength ...
293 views

### How do I plot field of view of an earth-based observatory in Galactic Coordinates?

I would like to plot in Galactic Coordinate the sky field-of-view of an earth-based observatory (e.g. MAGIC). Something like this from Liu et 2016. I already know how plot source positions on a 2D ...
• 73
114 views

### Are there any good DSO API's for python out there?

I was wondering if there was good DSO database API out there for python so I could fetch things like a distance away from Earth or radius etc. I tried looking however couldn't find the exact thing I ...
• 21
6k views

### How to create 3D animation of particles position vs time in python?

I am trying to make a 3-D animation of stars' position vs time. I have the information of the stars' x, y and z co-ordinates over time. I was looking at the example of Matplotlib and did understood ...
• 187
105 views

### Galactic Equator zenith transit

I need to find the two times of zenith passage of the Galactic Equator for a given Earth Lat/Lon on any day between 3500 BC and 1500 AD. Since the Galactic Equator is a line and not a point, I try to ...
• 33
71 views

### Detect sources near image edge with python photutils

As my question suggests, I 'm trying to use a python library photutils in order to detect sources from MUSE cube. MUSE (Multi Unit Spectroscopic Explorer) is an ...
1 vote
230 views

### Python controllable amateur astrophotography cameras?

I would like to read further about any successes that amateur astrophotographers (or professionals) have had with USB CCD cameras that are controlled by Python scripts. I'd like to script the setting ...
• 31k
1 vote