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
19
votes
2answers
3k 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 ...
1
vote
0answers
7 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. ...
0
votes
1answer
31 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 ...
1
vote
2answers
58 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: ...
1
vote
1answer
51 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 ...
7
votes
2answers
330 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.)...
4
votes
1answer
97 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 ...
4
votes
2answers
156 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. ...
1
vote
0answers
31 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 ...
2
votes
0answers
39 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 ...
2
votes
1answer
49 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 ...
0
votes
2answers
126 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 ...
0
votes
0answers
18 views

How to select galaxy emitters from color-color diagram? (Those candidates which are above a line in a plot)

I am trying to select the OII emitters from the colour-colour diagram of galaxies data. I don't know how to select those candidates which are above the line. Here is my colour-colour diagram. . What I ...
3
votes
1answer
64 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 ...
2
votes
0answers
22 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
1answer
68 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 ...
1
vote
0answers
47 views

Python interface for DMK 23U274 USB camera for astrophotography

I have access to a monochrome USB camera (DMK 23U274, The Imaging Source) and I'd like to record focal plane images from a small telescope with a python script that would control it by setting ...
2
votes
1answer
61 views

Neutrino Modelling in Friedmann Equation

so I'm trying to model neutrinos in the Friedmann Equation. I've covered the case of the Benchmark Model where we have matter, radiation, curvature, and the cosmological constant, Lambda. I know my ...
-1
votes
1answer
65 views

Cannot plot Kepler FITS files with topcat in Windows

This is a continuation of my earlier question here. I was able to find Kepler data. Now I wanted to plot the data using Topcat. But when I tried to plot the data, I received error. Below is the error ...
2
votes
0answers
42 views

PHOEBE 2.2 Documentation, components and semi-major axis definitions

I'm looking at PHOEBE 2.2 Documentation, specifically at a tutorial about constraints What are Constraints? Constraints live in their own context of the Bundle, and many are created by default - ...
1
vote
1answer
78 views

How to compute Ascension / Descension cycle of the Moon

I am struggling to find out an information about how to determine ascending/descending cycle of the Moon. I can find from this source and a bunch of others, that Moon begins to descend when reaches ...
1
vote
0answers
51 views

How are small objects automatically identified and their locations determined in digital images?

I have a large quantity of old digital images of low energy electron diffraction (LEED) patterns that I must process to identify and locate small, sometimes elongated gaussian-like blobs of a few ...
3
votes
1answer
269 views

Plotting Astronomical Data Using Python

I have been trying to create a graph which shows the distances between the stars and the earth, yet I could not obtain the desired graph as seen below (click to zoom in): My graph: As @uhoh ...
2
votes
2answers
137 views

Finding Quintuple Planetary Alignments with SkyField

I am working on a python script that will use the SkyField and SciPy libraries to find quintuple planetary conjunctions and their corresponding constellation location. Specifically I am looking for ...
1
vote
1answer
87 views

Could someone please explain to me how I can extract velocity component values from Stellarium, for a given planet?

For a project that I am currently working on, I would like to know how one could extract velocity component values ($v_x$, $v_y$ and $v_z$) for a planet from the Stellarium software. The current ...
3
votes
1answer
98 views

Propagate Earth trajectory for 1 Myr

What is the most accurate way of propagation of Earth trajectory relatively to the Sun? I need to calculate the Earth-Sun distance. Is there any library on Python? I've used before JPL Horizons, ...
1
vote
1answer
89 views

SPICE Alt Az example

Original question below, but my question is now about how can I supply lat/lon coordinates for other locations other than the one in the example below? It is possible to use NASA's SPICE toolkit to ...
1
vote
0answers
88 views

How to do logarithmic wavelength binning (in Python) in order to find redshift?

In Tonry and Davis (1979)(http://adsabs.harvard.edu/abs/1979AJ.....84.1511T), they formulated a cross-correlation method for extracting velocity redshifts. They bin the linear spectra into logarithmic ...
2
votes
0answers
80 views

Covariance matrix not calculated when fitting gaussians?

So I am using Astropy's basic models.Gaussian1D model and a fitter = fitting.LevMarLSQfitter() to fit 3 Gaussian pulses with some added random noise. The fit is good, but when I type fitter.fit_info, ...
6
votes
3answers
2k views

How do I plot galactic coordinates using matplotlib and astropy in python?

I want to make a projection of millisecond pulsars on the galactic plane, much like this one from Sala et al. 2004: I have tried several methods, and have not gotten anywhere. This is my current ...
1
vote
1answer
98 views

Plotting Galactic Longitude from 180 to -180

I made a scatter plot in Python that looks like this: However, I want galactic longitude, l, to be plotted from 180 to -180 like these graphs from Iorio and Belokurov (2019): Here is the ...
1
vote
1answer
326 views

Converting an RGB image to fits (astropy)

I am trying to save a NumPy RGB array (a 3d array with dimension 512x512x3), to a .fits file using astropy.io. Saving this array to a .png file works fine, but when ...
0
votes
1answer
54 views

Plot SuperWasp Lightcurves

I am trying to plot superwasp lightcurves in python from the fits files, using TMID and FLUX2, getting this: There is a way to transform the information so I can plot the lightcurves with the kepler ...
1
vote
0answers
98 views

Three Body Problem

I tried to solve the three body problem numerically. While after 1000 time steps the system looks stable (See Fig.1) it is completely unstable after 10000 time steps (See Fig.2). Is that an intrinsic ...
1
vote
0answers
159 views

To show perihelion precession motion of Mercury in Python with matplotlib

I'm trying to make it more general code so I can trace even a parabola or hyperbola for $e=1, E=0$ and $e>1, E>0$ respectively. And after achieving that general code I want to make the same code ...
2
votes
0answers
48 views

How would I code to find the seeing of a binary star system in python?

I have fit images of binary systems and want a program that will help determine which ones are highest quality, the seeing. The simplest way is apparently to equate it to the FWHM of the Gaussian of ...
1
vote
0answers
27 views

How can I get the fluxes of fetch_imaging_sample? - astroML

I'm working with astroML in Python and I need to get the fluxes from the magnitudes in r band of fetch_imaging_sample(). ...
0
votes
0answers
107 views

Smoothing an SED with binning

I have an (observed) SED of a galaxy, and am attempting to match model SEDs to it. To do this I need to be able to see its shape better, which would involve some sort of smoothing of the spectrum. I ...
2
votes
0answers
172 views

How to “slice” a fits table in astropy?

I have imported my fits table, hdul0, into python. I'm using astropy.table. I opened it with hdul0 = fits.open('filename'). hdul0data = Table(hdul0[1].data) I ...
2
votes
0answers
519 views

Astronomy/Astrophysics Project With C++/C/Python [closed]

I am a Computer Science Engineering student, in the 1st year of college. I'm insanely interested in making a project regarding astronomy/astrophysics but I don't know where to begin from. I know C, C++...
2
votes
2answers
154 views

How to convert celestial Coordinates with a radius, to max and min celestial coordinates?

I am writing a piece of python code to convert right ascension and declination with a given radius to minimum and maximum right ascension and declination. I firstly can't understand why the min and ...
1
vote
2answers
359 views

Earth Orbit Simulator [closed]

I'm trying to simulate Earth's orbit using 2nd Newton's Law and cartesian coordinates. The program seems ok, but when plotting graph, it's a parabola. I know the shape of orbit changes according ...
1
vote
0answers
81 views

Plotting GAIA barycentric radial velocity data with python

Does anybody know of a good tutorial on how to use python and astropy to generate plots of GAIA, RAVE or any other database of barycentric (heliocentric) radial velocity data of stars in our galaxy? ...
2
votes
1answer
252 views

Calculating right ascension for two planets and their separation using python

I am experimenting with the Python library PyEphem for astronomy, and I am trying to recreate/understand some of the basic calculations there. There is a function called separation that, given two ...
2
votes
2answers
1k views

Fitting PSF to an image to get total flux (Python)

I have an image of a single unsaturated source (asteroid) that I'd like to fit guesses for various model PSFs to, so that I can then compare the total flux in each case. I've only recently begun ...
1
vote
0answers
110 views

Comoving distance between two points [(RA1, Dec1, z1) and (RA2, Dec2, z2)]

I have Redshift (z), RA and Dec positions for two points in a galaxy catalogue (say P1 = [<...
1
vote
1answer
853 views

How to construct a sky map

First of all, I have very basic knowledge of astronomy so sorry if I make some mistakes in my terminology. I'd like to plot the Southern Cross. I can find the name of its 5 stars. Also, I have some ...
1
vote
0answers
62 views

Efficiently calculating power spectra from galaxy catalogs

I am dealing with a problem which requires calculating either the correlation function or the power spectrum. At times, the 2-point-correlator seems the better route, at others, the PS. Right now I am ...
2
votes
2answers
747 views

Python: Find brightest pixel in fits-file and ignore brighter artefacts

I have 4000 fits-files images from SPITZER, each containing the same star over a time period. Each image is a photmetry cube of 32 pixel * 32 pixel * 64 consequent time frames. I need to look through ...
5
votes
1answer
438 views

Generating random galaxy catalogs for correlation functions

The galaxy correlation function, when computed directly from a galaxy catalog, relies on computing a randomly generated counterpart catalog. When dealing with a simulated galaxy mock-catalog, where ...