sczesla / pyastronomy Goto Github PK
View Code? Open in Web Editor NEWA collection of astronomy-related routines in Python
A collection of astronomy-related routines in Python
The main issue is
pypa/pip#25
but it is a fairly common issue.
In a new environment
pip install numpy pyastronomy
Collecting numpy
Downloading numpy-1.12.1-cp35-cp35m-manylinux1_x86_64.whl (16.8MB)
100% |████████████████████████████████| 16.8MB 1.8MB/s
Collecting pyastronomy
Downloading PyAstronomy-0.10.1.tar.gz (617kB)
100% |████████████████████████████████| 624kB 2.2MB/s
Complete output from command python setup.py egg_info:
Please install 'numpy' first.
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/jneal/pip-build-r24zffou/pyastronomy/setup.py", line 153, in <module>
class WithExtCommand(Command):
NameError: name 'Command' is not defined
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/jneal/pip-build-r24zffou/pyastronomy/
Basically scipy/scipy#453 contains the PR of how they resolved this issue for scipy which I quote.
It was failing because of the pre installation request from pip to ./setup.py egg_info (which is perfectly valid request and shouldn't fail), before numpy actually was installed.
Fix is straightforward - not to use numpy for commands that are not connected with build and install.
The main reason this affects me is I want to include pyastronomy into a requirements.txt file along with numpy. pip
downloads and setups all before starting to install.
Hi,
I notice that there is only a good selection of columns for the exoplanet.eu.
Is it difficult to add some extra important columns that are currently missing?
Right now I would like to have the "Radius meas. Method". With this column I can check if a planet detected by Radial Velocity is also transiting the star.
Cheers
Hi Stefan,
This might just be a problem for now, but this where the VO table for pyasl.ExoplanetEU2
download the data from is currently down.
I will try contact the their team to check.
E.g.
VELOCITY = 1e6
nflux1, wlprime1 = pyasl.dopplerShift(wvl, flux, VELOCITY, edgeHandling="firstlast")
File "/usr/local/lib/python2.7/dist-packages/PyAstronomy/pyasl/asl/dopplerShift.py", line 96, in dopplerShift
nflux[firsts] = firstval
UnboundLocalError: local variable 'firstval' referenced before assignment
If there are velocity boundary value restrictions, they should be tested for. Agree?
This function applies the generalized ESD test to the distances between adjacent data points, which are then requires to be distributed approximately normally.
Does that mean pointDistGESD is relaxes the requirement that data needs to be normally distributed? and it can be applied on a non-normal distribution? If yes, why?
PyAstronomy currently overrides the chosen matplotlib backend setting on import
PyAstronomy/src/pyaGui/pyaPicker.py
Line 2 in f1d34a3
This causes problems when an application attempts to set the matplotlib backend after a PyAstronomy import.
This call to matplotlib.use() has no effect because the backend has already
been chosen; matplotlib.use() must be called *before* pylab, matplotlib.pyplot,
or matplotlib.backends is imported for the first time.
The backend was *originally* set to 'TkAgg' by the following code:
File "asad_main.py", line 6, in <module>
import asad.args as args
File "/mnt/c/Users/Sami-Laptop/Programming/ASAD_default/asad/args.py", line 9, in <module>
import asad.pyasad as pyasad
File "/mnt/c/Users/Sami-Laptop/Programming/ASAD_default/asad/pyasad.py", line 21, in <module>
from radial_velocity import radial_velocity
File "/mnt/c/Users/Sami-Laptop/Programming/ASAD_default/asad/radial_velocity.py", line 3, in <module>
from PyAstronomy import pyasl
File "/home/sami/.cache/pypoetry/virtualenvs/asad-lTa7gUMb-py2.7/lib/python2.7/site-packages/PyAstronomy/pyasl/__init__.py", line 11, in <module>
from PyAstronomy.pyasl.asl import *
File "/home/sami/.cache/pypoetry/virtualenvs/asad-lTa7gUMb-py2.7/lib/python2.7/site-packages/PyAstronomy/pyasl/asl/__init__.py", line 25, in <module>
_moduleImportStatus[(__name__, m)] = pyaC.pyaimportallfrom(m, "PyAstronomy.pyasl.asl", globals())
File "/home/sami/.cache/pypoetry/virtualenvs/asad-lTa7gUMb-py2.7/lib/python2.7/site-packages/PyAstronomy/pyaC/importCheck.py", line 34, in pyaimportallfrom
n = importlib.import_module("." + mn, pak)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/sami/.cache/pypoetry/virtualenvs/asad-lTa7gUMb-py2.7/lib/python2.7/site-packages/PyAstronomy/pyasl/asl/broad.py", line 4, in <module>
from PyAstronomy import funcFit as fuf
File "/home/sami/.cache/pypoetry/virtualenvs/asad-lTa7gUMb-py2.7/lib/python2.7/site-packages/PyAstronomy/funcFit/__init__.py", line 13, in <module>
"matplotlib.pylab", "pyfits", "emcee", "progressbar"])
File "/home/sami/.cache/pypoetry/virtualenvs/asad-lTa7gUMb-py2.7/lib/python2.7/site-packages/PyAstronomy/pyaC/importCheck.py", line 88, in __init__
__import__(module)
File "/home/sami/.cache/pypoetry/virtualenvs/asad-lTa7gUMb-py2.7/lib/python2.7/site-packages/matplotlib/pylab.py", line 252, in <module>
from matplotlib import cbook, mlab, pyplot as plt
File "/home/sami/.cache/pypoetry/virtualenvs/asad-lTa7gUMb-py2.7/lib/python2.7/site-packages/matplotlib/pyplot.py", line 71, in <module>
from matplotlib.backends import pylab_setup
File "/home/sami/.cache/pypoetry/virtualenvs/asad-lTa7gUMb-py2.7/lib/python2.7/site-packages/matplotlib/backends/__init__.py", line 17, in <module>
line for line in traceback.format_stack()
It would be helpful if this code was moved to an initialization function so a user can control the switching of the backend.
Thanks
The atomic symbols of atom 112~118 are different from Wikipedia and the PubChem: https://pubchem.ncbi.nlm.nih.gov/periodic-table/
Hi,
I am getting this error:
Not sure if you can fix it on your side, or if we need to do something in the sweet-cat site.
Python 3.8.2 (default, Jul 16 2020, 14:00:26)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.13.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: from PyAstronomy import pyasl
In [2]: scs = pyasl.SWEETCat()
Summary of error output:
A PyA error occurred:
---------------------
Type of error: PyA Network Error
What happened?
Could not download SWEET-Cat data. The following error was raised: <urlopen error [SSL: UNSUPPORTED_PROTOCOL] unsupported protocol (_ssl.c:1108)>
I have a question regarding the code in PyAstronomy/src/pyasl/asl/broad.py
Function broadGaussFast(x, y, sigma, edgeHandling=None, maxsig=None) has the following:
e = gf.evaluate(nx)
# This step ensured that the
e /= np.sum(e)
My question is, why are we dividing by np.sum(e)?
Hello,
I think the dopplrShift or the crosscorrRV functionality of pyAsl is bugged by a factor of 2.
I used both to generate a Dopplershifted copy and without implementing any Noise the CCF maximizes at a RV of almost always the correct RV multiplied by the factor 2.
import pandas as pd
import pylab as plt
from PyAstronomy import pyasl
# Load the spectrum
headers = ['X', 'Y']
df = pd.read_csv('Proxima_Phoenix_HR_3000_5.0_1.042_2_5.5.dat', sep= " ", names=headers)
X, Y = np.asarray(df["X"]* 1e-4), np.asarray(df["Y"] * (df["X"]* 1e-4) * 1e8 ) # in cgs units
plt.figure(figsize=(12,6))
for v in range(-50, +50, 20):
Y_Doppler, X_Doppler = pyasl.dopplerShift(X,Y,v)
rv, cc = pyasl.crosscorrRV(X_Doppler, Y_Doppler, X, Y, -100., 100., 10./10., skipedge=1200)
plt.plot(rv, cc, label="v = " +str(v)+' km/s')
plt.legend(loc='best')
plt.show()
Resulting in:
Does anyone run upon the same issues?
Kind regards,
Laura
Hi Stefan,
I was using the pyaGui.ContinuumInteractive to do some normalization and it worked well, but recently after I upgraded matplotlib I found the package matplotlib.backends.backend_tkagg.NavigationToolbar2TkAgg is deprecated and an error appear when I tried to import pyaGui. I did a brief search and found someone said that for now NavigationToolbar2Tk should be used. It will be great if I can use pyaGui with the newest matplotlib.
(https://stackoverflow.com/questions/50330320/what-to-use-instead-of-navigationtoolbar2tkagg)
Thanks.
Hi,
There was a recent update to the SWEETCat. When I used:
sc.downloadData()
for some reason the data was not locally updated.
When I did:
scs.dataAge() -> close to 0...
but the number of rows in the data was still outdated.
To solve this, I just removed the local files, and then I had the new data available. But this is just a work around...
Cheers,
Sérgio
I recently (two or so weeks ago) installed PyAstronomy with pip.
I'm trying to run the second example on this page (Example: Cross-correlation including weights): https://pyastronomy.readthedocs.io/en/latest/pyaslDoc/aslDoc/crosscorr.html
I get the error: TypeError: crosscorrRV() got an unexpected keyword argument 'weights'
In this version, there indeed does not appear to be a weights keyword, pyasl.crosscorrRV returns:
<function PyAstronomy.pyasl.asl.crosscorr.crosscorrRV(w, f, tw, tf, rvmin, rvmax, drv, mode='doppler', skipedge=0, edgeTapering=None)>
However, the "weights" keyword does appear in this function in the github repo: https://github.com/sczesla/PyAstronomy/blob/master/src/pyasl/asl/crosscorr.py
Is the version of crosscorrRV on github the one I should be using?
Thanks!
If you want to match NIST's R implementation,
PyAstronomy/src/pyasl/asl/outlier.py
Line 62 in 595f1ea
should be
xstd = xm.std(ddof=1)
Hi,
When I try to use the pyaGui (which I succesfully used with pleasure before) I now get the following error:
In [1]: from PyAstronomy import pyaGui
In [2]: pyaGui.Picker()
---------------------------------------------------------------------------
TclError Traceback (most recent call last)
<ipython-input-2-758404c11150> in <module>()
----> 1 pyaGui.Picker()
/usr/local/lib/python2.7/dist-packages/PyAstronomy/pyaGui/pyaPicker.pyc in __init__(self)
88 self.cid = self.f.canvas.mpl_connect('button_press_event', self._mouseButtonClicked)
89
---> 90 self.toolbar = NavigationToolbar2TkAgg(self.canvas, self.plotFrame)
91 self.toolbar.update()
92 self.canvas._tkcanvas.pack(side=tk.TOP, fill=tk.BOTH, expand=True)
/usr/lib/pymodules/python2.7/matplotlib/backends/backend_tkagg.pyc in __init__(self, canvas, window)
799 self._idle = True
800 #Tk.Frame.__init__(self, master=self.canvas._tkcanvas)
--> 801 NavigationToolbar2.__init__(self, canvas)
802
803 def destroy(self, *args):
/usr/lib/pymodules/python2.7/matplotlib/backend_bases.pyc in __init__(self, canvas)
2700 self._active = None
2701 self._lastCursor = None
-> 2702 self._init_toolbar()
2703 self._idDrag = self.canvas.mpl_connect(
2704 'motion_notify_event', self.mouse_move)
/usr/lib/pymodules/python2.7/matplotlib/backends/backend_tkagg.pyc in _init_toolbar(self)
860 self._message_label = Tk.Label(master=self, textvariable=self.message)
861 self._message_label.pack(side=Tk.RIGHT)
--> 862 self.pack(side=Tk.BOTTOM, fill=Tk.X)
863
864
/usr/lib/python2.7/lib-tk/Tkinter.pyc in pack_configure(self, cnf, **kw)
1888 self.tk.call(
1889 ('pack', 'configure', self._w)
-> 1890 + self._options(cnf, kw))
1891 pack = configure = config = pack_configure
1892 def pack_forget(self):
TclError: cannot use geometry manager pack inside .139918394899704 which already has slaves managed by grid
I tried uninstall and install PyAstronomy a couple of time, the same with matplotlib, but nothing seems really to work. The closest thing I got to something looks like a solution is here: http://stackoverflow.com/questions/23584325/cannot-use-geometry-manager-pack-inside
You have any suggestions what might be wrong?
Cheers,
Daniel
Hi Stefan,
I am not so sure if this should be an issue or not. I am checking the Kurucz atmosphere model grids, and found that in the website, there are models with Teff=50000K and logg=5.0 dex, but I got a PyValError when I try model = pyasl.getKuruczModel(50000, 5.0, 0.0)
. Is this intended to raise an error?
In pyTiming/pyPeriod/gls.py
the doc string of the Gls
class says for the freq
parameter:
If given, fast and verbose option are not available.
However, an error is raised raise(ValueError("freq and fast cannot be used together."))
when the frequency is NOT given and fast=True
.
The error is raised for the wrong conditions. In particular, with this implementation fast=True
can only be used with a manually provided frequency array, which is exactly the situation fast calculations should not work. Indeed, I in a quick test fast=True
and fast=False
gave inconsistent results, with a manually provided frequency array. Whereas, the results are consistent, when the same frequency array is provided manually, which would be automatically generated if freq=None
.
It looks like the error raising needs to be placed differently.
I cloned the most recent version of master (to try out beta sigma) and have issues installing it into a fresh conda environment.
I ran pip install -r requirements.txt
and then the commands down below.
Trying to install without --with-ext
complained about the extensions not being build and then using --with-ext
gives a different error about unknown file type .pyf
files.
~/Phd/Codes/Repos/PyAstronomy master
(betasig) ❯ git pull
Already up-to-date.
~/Phd/Codes/Repos/PyAstronomy master
(betasig) ❯ ls
build MANIFEST.in_template README.md Releases.txt requirements.txt setup.py src
~/Phd/Codes/Repos/PyAstronomy master
(betasig) ❯ python setup.py install
/home/jneal/anaconda3/envs/betasig/lib/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'install_requires'
warnings.warn(msg)
running install
running build
running build_py
running install_lib
running install_egg_info
Removing /home/jneal/anaconda3/envs/betasig/lib/python3.6/site-packages/PyAstronomy-0.13.0beta-py3.6.egg-info
Writing /home/jneal/anaconda3/envs/betasig/lib/python3.6/site-packages/PyAstronomy-0.13.0beta-py3.6.egg-info
USER INFO: External modules have not been built!
The following modules have not been compiled:
"PyAstronomy.modelSuite.XTran.forTrans.occultnl", Sources: ['src/modelSuite/XTran/forTrans/occultnl.pyf', 'src/modelSuite/XTran/forTrans/occultnl.f']
"PyAstronomy.modelSuite.XTran.forTrans.occultquad", Sources: ['src/modelSuite/XTran/forTrans/occultquad.pyf', 'src/modelSuite/XTran/forTrans/occultquad.f']
USE 'python setup.py --with-ext install' to build external modules
~/Phd/Codes/Repos/PyAstronomy master
(betasig) ❯ python setup.py --with-ext install
/home/jneal/anaconda3/envs/betasig/lib/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'install_requires'
warnings.warn(msg)
running install
running build
running build_py
running build_ext
building 'PyAstronomy.modelSuite.XTran.forTrans.occultnl' extension
error: unknown file type '.pyf' (from 'src/modelSuite/XTran/forTrans/occultnl.pyf')
Have you seen this before/have a solution for this. Am I missing some sort of compiler?
Using python setup.py --with-ext install
is not pip friendly.
A better solution would be extracting a pyastronomy-occult
package from PyAstronomy. (Bonus: This package could be distributed in binary wheels as well).
Instead of --with-ext
, it would be specified as an extra dependency to PyAstronomy:
pip install pyastronomy[occult]
Hi Stefan,
I have looking at your very simple code in pyasl.dopplerShift
for more than an hour, and found an error. When you use the interpolation in line 72 (at my version), you use the old wavelength vector. Instead you should use the shifted wavelength vector. Without the right wavelength, it shift wrong with a factor of 2.
So, change
nflux = f(wvl)
to
nflux = f(wlprime)
Cheers,
Daniel
I found some models are missing in PyA, as showing by the table indicating the number of models below:
m_h | Kurucz# | PyAstronomy# |
---|---|---|
-5.0 | 387 | 386 |
-4.5 | 393 | 390 |
-4.0 | 396 | 389 |
-3.5 | 397 | 395 |
-3.0 | 403 | 400 |
-2.5 | 401 | 401 |
-2.0 | 401 | 401 |
-1.5 | 406 | 406 |
-1.0 | 409 | 409 |
-0.5 | 410 | 410 |
-0.3 | 410 | 410 |
-0.2 | 410 | -- |
-0.1 | 410 | -- |
0.0 | 476 | 476 |
0.1 | 411 | 411 |
0.2 | 407 | 407 |
0.3 | 404 | -- |
0.5 | 395 | 395 |
1.0 | 375 | 375 |
Also the length of the model is different; in .dat files (e.g., http://kurucz.harvard.edu/grids/gridm30/am30k2.dat), the models with low Teff have a length of 72; but in PyA and .datcd files, all the models have a length of 64.
Interestingly, though, the model with Teff=5000, logg=1.0 and [Fe/H]=-3.0 is missing in .dat file.
I guess this is because Kurucz renewed his database after some time. I noticed that when it is the first time to access a grid PyA does some download work, so I thought it access to Kurucz's website every time we use getKuruczmodel method. But if so, they should be same as thouse in the website.
Hi,
When trying to use the SWEETCat function from pyasl I got the following error:
Note that I have removed the local directory from a previous version installation.
Seems to be strange since it is working on other machines...
ipython
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
Type "copyright", "credits" or "license" for more information.
IPython 1.2.1 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: from PyAstronomy import pyasl
In [2]: sc = pyasl.SWEETCat()
-------------- Configure PyA's data path ------------------------
Why do you get this message?
Most probably PyA tries to save permanent data on your
system for the first time. This may be the case when, e.g.,
a table is downloaded and saved. These data are stored
under PyA's 'data path', i.e., a regular directory on
your disk, which PyA can access.
Is anything else saved to the disk?
The location of the data path
directory will be written to the file '.pyaConfigWhere' in
your home directory, so that you need not provide it
again.
Can I delete it?
Yes, you are free to delete anything of this at any time.
What is a valid data path?
You may provide any existing or non-existing path, although
it is strongly encouraged to use a fresh directory to avoid any
confusion. The given path needs to be absolute, to uniquely
identify it.
-----------------------------------------------------------------
Configure PyA's data path now (y/n)? y
Please provide a directory where PyA can store data (may already exist):
Press enter to accept default; use 'exit' to abort.
Path (default = /home/sousasag/PyAData):
PyA data path configured successfully. Using path:
/home/sousasag/PyAData
Downloading exoplanet data from SWEET-Cat archive
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-2-8009b606496c> in <module>()
----> 1 sc = pyasl.SWEETCat()
/usr/local/lib/python2.7/dist-packages/PyAstronomy/pyasl/resBased/sweet_cat.pyc in __init__(self, skipUpdate)
104 # Data needs update
105 print "Downloading exoplanet data from SWEET-Cat archive"
--> 106 self._update(self._downloadData)
107 print "Saved data to file: ", self.dataFileName, " in data directory,"
108 print " which has been configured as: ", self._fs.dpath
/usr/local/lib/python2.7/dist-packages/PyAstronomy/pyaC/pyaPermanent/updateCycler.pyc in _update(self, func, *args, **kwargs)
146 **kwargs as parameters.
147 """
--> 148 func(*args, **kwargs)
149 self._setDownloadDate()
/usr/local/lib/python2.7/dist-packages/PyAstronomy/pyasl/resBased/sweet_cat.pyc in _downloadData(self)
68 dfn = self._fs.composeFilename(self.dataFileName)
69 # The next two lines by-pass certificate verification
---> 70 context = ssl._create_unverified_context()
71 urllib.urlretrieve(url, dfn, context=context)
72 d = self._fs.requestFile(dfn, 'r').readlines()
AttributeError: 'module' object has no attribute '_create_unverified_context'
Hi, which version is on GitHub is it Version 0.12.0?
ie. the version documented here:
http://www.hs.uni-hamburg.de/DE/Ins/Per/Czesla/PyA/PyA/index.html
OK, I can see it is
>>> print(PyAstronomy.__version__)
0.13.0beta
The FoldAt command;
PyAstronomy.pyasl.foldAt(time, period, T0=0.0, getEpoch=False)
Takes the input T0, described in the documents as a reference point. I'm folding some time series data of my own, with a known period and epoch. Is there any way of knowing what this reference should be?
Thanks.
I want to use this as a library, so I pip install --upgrade PyAstronomy
it into my virtual environment (using pyenv).
Yet, when running my program:
[...]
from PyAstronomy import pyasl
File "~/.pyenv/versions/openweathermap/lib/python3.9/site-packages/PyAstronomy/pyaC/__init__.py", line 3, in <module>
_ic = ImportCheck(["numpy", "scipy", "ssl"], required=["numpy", "scipy"])
File "~/.pyenv/versions/openweathermap/lib/python3.9/site-packages/PyAstronomy/pyaC/importCheck.py", line 105, in __init__
raise(PE.PyARequiredImport(
PyAstronomy.pyaC.pyaErrors.pyaOtherErrors.PyARequiredImport:
---------------------
A PyA error occurred:
---------------------
Type of error: PyA import error
What happened?
Could not import required module(s): scipy
What are possible solutions?
- Please install scipy
So I checked it out:
$ pip show pyastronomy
Name: PyAstronomy
Version: 0.16.0
Summary: A collection of astronomy related tools for Python.
Home-page: https://github.com/sczesla/PyAstronomy
Author: PyA group
Author-email: [email protected]
License: MIT Licence
Location: ~/.pyenv/versions/openweathermap/lib/python3.9/site-packages
Requires: six, numpy
Required-by:
Apparently pip does not know about the scipy dependency. Further it also is not a recursive dependency:
$ pipdeptree -p PyAstronomy
PyAstronomy==0.16.0
- numpy [required: Any, installed: 1.21.0]
- six [required: Any, installed: 1.16.0]
Yet, your requirements.txt lists it (and much more) as dependencies.
What is going on? If scipy is a hard dependency, why isn't it automatically installed?
From the documentation, it is not clear to me how one would go about fitting functions that return several dependent variables for the same independent variable, as occurs e.g. when fitting systems of ordinary differential equations. A simple example would be
x1' = - k1 * x1
x2' = k1 * x1 - k2 x2
I could provide a test case with data if you should be interested.
Hi!
When trying to install PyAstronomy with python 3.6 and Arch linux, the following appears:
$ python setup.py --with-ext install
/home/user/.virtualenvs/myvenv/lib/python3.6/site-packages/setuptools/dist.py:398: UserWarning: Normalizing '0.13.0beta' to '0.13.0b0'
normalized_version,
running install
running bdist_egg
running egg_info
writing PyAstronomy.egg-info/PKG-INFO
writing dependency_links to PyAstronomy.egg-info/dependency_links.txt
writing requirements to PyAstronomy.egg-info/requires.txt
writing top-level names to PyAstronomy.egg-info/top_level.txt
reading manifest file 'PyAstronomy.egg-info/SOURCES.txt'
writing manifest file 'PyAstronomy.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
running build_ext
building 'PyAstronomy.modelSuite.XTran.forTrans.occultnl' extension
error: unknown file type '.pyf' (from 'src/modelSuite/XTran/forTrans/occultnl.pyf')
The documentation does not supply any help regarding what is needed to suppress this. (Does it require gcc-fortran?)
May i suggest putting this library on pypi repository?
And perhaps join the Affiliated Packages on Astropy => http://www.astropy.org/affiliated/index.html
Good job on this!!!
Cheers!
The generalized ESD function that appears in the documentation seems to be gone from the package. Would it be possible to restore it?
Hi,
I have a question about the method crosscorrRV from the latest git version.
Currently using "doppler" mode, there is a test to check if the observed spectrum
is overall covered by the template in wavelength. But this has to be done in rest-frame,
i.e. taking into account the RV shift of the observations with respect to the template.
What I do not understand is that this test is performed by adding the RV shift to the
wavelength limits of the observations (see code below, (1+RVMAX/c) ) rather than
*removing it, before comparing with the wavelength limits of the template. Currently it raises
an error for my data (saying the template does not cover the observations) although in restframe
the template spectrum covers well the observations.
for example in my case:
Am I thinking something wrong here ? What is the idea of checking the wavelength by RV-shifting the limits of the observations?
Thank you,
Johan
elif mode == "doppler":
maxwl = w[-1] * (1.0+rvmax/c)
minwl = w[0] * (1.0+rvmin/c)
if minwl < tw[0]:
raise(PE.PyAValError("The minimum wavelength is not covered by the template.",
where="crosscorrRV",
solution=["Provide a larger template", "Try to use skipedge"]))
if maxwl > tw[-1]:
raise(PE.PyAValError("The maximum wavelength is not covered by the template.",
where="crosscorrRV",
solution=["Provide a larger template", "Try to use skipedge"]))
Dear PyAstronomy Team,
Thanks for your excellent package. I'm using now for a port of an old code, and it's really coming in handy.
I have a question about the way in which transits are calculated when the orbit is allowed to be eccentric in PyAstronomy version 0.13.0b0. Inside the modelSuite/XTran/forTrans directory in the mandelAgol.py file on line 143, I see the following:
if orbit == "keplerian":
self["w"] = -90.0
If I'm reading the documentation correctly, that line is setting the argument of periapsis to -90 degrees. Why make that assumption? If one is modeling an orbit with a different orientation, doesn't this line make the transit calculation come out wrong?
Thanks,
Brian
I am trying to run this command from the command line
python -c "from PyAstronomy.pyasl import ExoplanetEU2; ExoplanetEU2()"
With the purpose of pre-downloading the exoplanetEU data.
But I get a votable error instead...
Traceback (most recent call last):
File "/home/jneal/anaconda3/envs/py36/lib/python3.6/site-packages/astropy/io/votable/converters.py", line 1195, in parse
return mapping[value.upper()]
KeyError: 'YES'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/jneal/anaconda3/envs/py36/lib/python3.6/site-packages/PyAstronomy/pyasl/resBased/exoplanetEU.py", line 574, in __init__
self._readData()
File "/home/jneal/anaconda3/envs/py36/lib/python3.6/site-packages/PyAstronomy/pyasl/resBased/exoplanetEU.py", line 349, in _readData
self.vot = votable.parse(self._fs.requestFile(self.dataFileName, 'r', gzip.open))
File "/home/jneal/anaconda3/envs/py36/lib/python3.6/site-packages/astropy/io/votable/table.py", line 142, in parse
config=config, pos=(1, 1)).parse(iterator, config)
File "/home/jneal/anaconda3/envs/py36/lib/python3.6/site-packages/astropy/io/votable/tree.py", line 3405, in parse
iterator, tag, data, config, pos)
File "/home/jneal/anaconda3/envs/py36/lib/python3.6/site-packages/astropy/io/votable/tree.py", line 3334, in _add_resource
resource.parse(self, iterator, config)
File "/home/jneal/anaconda3/envs/py36/lib/python3.6/site-packages/astropy/io/votable/tree.py", line 3156, in parse
iterator, tag, data, config, pos)
File "/home/jneal/anaconda3/envs/py36/lib/python3.6/site-packages/astropy/io/votable/tree.py", line 3113, in _add_table
table.parse(iterator, config)
File "/home/jneal/anaconda3/envs/py36/lib/python3.6/site-packages/astropy/io/votable/tree.py", line 2405, in parse
iterator, colnumbers, fields, config)
File "/home/jneal/anaconda3/envs/py36/lib/python3.6/site-packages/astropy/io/votable/tree.py", line 2520, in _parse_tabledata
vo_reraise(e, config, pos)
File "/home/jneal/anaconda3/envs/py36/lib/python3.6/site-packages/astropy/io/votable/exceptions.py", line 119, in vo_reraise
raise exc
File "/home/jneal/anaconda3/envs/py36/lib/python3.6/site-packages/astropy/io/votable/tree.py", line 2517, in _parse_tabledata
fields[i].ID))
File "/home/jneal/anaconda3/envs/py36/lib/python3.6/site-packages/astropy/io/votable/exceptions.py", line 119, in vo_reraise
raise exc
File "/home/jneal/anaconda3/envs/py36/lib/python3.6/site-packages/astropy/io/votable/tree.py", line 2511, in _parse_tabledata
data, config, pos)
File "/home/jneal/anaconda3/envs/py36/lib/python3.6/site-packages/astropy/io/votable/converters.py", line 1197, in parse
vo_raise(E05, (value,), config, pos)
File "/home/jneal/anaconda3/envs/py36/lib/python3.6/site-packages/astropy/io/votable/exceptions.py", line 101, in vo_raise
raise exception_class(args, config, pos)
astropy.io.votable.exceptions.E05: None:634:1190: E05: Invalid boolean value 'Yes'
Any Ideas?
Hi Stefan,
I get a rather long error message when I try to run pyasl.ExoplanetEU2()
. See below.
from PyAstronomy import pyasl
d = pyasl.ExoplanetEU2()
---------------------------------------------------------------------------
E05 Traceback (most recent call last)
<ipython-input-43-59de23a2c99b> in <module>()
----> 1 pyasl.ExoplanetEU2()
/home/daniel/Software/anaconda3/lib/python2.7/site-packages/PyAstronomy/pyasl/resBased/exoplanetEU.pyc in __init__(self, skipUpdate, forceUpdate)
572 # regular update is indicated
573 self._update(self._download)
--> 574 self._readData()
575
576 def _download(self):
/home/daniel/Software/anaconda3/lib/python2.7/site-packages/PyAstronomy/pyasl/resBased/exoplanetEU.pyc in _readData(self)
347 with warnings.catch_warnings():
348 warnings.simplefilter("ignore")
--> 349 self.vot = votable.parse(self._fs.requestFile(self.dataFileName, 'r', gzip.open))
350 # Use 'name' over ID field to specify column names
351 self.vot = self.vot.get_first_table().to_table(use_names_over_ids=True)
/home/daniel/Software/anaconda3/lib/python2.7/site-packages/astropy/io/votable/table.pyc in parse(source, columns, invalid, pedantic, chunk_size, table_number, table_id, filename, unit_format, datatype_mapping,
_debug_python_based_parser)
138 _debug_python_based_parser=_debug_python_based_parser) as iterator:
139 return tree.VOTableFile(
--> 140 config=config, pos=(1, 1)).parse(iterator, config)
141
142
/home/daniel/Software/anaconda3/lib/python2.7/site-packages/astropy/io/votable/tree.pyc in parse(self, iterator, config)
3391 if start:
3392 tag_mapping.get(tag, self._add_unknown_tag)(
-> 3393 iterator, tag, data, config, pos)
3394 elif tag == 'DESCRIPTION':
3395 if self.description is not None:
/home/daniel/Software/anaconda3/lib/python2.7/site-packages/astropy/io/votable/tree.pyc in _add_resource(self, iterator, tag, data, config, pos)
3320 resource = Resource(config=config, pos=pos, **data)
3321 self.resources.append(resource)
-> 3322 resource.parse(self, iterator, config)
3323
3324 def _add_coosys(self, iterator, tag, data, config, pos):
/home/daniel/Software/anaconda3/lib/python2.7/site-packages/astropy/io/votable/tree.pyc in parse(self, votable, iterator, config)
3145 if start:
3146 tag_mapping.get(tag, self._add_unknown_tag)(
-> 3147 iterator, tag, data, config, pos)
3148 elif tag == 'DESCRIPTION':
3149 if self.description is not None:
/home/daniel/Software/anaconda3/lib/python2.7/site-packages/astropy/io/votable/tree.pyc in _add_table(self, iterator, tag, data, config, pos)
3102 table = Table(self._votable, config=config, pos=pos, **data)
3103 self.tables.append(table)
-> 3104 table.parse(iterator, config)
3105
3106 def _add_info(self, iterator, tag, data, config, pos):
/home/daniel/Software/anaconda3/lib/python2.7/site-packages/astropy/io/votable/tree.pyc in parse(self, iterator, config)
2395 'TABLEDATA', six.iterkeys(data), config, pos)
2396 self.array = self._parse_tabledata(
-> 2397 iterator, colnumbers, fields, config)
2398 break
2399 elif tag == 'BINARY':
/home/daniel/Software/anaconda3/lib/python2.7/site-packages/astropy/io/votable/tree.pyc in _parse_tabledata(self, iterator, colnumbers, fields, config)
2510 except Exception as e:
2511 if invalid == 'exception':
-> 2512 vo_reraise(e, config, pos)
2513 else:
2514 row[i] = value
/home/daniel/Software/anaconda3/lib/python2.7/site-packages/astropy/io/votable/exceptions.pyc in vo_reraise(exc, config, pos, additional)
117 message += ' ' + additional
118 exc.args = (message,)
--> 119 raise exc
120
121
E05: None:22454:1220: E05: Invalid boolean value 'Yes'
As a sidenote, the link for pyasl.ExoplanetEU
doesn't work anymore: http://exoplanet.eu/catalog/csv
I add @sousasag to the conversation as he was the one who found the bug.
Hi,
Just another small thing that I found on pyasl, for the ExoplanetEU.
The period of the planets from this database seem to be not correct. maybe a problem with parsing of this column?
Cheers,
Sérgio
In [5]: sc = pyasl.ExoplanetEU()
In [6]: data = sc.getAllData()
In [8]: data['period']
Out[8]:
array([ 3.93230819e-062, 1.26104796e-076, 1.15314137e+214, ...,
0.00000000e+000, 0.00000000e+000, 0.00000000e+000])
In [9]: data['period'][10:20]
Out[9]:
array([ 3.25259809e-086, 3.25259809e-086, 1.24395485e-047,
5.96163564e-263, 5.96162052e-263, 5.96163564e-263,
3.12707042e-264, 2.72208146e-077, 1.30420246e-076,
1.78394550e-072])
Hello
I apologize for the is this is not the correct place to post this type of question. I'm a high school teacher and novice using PyAstronomy. I found this code on the repository and I want to save the output into a text file. I tried a simple save.File.write() and when that did not work I tried to look up how nexa = pyasl.NasaExoplanetArchive() is used but I have not had any success with that. Can someone point me in the right direction to learn how to save the outputs of a nexa = pyasl.NasaExoplanetArchive() call?
Thank you Walter
Here is the snippet I have been using.
from PyAstronomy import pyasl
import datetime as dt
nexa = pyasl.NasaExoplanetArchive()
exoplanetName=raw_input ('enter exoplanet name, example Kelt-7 b')
dat = nexa.selectByPlanetName(exoplanetName)
saveFile = open('/Users/xyz/Desktop/Kelt-7b', 'w')
saveFile.write(dat)
saveFile.close()
Hi Stefan,
Our group in Porto are continously updating a catalogue with parameters of stars with exoplanets. It can be found here: https://www.astro.up.pt/resources/sweet-cat/
We think it could be a nice addition to PyAstronomy along the lines with exoplanet.eu and exoplanet.org. What do you think?
I can help with the development.
Cheers,
Daniel
again...
Hi,
When downloaded and installed PyAstronomy, "import of from PyAstronomy import pyasl" prompted a configuration path to down load the exoplanet.eu data:
Configure PyA's data path now (y/n)? y
Please provide a directory where PyA can store data (may already exist):
Press enter to accept default; use 'exit' to abort.
Path (default = /Users/benjamingerard/PyAData): /Volumes/HD_Backup/PyAData
PyA data path configured successfully. Using path:
/Volumes/HD_Backup/PyAData
but then I immediately get the following error message:
Type of error: PyA download error
What happened?
Could not download data from URL: http://exoplanet.eu/catalog/votable.
Error message: urlopen() got an unexpected keyword argument 'context'
What are possible solutions?
But the url works fine for me in a web browser, downloading exoplanet_catalog.vot
If I restart python and try the same command, I now get this error:
Type of error: PyA Value Error
What happened?
Could not access file (relative name): pyasl/resBased/epeu.vo.gz, full name: /Volumes/HD_Backup/PyAData/pyasl/resBased/epeu.vo.gz
Caught exception: [Errno 2] No such file or directory: '/Volumes/HD_Backup/PyAData/pyasl/resBased/epeu.vo.gz'
Help?
Hi,
I have used your function for doppler shifting a spectra in one of my programs. Because of some computer problems, I needed to remove the dependency from PyAstronomy. So I copy-paste all the code to my own program, and everything is working perfectly.
However, since I didn't do the writing of that function, I would like to acknowledge you for your work.
Is there an official way of doing this or should I just put a link to your webpage in a comment above the function (or anything else you prefer)?
Thanks for your software. It is fantastic!
Cheers,
Daniel
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.