# Tag Info

## Hot answers tagged python

52

From the PyEphem Quick Reference Guide: Rising and setting are sensitive to atmospheric refraction at the horizon, and therefore to the observer’s temp and pressure; set the pressure to zero to turn off refraction. It seems likely that, if you're using the default settings, the result returned is including atmospheric refraction, giving the results you ...

22

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. That is not how PyEphem defines sunrise and sunset. It defines sunrise as the time the top of the Sun would nominally first appear above an unobscured horizon (no mountains)...

21

Having now looked at the paper by Aiola et al. (2020), it emerges that for that map, they filtered the data to exclude low frequency multipoles with $|l|<150$, corresponding to about 1 degree. This filtering was done to all the maps in the paper and will be responsible for the dramatic "hole" in your Fourier transform. As for the high frequency ...

19

For that specific E-mode map we have applied a Wiener filter to highlight the high SN modes (those "rings"). I also further apply the following filter: $((1 + (kx/5)^{-4})^{-1}) * ((1 + (k/150)^{-4})^{-1})$. This second filter gives the "hole" and a "thin" vertical line in your 2D PS. The image above is just for PR purposes. In ...

11

No, for several reasons. The expected gravitational wave signature of a core collapse supernova looks nothing like that from a merging black hole binary system, so no sensible comparison can be done with GW150914. The maximum frequency of the gravitational waves from a merger decreases with increasing mass. The expected frequencies from a core collapse are ...

11

In Astropy, u.G represents a Gauss, not the gravitational constant. That's why you get the "A" in one of the error messages; it represents an ampere. To use the gravitational constant in your code, you need to use astropy.constants and replace u.G in your code with constants.G (or just add import astropy.constants as c and use c.G, if you prefer).

9

Wikipedia's article on the Arctic Circle provides the explanation. Firstly, it says: because the sun appears as a disk and not a point, part of the midnight sun may be seen on the night of the northern summer solstice up to about 50 minutes (′) (90 km (56 mi)) south of the Arctic Circle. As the Arctic Circle is currently at roughly 66°34′N, this means a ...

8

Your approach is completely correct, just note three things: Logarithmic distribution First, since the distribution of masses is logarithmic in nature (as is most other things), be sure to bin them logarithmically. Otherwise you will oversample (undersample) the bins at the low-(high-)mass end. Comoving densities Second, to be able to compare mass ...

8

The fringing pattern is caused by thin-film interference within the CCD. The signal received in a pixel will be proportional to the light falling on it, multiplied by a sensitivity, but then some extra signal is added or subtracted which depends on how much of the incoming light is at particular wavelengths that are affected by the interference (i.e. the ...

7

Random points on the surface of a sphere can be generated by allowing the azimuthal angle $\phi$ to take a uniformly distributed random value between 0 and $2\pi$. To convert this to RA in degrees you multiply by $180/\pi$. To convert to hours, minutes and seconds you divide the $\phi$ in degrees by 15, which gives the hours, divide the remainder by 60 which ...

6

This code reads coordinates as equatorial (ra, dec) and transforms them to galactic (l, b): eq = SkyCoord(xarr[:], yarr[:], unit=u.deg) gal = eq.galactic The contents of 'galacticwperiod.csv' are already in galactic coordinates and should not be transformed. Something like this may give better results: gal = SkyCoord(xarr[:], yarr[:], frame='galactic', ...

6

You can do it via the astroquery SDSS module; there is a function called query_sql.

5

Heres more python than you can shake a telescope at. I just used @RobJeffries' algorithm. This is just a python script, the real answer to the question is @RobJeffries' answer and I've just scripted it. The mathematics behind generating statistically uniform distributions is explained very nicely there as well. Python is below the plots. You can see on an X-...

5

Your feeling is right: You shouldn't convolve the spectrum and the filter, you should only multiply so that flux outside the bandpass is suppressed. Subsequently you integrate the resulting function over wavelength, so that flux density (in energy/time/area/wavelength) becomes flux (in energy/time/area). Simply setting the flux to 0 outside $\lambda_1$ and $... 5 While I'm not familiar with the package, a very quick look at the documentation suggests that you want In [90]: c.M_sun.uncertainty instead. I've just checked and this appears to be correct. > python -c "from astropy import constants as c ; print c.M_sun.uncertainty" 5e+25 5 There is no obvious astronomy error, but your use of math.pow is wrong You write constgrav = math.pow(6.67,-11). That means$G = 6.67^{-11}$. You mean constgrav = 6.67e-11 or$G=6.67\times 10^{-11}$. With completely different initial conditions, it is not surprising that the Earth flies off into space. As a suggestion, try not using SI units for this, ... 5 The second light curve you show has no obvious periodic behaviour and I cannot see any sign of a planetary transit. The period-finding algorithm appears to be working correctly. The planet (if it exists) is supposed to be one of the smallest planetary candidates found by Kepler and will have a barely detectable transit (depth of order 0.004%). The small ... 5 The visual appearance of fringing is caused by the CCD (thickness) being comparable to the size of the wavelength (thin-film interference). An everyday example (same physics except with more colors) is an oilslick one sees in a puddle. The wavelengths of visible light are similar in size to the layer of oil on top of the water. The slight variation in ... 5 You are doing many things wrong. You are computing the eccentricity of one body with respect to the center of mass. You need to compute the eccentricity of one body with respect to the other. You are using reduced mass in np.cross(Ve, Le, axis=0) / mred - Xe / np.sqrt(np.sum(np.square(Xe), axis=0)) This is wrong for multiple reasons. First off, look at the ... 5 I was wondering why the absorbtion lines of the template are broader then those of the galaxy, since it actually should be the other way arround. You are correct that it should be the other way around. The reason the plot looks confusing is that you are not actually plotting the galaxy spectrum in the top panel; you are plotting some combination of noise ... 4 I want to say that's a Mollweide projection. I know that they're pretty common in astronomy; many images of the CMB use them. I was actually working with one recently. Given latitude$\varphi$and longitude$\lambda$, the$x$and$y$coordinates of an object are $$x=R\frac{2\sqrt{2}}{\pi}(\lambda-\lambda_0)\cos\theta,\quad y=R\sqrt{2}\sin\theta$$ for ... 4 I personally use Astropy, specifically astropy.io.fits, although I'm not a seasoned user of FITS files and I don't really know their layout. As an example snippet of code, I often load data from FITS files using from astropy.io import fits data = fits.open('data_file.fits')[0].data You'll find more information in the documentation on the FITS module. 4 I haven't done much astronomical image processing before, but as this question is unanswered I'll give it a shot - hopefully to some avail. If the problem is more specific, a code sample/image sample would probably be useful for further diagnosis, but otherwise this example may help. It discusses the process of writing a 3-channel image to separate FITS ... 4 The La2010 long-term ephemeris Laskar et al. (2011), which is based on the INPOP numerical ephemeris integrated for 1 Myr, is valid for 250 million years before the present day and a unknown distance into the future. The authors note that due to chaotic motion in the Solar System, the accuracy degrades significantly beyond -50 Myr and likely a similar time ... 4 The astropy.coordinates packages has the SkyCoord.from_name() convenience method (docs link) uses the Sesame name resolver at CDS to search Simbad, the NASA/IPAC Extragalactic Database NED and VizieR database of astronomical catalogs. Since these encompass basically every known object in astronomy, there is no "list"; simply put something in and it'... 3 From eq. 10 in Hogg's classic paper, assuming that the peculiar velocity$v_\mathrm{pec} \ll c$: $$v_\mathrm{pec} = c \frac{z_\mathrm{obs} - z_\mathrm{cos}}{1 + z_\mathrm{cos}},$$ where$z_\mathrm{obs}$is the observed redshift, and$z_\mathrm{cos}$is the redshift from cosmological expansion only. Let me invert that and wrap it up in Python for ya: def ... 3 BTW if anyone wants a quick and fast query to solution do the following: Go to https://skyserver.sdss.org/dr12/en/tools/search/sql.aspx. Paste a query like this: SELECT s.specobjid, s.ra, s.dec, s.z FROM SpecObj as s WHERE s.z > 0 AND s.z < .18 AND s.ra > 0 AND s.ra < 50 AND s.dec > 0 AND s.dec < 30 Then after downloading a csv file ... 3 SDSS DR12 Catalog Data looks like a good starting point, apparently pretty open to those willing and able to figure it out. Their SciServer Compute site hosts Jupyter notebooks to query CasJobs in SQL. The Large Scale Structure galaxy catalog under BOSS value added catalogs may also be relevant. 3 If you were working with a rectangular coordinate system as shown in the figure below (that also had no bounds), then it is correct that the right ascension would be$RA=RA_p\pm d$(points 1 and 3) and the declination would be$Dec=Dec_p \pm d\$ (points 2 and 4) where d is the radius of the circle. The sky is spherical, so the lines of RA are not a constant ...

Only top voted, non community-wiki answers of a minimum length are eligible