├── .gitignore ├── MANIFEST.in ├── README.rst ├── astropysics ├── __init__.py ├── ccd.py ├── config.py ├── constants.py ├── coords │ ├── __init__.py │ ├── coordsys.py │ ├── ephems.py │ └── funcs.py ├── data │ ├── JHKbands.dat │ ├── UBVRIbands.dat │ ├── earth_series.tab │ ├── eyeresponse.dat │ ├── galaxy_lines.dat │ ├── iau00_cio_locator.tab │ ├── iau00a_nutation_ls.tab │ ├── iau00a_nutation_pl.tab │ ├── iau00b_nutation.tab │ ├── ipy_profile_astpys.py │ ├── ipython_config_astpys.py │ ├── obsdb.dat │ ├── project_template.py │ ├── ss_elems_1.dat │ ├── ss_elems_2.dat │ ├── ss_elems_2b.dat │ ├── stellar_lines.dat │ ├── ugrizbands.dat │ ├── vega_k93.fits.gz │ ├── vega_k93.pydict │ └── washingtonbands.dat ├── external │ ├── __init__.py │ └── configobj.py ├── gui │ ├── __init__.py │ ├── spectarget.py │ └── spylot.py ├── models.py ├── objcat.py ├── obstools.py ├── phot.py ├── pipeline.py ├── plotting.py ├── publication.py ├── spec.py ├── sphinxext │ ├── __init__.py │ └── todomod.py ├── utils │ ├── __init__.py │ ├── alg.py │ ├── gen.py │ ├── io.py │ └── stats.py └── version.py ├── distribute_setup.py ├── docs ├── Makefile ├── _static │ └── logo16.png ├── _templates │ └── layout.html ├── conf.py ├── coremods │ ├── ccd.rst │ ├── config.rst │ ├── constants.rst │ ├── coords.rst │ ├── intro.rst │ ├── models.rst │ ├── objcat.rst │ ├── obstools.rst │ ├── phot.rst │ ├── pipeline.rst │ ├── plotting.rst │ ├── publication.rst │ ├── spec.rst │ └── utils.rst ├── develop.rst ├── getstarted.rst ├── gui │ ├── intro.rst │ ├── spectarget.rst │ └── spylot.rst ├── index.rst └── install.rst ├── licenses ├── CONFIGOBJ_LICENSE ├── LICENSE └── SOFA_LICENSE ├── logo ├── imagecredits ├── logo.ico ├── logo.png ├── logo.xcf ├── logo16.png ├── logo192.png ├── logo32.ico ├── logo32.png ├── logo32thin.ico ├── logo32thin.png ├── logo64.png ├── logo64thin.png ├── logorot.png ├── logorot.xcf ├── logotext.png └── logotext.xcf ├── scripts ├── astpys-setup ├── fitsinfo ├── ipyastpys ├── prepforpub └── spylot ├── setup.cfg ├── setup.py └── tests ├── __init__.py ├── __main__.py ├── centroiding.py ├── sofatests.build ├── sofatests.c ├── sofatests.py ├── test_coords.py ├── test_ephems.py ├── test_models.py ├── test_objcat.py ├── test_obs_site.py ├── test_pub.py └── test_pub.tex /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | docs/_build/**/* 3 | build/**/* 4 | Astropysics.egg-info 5 | *.pyc 6 | *.egg 7 | *.tar.gz 8 | *.nja 9 | ?noseids 10 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include distribute_setup.py 2 | recursive-include astropysics/data * 3 | recursive-include docs * 4 | recursive-include licenses * 5 | recursive-include tests *.c 6 | prune docs/_build 7 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | Astropysics 2 | =========== 3 | 4 | A python library for astronomy/astrophysics calculations and data analysis. 5 | 6 | Web Page: http://packages.python.org/Astropysics/ 7 | 8 | License: Apache License v2.0 9 | 10 | Note that Astropysics is now in "maintainence mode" only. That is, 11 | further development is not expected, as my efforts have shifted to the 12 | `Astropy project `_. It is a much larger effort 13 | that contains most of the functionality in Astropysics and much more. 14 | Astropysics will remain so that code written against it will continue to 15 | function, though, and I will continue to accept bug fixes as necessary. 16 | 17 | Installation 18 | ------------ 19 | 20 | If you have numpy (http://numpy.scipy.org/) and scipy (http://www.scipy.org/) installed, just do:: 21 | 22 | python setup.py install 23 | 24 | On some linux distributions, this may need to be:: 25 | 26 | sudo python setup.py install 27 | 28 | Note also, if you are using `pip` to install, the latest version might not work do to some issues with SSL. In that case you may have luck using the latest dev version:: 29 | 30 | pip install git+https://github.com/eteq/astropysics.git 31 | 32 | 33 | Documentation 34 | ------------- 35 | 36 | Documentation (in the "docs" directory) is meant to be used with sphinx (http://sphinx.pocoo.org). Typical usage is:: 37 | 38 | python setup.py build_sphinx 39 | 40 | to build html documentation and place it in docs/_build/html. Note that this requires Sphinx >=1.0 41 | 42 | Source Distribution Directory Structure 43 | --------------------------------------- 44 | 45 | * astropysics/ - source code for all astropysics modules 46 | * docs/ - Sphinx documentation and example code 47 | * logo/ - astropysics logo in various forms 48 | * licenses/ - copyright/license notices for all open source code 49 | * scripts/ - command-line scripts installed with astropysics 50 | * tests/ - unit tests (for use with Nose) and algorithmic experiments (Note unit tests require `networkx `_ and `pymodelfit `_ to run). 51 | 52 | -------------------------------------------------------------------------------- /astropysics/__init__.py: -------------------------------------------------------------------------------- 1 | #Copyright 2008 Erik Tollerud 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | """ 16 | This package contains a variety of utilities and algorithms for processing 17 | and visualizing astronomical data. 18 | 19 | **Modules** 20 | 21 | * constants: physical constants and conversions, Cosmology objects for choosing 22 | related sets of constants 23 | * coords: Astronomical coordinate systems, distance measurements, 24 | and related objects 25 | * obstools: Tools and corrections for observations (mostly optical) 26 | * models: Fitting functions/models and related calculations 27 | * objcat: Object Catalog objects and functions 28 | * phot: Photometry objects and related functions 29 | * spec: Spectrum objects and related functions 30 | * ccd: Functions and tools for processing CCD images. 31 | 32 | """ 33 | 34 | #If True, the add_docs and similar functions will only replace with empty 35 | #strings - this is used by sphinx to 36 | _ignore_add_docs = False 37 | 38 | #Large-scale TODO list: 39 | 40 | #Add Obsplots 41 | #ccd tweaks/todos 42 | #instrument registry along with site 43 | #objcat testing w/ M31 catalog 44 | #ZODB/Web objcat integration 45 | #pipeline gui and mid-saving 46 | #Phot reworking/clean up docs -------------------------------------------------------------------------------- /astropysics/coords/__init__.py: -------------------------------------------------------------------------------- 1 | #Copyright 2010 Erik Tollerud 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | """ 16 | 17 | ======================================================= 18 | coords -- coordinate classes and coordinate conversions 19 | ======================================================= 20 | 21 | 22 | Overview 23 | -------- 24 | 25 | The :mod:`coords` module contains classes and functions specifying locations of 26 | objects on the sky as well as coordinate converstions and distance computations, 27 | including cosmological distance and redshift calculations. 28 | 29 | Some of the calculations involved make use of the currently selected cosmology 30 | (see :mod:`astropysics.constants`) and hence may not function as expected if a 31 | particularly strange cosmology is in use. 32 | 33 | .. note:: 34 | Timekeeping/conversion functions are kept in :mod:`astropysics.obstools`, 35 | although some are crucial to coordinate systems. 36 | 37 | .. seealso:: 38 | 39 | `Kapteyn libraries `_ 40 | A set of python libraries with excellent coordinate transform and other 41 | capabilities. 42 | 43 | `Meeus, Jean H. "Astronomical Algorithms" ISBN 0943396352 `_ 44 | An authoritative reference on coordinates, ephemerides, and related 45 | transforms in astronomy. 46 | 47 | `Standards Of Fundamental Astronomy (SOFA) `_ 48 | The IAU reference implementations for coordinates and earth rotation. 49 | 50 | `USNO Circular 179 `_ 51 | An excellent description of the IAU 2000 resolutions and related 52 | background for defining ICRS, CIO, and related standards. 53 | 54 | .. note:: 55 | Some functionality in this module makes use of derived versions of the `SOFA 56 | `_ routines. Use of these derived works requires 57 | inclusion of the SOFA license (included in the licenses/SOFA_LICENSE file of 58 | the source distribution) and notation indicating how these routines have 59 | been modified. In *all* cases where SOFA-derived routines are used, the 60 | routine's functionality is replicated exactly as the SOFA implementation 61 | (barring the possibility of typos), but adapted to the python language. 62 | 63 | 64 | .. todo:: Tutorials that unify the sub-modules? 65 | 66 | 67 | 68 | 69 | The :mod:`~astropysics.coords` module is composed of three submodules to make 70 | organization clearer. The :mod:`~astropysics.coords.coordsys` module implements 71 | classes representing useful coordinate systems in astronomy and a framework to 72 | add additional coordinate systems as desired. It also implements standard 73 | transformations between the various celestial and terrestrial coordinates 74 | (although transformation to local horizontal coordinates is done with methods of 75 | :class:`astropysics.obstools.Site`). :mod:`~astropysics.coords.ephems` 76 | implements ephemerides for solar system objects and proper motions. Finally, 77 | :mod:`~astropysics.coords.funcs` contains a range of utility functions including 78 | cartesian<->spherical and other canonical transforms, as well as cosmological 79 | distance calculations. The documentation for each of the sub-modules is 80 | described below. 81 | 82 | .. note:: 83 | 84 | The :mod:`~astropysics.coords` module is composed of submodules that can be 85 | accessed seperately. However, they are all also included in the base module. 86 | Thus, as an example, ``astropysics.coords.coordsys.ICRSCoordinates`` and 87 | ``astropysics.coords.ICRSCoordinates`` are different names for the same 88 | class (:class:`~astropysics.coords.coordsys.ICRSCoordinates`). The 89 | ``astropysics.coords.ICRSCoordinates`` usage is preferred as this allows the 90 | internal organization to be changed if it is deemed necessary. 91 | 92 | coords.coordsys -- coordinate systems and transforms 93 | ---------------------------------------------------- 94 | 95 | .. automodule:: astropysics.coords.coordsys 96 | :members: 97 | :undoc-members: 98 | :show-inheritance: 99 | 100 | 101 | coords.ephems -- ephemerides and proper motions 102 | ----------------------------------------------- 103 | 104 | .. automodule:: astropysics.coords.ephems 105 | :members: 106 | :undoc-members: 107 | :show-inheritance: 108 | 109 | coords.funcs -- coordinate and distance utility functions 110 | --------------------------------------------------------- 111 | 112 | .. automodule:: astropysics.coords.funcs 113 | :members: 114 | :undoc-members: 115 | :show-inheritance: 116 | 117 | """ 118 | 119 | #TODO: WCSlib or similar support a la Kapteyn? 120 | 121 | from coordsys import * 122 | from ephems import * 123 | from funcs import * 124 | 125 | del ABCMeta,abstractmethod,abstractproperty,np,pi #clean up namespace 126 | -------------------------------------------------------------------------------- /astropysics/data/JHKbands.dat: -------------------------------------------------------------------------------- 1 | #2MASS J,H, and K bands: http://www.ipac.caltech.edu/2mass/releases/allsky/doc/sec6_4a.html#rsr 2 | 3 | Band J 4 | 5 | 1.062 0. 6 | 1.066 4.07068E-04 7 | 1.070 1.54293E-03 8 | 1.075 2.67013E-03 9 | 1.078 5.50643E-03 10 | 1.082 1.22532E-02 11 | 1.084 2.02928E-02 12 | 1.087 3.06470E-02 13 | 1.089 4.05135E-02 14 | 1.093 5.15324E-02 15 | 1.096 5.63529E-02 16 | 1.102 7.18073E-02 17 | 1.105 0.273603 18 | 1.107 0.340997 19 | 1.109 0.358446 20 | 1.112 0.380134 21 | 1.116 0.330668 22 | 1.117 0.239548 23 | 1.120 0.250062 24 | 1.123 0.283301 25 | 1.128 0.258233 26 | 1.129 0.251474 27 | 1.132 0.538119 28 | 1.134 0.223168 29 | 1.138 0.536893 30 | 1.140 0.110203 31 | 1.143 0.529207 32 | 1.147 0.261940 33 | 1.154 0.320155 34 | 1.159 0.174300 35 | 1.164 0.607031 36 | 1.167 0.617933 37 | 1.170 0.676289 38 | 1.173 0.727940 39 | 1.175 0.746531 40 | 1.179 0.830404 41 | 1.182 0.790307 42 | 1.186 0.809605 43 | 1.188 0.836888 44 | 1.192 0.835984 45 | 1.195 0.749936 46 | 1.199 0.708013 47 | 1.202 0.698759 48 | 1.209 0.704854 49 | 1.216 0.700382 50 | 1.221 0.732765 51 | 1.227 0.705725 52 | 1.231 0.842431 53 | 1.236 0.921873 54 | 1.240 0.952505 55 | 1.244 0.967585 56 | 1.247 0.959508 57 | 1.253 0.922697 58 | 1.255 0.892978 59 | 1.258 0.852943 60 | 1.260 0.802308 61 | 1.265 0.750078 62 | 1.270 0.678072 63 | 1.275 0.652417 64 | 1.279 0.638754 65 | 1.286 0.642413 66 | 1.292 0.648560 67 | 1.297 0.682380 68 | 1.302 0.752903 69 | 1.305 0.775942 70 | 1.307 0.811828 71 | 1.310 0.777008 72 | 1.313 0.721030 73 | 1.316 0.952459 74 | 1.319 0.855137 75 | 1.323 0.841401 76 | 1.326 1.00000 77 | 1.330 0.894736 78 | 1.333 0.854912 79 | 1.334 0.537894 80 | 1.336 0.279866 81 | 1.339 0.906532 82 | 1.343 0.689345 83 | 1.346 0.553327 84 | 1.349 0.243177 85 | 1.353 1.43760E-02 86 | 1.355 1.89290E-04 87 | 1.360 4.00791E-02 88 | 1.363 4.53595E-03 89 | 1.370 3.19968E-04 90 | 1.373 3.72168E-02 91 | 1.377 5.38436E-04 92 | 1.383 0. 93 | 1.388 1.44443E-04 94 | 1.392 3.29774E-03 95 | 1.395 3.14438E-04 96 | 1.396 8.47738E-03 97 | 1.397 2.53731E-02 98 | 1.398 0.118446 99 | 1.400 1.35728E-04 100 | 1.401 6.10438E-05 101 | 1.402 5.21326E-02 102 | 1.404 1.03768E-02 103 | 1.406 4.78050E-02 104 | 1.407 4.19727E-04 105 | 1.410 2.36641E-03 106 | 1.412 5.26108E-03 107 | 1.416 8.64765E-03 108 | 1.421 7.28868E-04 109 | 1.426 3.48399E-04 110 | 1.442 3.78145E-04 111 | 1.450 0. 112 | 113 | Band H 114 | 115 | 116 | 1.289 0. 117 | 1.315 5.91635E-08 118 | 1.341 1.27100E-07 119 | 1.368 0. 120 | 1.397 0. 121 | 1.418 1.71065E-05 122 | 1.440 5.11074E-04 123 | 1.462 2.76582E-03 124 | 1.478 8.08827E-03 125 | 1.486 2.87356E-02 126 | 1.493 8.71147E-02 127 | 1.504 0.201449 128 | 1.515 0.438159 129 | 1.528 0.686357 130 | 1.539 0.818076 131 | 1.546 0.882073 132 | 1.551 0.911825 133 | 1.556 0.926872 134 | 1.565 0.929288 135 | 1.572 0.872747 136 | 1.577 0.856619 137 | 1.583 0.882556 138 | 1.592 0.918084 139 | 1.597 0.926654 140 | 1.602 0.907594 141 | 1.613 0.925974 142 | 1.619 0.920496 143 | 1.628 0.924198 144 | 1.633 0.923533 145 | 1.642 0.941788 146 | 1.648 0.949134 147 | 1.657 0.980658 148 | 1.659 0.993744 149 | 1.671 1.00000 150 | 1.684 0.956052 151 | 1.701 0.924116 152 | 1.715 0.982120 153 | 1.727 0.991589 154 | 1.739 0.988683 155 | 1.746 0.979168 156 | 1.751 0.968184 157 | 1.753 0.937040 158 | 1.756 0.918998 159 | 1.764 0.842264 160 | 1.775 0.667111 161 | 1.785 0.269402 162 | 1.790 0.451630 163 | 1.796 0.173062 164 | 1.803 0.107726 165 | 1.810 7.07003E-02 166 | 1.813 5.10945E-03 167 | 1.818 1.99705E-02 168 | 1.828 3.91934E-04 169 | 1.835 1.53053E-06 170 | 1.850 5.94581E-05 171 | 1.871 0. 172 | 1.893 3.05088E-05 173 | 1.914 0. 174 | 175 | Band K 176 | 177 | 178 | 1.900 0. 179 | 1.915 8.16050E-06 180 | 1.927 1.61002E-05 181 | 1.934 1.59036E-04 182 | 1.939 4.94992E-04 183 | 1.948 5.37610E-03 184 | 1.957 1.18628E-02 185 | 1.962 1.97031E-02 186 | 1.969 4.21742E-02 187 | 1.976 8.73064E-02 188 | 1.981 0.152759 189 | 1.989 0.248173 190 | 1.990 0.190245 191 | 1.998 0.233884 192 | 2.008 0.294551 193 | 2.014 0.398217 194 | 2.019 0.336603 195 | 2.028 0.620746 196 | 2.037 0.764986 197 | 2.045 0.746412 198 | 2.061 0.625063 199 | 2.072 0.725492 200 | 2.075 0.689468 201 | 2.082 0.787906 202 | 2.089 0.818135 203 | 2.099 0.822833 204 | 2.106 0.863294 205 | 2.113 0.877829 206 | 2.120 0.854895 207 | 2.124 0.895329 208 | 2.138 0.918862 209 | 2.145 0.926769 210 | 2.155 0.926657 211 | 2.169 0.900943 212 | 2.176 0.922819 213 | 2.185 0.842755 214 | 2.197 0.945854 215 | 2.208 0.980363 216 | 2.213 0.987926 217 | 2.218 0.984788 218 | 2.232 0.964659 219 | 2.237 0.981633 220 | 2.248 0.983449 221 | 2.256 0.961316 222 | 2.260 0.979226 223 | 2.263 1.00000 224 | 2.265 0.963168 225 | 2.270 0.981193 226 | 2.272 0.968068 227 | 2.276 0.910892 228 | 2.277 0.982136 229 | 2.281 0.889606 230 | 2.284 0.891766 231 | 2.286 0.942380 232 | 2.291 0.840424 233 | 2.293 0.804239 234 | 2.295 0.707670 235 | 2.297 0.657619 236 | 2.299 0.560736 237 | 2.306 0.443653 238 | 2.311 0.348239 239 | 2.316 0.230228 240 | 2.320 0.162597 241 | 2.325 0.135967 242 | 2.328 9.21021E-02 243 | 2.335 6.23901E-02 244 | 2.339 4.30926E-02 245 | 2.344 3.39814E-02 246 | 2.346 3.09546E-02 247 | 2.352 1.18112E-02 248 | 2.361 6.83260E-03 249 | 2.363 7.48518E-04 250 | 2.370 2.99553E-03 251 | 2.375 2.09686E-03 252 | 2.384 4.06306E-04 253 | 2.399 0. 254 | 255 | -------------------------------------------------------------------------------- /astropysics/data/UBVRIbands.dat: -------------------------------------------------------------------------------- 1 | #Source: Bessell 90 2 | 3 | Band U 4 | 3000.000 0.000 5 | 3050.000 0.016 6 | 3100.000 0.068 7 | 3150.000 0.167 8 | 3200.000 0.287 9 | 3250.000 0.423 10 | 3300.000 0.560 11 | 3350.000 0.673 12 | 3400.000 0.772 13 | 3450.000 0.841 14 | 3500.000 0.905 15 | 3550.000 0.943 16 | 3600.000 0.981 17 | 3650.000 0.993 18 | 3700.000 1.000 19 | 3750.000 0.989 20 | 3800.000 0.916 21 | 3850.000 0.804 22 | 3900.000 0.625 23 | 3950.000 0.423 24 | 4000.000 0.238 25 | 4050.000 0.114 26 | 4100.000 0.051 27 | 4150.000 0.019 28 | 4200.000 0.000 29 | 30 | 31 | Band B 32 | 3600.000 0.000 33 | 3700.000 0.030 34 | 3800.000 0.134 35 | 3900.000 0.567 36 | 4000.000 0.920 37 | 4100.000 0.978 38 | 4200.000 1.000 39 | 4300.000 0.978 40 | 4400.000 0.935 41 | 4500.000 0.853 42 | 4600.000 0.740 43 | 4700.000 0.640 44 | 4800.000 0.536 45 | 4900.000 0.424 46 | 5000.000 0.325 47 | 5100.000 0.235 48 | 5200.000 0.150 49 | 5300.000 0.095 50 | 5400.000 0.043 51 | 5500.000 0.009 52 | 5600.000 0.000 53 | 54 | 55 | Band V 56 | 4700.000 0.000 57 | 4800.000 0.030 58 | 4900.000 0.163 59 | 5000.000 0.458 60 | 5100.000 0.780 61 | 5200.000 0.967 62 | 5300.000 1.000 63 | 5400.000 0.973 64 | 5500.000 0.898 65 | 5600.000 0.792 66 | 5700.000 0.684 67 | 5800.000 0.574 68 | 5900.000 0.461 69 | 6000.000 0.359 70 | 6100.000 0.270 71 | 6200.000 0.197 72 | 6300.000 0.135 73 | 6400.000 0.081 74 | 6500.000 0.045 75 | 6600.000 0.025 76 | 6700.000 0.017 77 | 6800.000 0.013 78 | 6900.000 0.009 79 | 7000.000 0.000 80 | 81 | 82 | Band R 83 | 5500.000 0.000 84 | 5600.000 0.230 85 | 5700.000 0.740 86 | 5800.000 0.910 87 | 5900.000 0.980 88 | 6000.000 1.000 89 | 6100.000 0.980 90 | 6200.000 0.960 91 | 6300.000 0.930 92 | 6400.000 0.900 93 | 6500.000 0.860 94 | 6600.000 0.810 95 | 6700.000 0.780 96 | 6800.000 0.720 97 | 6900.000 0.670 98 | 7000.000 0.610 99 | 7100.000 0.560 100 | 7200.000 0.510 101 | 7300.000 0.460 102 | 7400.000 0.400 103 | 7500.000 0.350 104 | 8000.000 0.140 105 | 8500.000 0.030 106 | 9000.000 0.000 107 | 108 | 109 | Band I 110 | 7000.000 0.000 111 | 7100.000 0.024 112 | 7200.000 0.232 113 | 7300.000 0.555 114 | 7400.000 0.785 115 | 7500.000 0.910 116 | 7600.000 0.965 117 | 7700.000 0.985 118 | 7800.000 0.990 119 | 7900.000 0.995 120 | 8000.000 1.000 121 | 8100.000 1.000 122 | 8200.000 0.990 123 | 8300.000 0.980 124 | 8400.000 0.950 125 | 8500.000 0.910 126 | 8600.000 0.860 127 | 8700.000 0.750 128 | 8800.000 0.560 129 | 8900.000 0.330 130 | 9000.000 0.150 131 | 9100.000 0.030 132 | 9200.000 0.000 133 | 134 | -------------------------------------------------------------------------------- /astropysics/data/eyeresponse.dat: -------------------------------------------------------------------------------- 1 | #from http://www.cvrl.org/ based on Stockman and Sharpe (2000) 2 | 390, -3.21863, -3.29076, -1.96598 3 | 391, -3.13652, -3.20684, -1.88705 4 | 392, -3.05545, -3.12367, -1.80825 5 | 393, -2.97558, -3.04148, -1.72974 6 | 394, -2.89711, -2.96047, -1.65172 7 | 395, -2.82023, -2.88089, -1.57436 8 | 396, -2.74510, -2.80295, -1.49783 9 | 397, -2.67193, -2.72686, -1.42232 10 | 398, -2.60089, -2.65287, -1.34800 11 | 399, -2.53217, -2.58117, -1.27505 12 | 400, -2.46595, -2.51201, -1.20366 13 | 401, -2.40234, -2.44551, -1.13397 14 | 402, -2.34112, -2.38148, -1.06610 15 | 403, -2.28199, -2.31962, -1.00014 16 | 404, -2.22466, -2.25966, -0.93617 17 | 405, -2.16882, -2.20131, -0.87429 18 | 406, -2.11430, -2.14436, -0.81458 19 | 407, -2.06146, -2.08897, -0.75719 20 | 408, -2.01078, -2.03539, -0.70223 21 | 409, -1.96274, -1.98384, -0.64986 22 | 410, -1.91782, -1.93457, -0.60021 23 | 411, -1.87633, -1.88775, -0.55336 24 | 412, -1.83798, -1.84325, -0.50921 25 | 413, -1.80230, -1.80089, -0.46762 26 | 414, -1.76883, -1.76047, -0.42843 27 | 415, -1.73708, -1.72181, -0.39150 28 | 416, -1.70674, -1.68475, -0.35674 29 | 417, -1.67790, -1.64931, -0.32428 30 | 418, -1.65082, -1.61558, -0.29433 31 | 419, -1.62575, -1.58360, -0.26709 32 | 420, -1.60291, -1.55345, -0.24275 33 | 421, -1.58242, -1.52513, -0.22138 34 | 422, -1.56383, -1.49833, -0.20247 35 | 423, -1.54655, -1.47270, -0.18540 36 | 424, -1.52999, -1.44787, -0.16953 37 | 425, -1.51356, -1.42347, -0.15422 38 | 426, -1.49681, -1.39922, -0.13899 39 | 427, -1.47980, -1.37505, -0.12401 40 | 428, -1.46270, -1.35100, -0.10960 41 | 429, -1.44571, -1.32708, -0.09609 42 | 430, -1.42902, -1.30331, -0.08379 43 | 431, -1.41277, -1.27973, -0.07291 44 | 432, -1.39694, -1.25647, -0.06320 45 | 433, -1.38146, -1.23366, -0.05429 46 | 434, -1.36626, -1.21144, -0.04578 47 | 435, -1.35128, -1.18995, -0.03732 48 | 436, -1.33650, -1.16933, -0.02868 49 | 437, -1.32214, -1.14970, -0.02028 50 | 438, -1.30846, -1.13119, -0.01268 51 | 439, -1.29574, -1.11391, -0.00645 52 | 440, -1.28423, -1.09798, -0.00216 53 | 441, -1.27411, -1.08346, -0.00020 54 | 442, -1.26512, -1.07012, -0.00022 55 | 443, -1.25691, -1.05766, -0.00169 56 | 444, -1.24911, -1.04578, -0.00408 57 | 445, -1.24136, -1.03418, -0.00685 58 | 446, -1.23339, -1.02265, -0.00965 59 | 447, -1.22525, -1.01126, -0.01272 60 | 448, -1.21706, -1.00015, -0.01649 61 | 449, -1.20895, -0.98948, -0.02138 62 | 450, -1.20104, -0.97939, -0.02782 63 | 451, -1.19340, -0.96994, -0.03607 64 | 452, -1.18581, -0.96085, -0.04576 65 | 453, -1.17799, -0.95173, -0.05636 66 | 454, -1.16968, -0.94220, -0.06735 67 | 455, -1.16057, -0.93189, -0.07819 68 | 456, -1.15043, -0.92047, -0.08843 69 | 457, -1.13914, -0.90788, -0.09796 70 | 458, -1.12659, -0.89415, -0.10671 71 | 459, -1.11269, -0.87926, -0.11466 72 | 460, -1.09736, -0.86324, -0.12174 73 | 461, -1.08057, -0.84614, -0.12801 74 | 462, -1.06266, -0.82826, -0.13387 75 | 463, -1.04403, -0.80994, -0.13983 76 | 464, -1.02509, -0.79155, -0.14638 77 | 465, -1.00625, -0.77342, -0.15403 78 | 466, -0.98786, -0.75586, -0.16321 79 | 467, -0.97000, -0.73897, -0.17401 80 | 468, -0.95272, -0.72280, -0.18646 81 | 469, -0.93604, -0.70740, -0.20059 82 | 470, -0.91999, -0.69281, -0.21642 83 | 471, -0.90459, -0.67906, -0.23395 84 | 472, -0.88975, -0.66604, -0.25306 85 | 473, -0.87536, -0.65362, -0.27362 86 | 474, -0.86130, -0.64167, -0.29547 87 | 475, -0.84748, -0.63006, -0.31849 88 | 476, -0.83380, -0.61866, -0.34252 89 | 477, -0.82024, -0.60745, -0.36735 90 | 478, -0.80680, -0.59641, -0.39278 91 | 479, -0.79348, -0.58551, -0.41860 92 | 480, -0.78028, -0.57474, -0.44460 93 | 481, -0.76720, -0.56409, -0.47063 94 | 482, -0.75426, -0.55360, -0.49678 95 | 483, -0.74151, -0.54330, -0.52323 96 | 484, -0.72896, -0.53324, -0.55014 97 | 485, -0.71664, -0.52346, -0.57766 98 | 486, -0.70454, -0.51395, -0.60586 99 | 487, -0.69243, -0.50450, -0.63447 100 | 488, -0.68007, -0.49484, -0.66310 101 | 489, -0.66718, -0.48470, -0.69138 102 | 490, -0.65351, -0.47381, -0.71893 103 | 491, -0.63886, -0.46198, -0.74546 104 | 492, -0.62333, -0.44931, -0.77105 105 | 493, -0.60706, -0.43594, -0.79586 106 | 494, -0.59023, -0.42206, -0.82008 107 | 495, -0.57300, -0.40782, -0.84385 108 | 496, -0.55550, -0.39336, -0.86738 109 | 497, -0.53779, -0.37871, -0.89092 110 | 498, -0.51991, -0.36389, -0.91475 111 | 499, -0.50188, -0.34889, -0.93916 112 | 500, -0.48375, -0.33372, -0.96443 113 | 501, -0.46554, -0.31841, -0.99080 114 | 502, -0.44731, -0.30301, -1.01838 115 | 503, -0.42910, -0.28759, -1.04726 116 | 504, -0.41096, -0.27221, -1.07751 117 | 505, -0.39294, -0.25695, -1.10920 118 | 506, -0.37509, -0.24186, -1.14231 119 | 507, -0.35745, -0.22701, -1.17636 120 | 508, -0.34005, -0.21243, -1.21077 121 | 509, -0.32292, -0.19817, -1.24494 122 | 510, -0.30611, -0.18429, -1.27831 123 | 511, -0.28964, -0.17081, -1.31046 124 | 512, -0.27356, -0.15775, -1.34171 125 | 513, -0.25788, -0.14509, -1.37256 126 | 514, -0.24263, -0.13282, -1.40350 127 | 515, -0.22786, -0.12094, -1.43503 128 | 516, -0.21358, -0.10947, -1.46755 129 | 517, -0.19990, -0.09850, -1.50099 130 | 518, -0.18689, -0.08817, -1.53521 131 | 519, -0.17465, -0.07861, -1.57006 132 | 520, -0.16327, -0.06995, -1.60537 133 | 521, -0.15280, -0.06226, -1.64102 134 | 522, -0.14314, -0.05546, -1.67701 135 | 523, -0.13417, -0.04940, -1.71337 136 | 524, -0.12575, -0.04393, -1.75014 137 | 525, -0.11776, -0.03890, -1.78735 138 | 526, -0.11007, -0.03421, -1.82501 139 | 527, -0.10272, -0.02986, -1.86305 140 | 528, -0.09574, -0.02586, -1.90139 141 | 529, -0.08916, -0.02227, -1.93996 142 | 530, -0.08304, -0.01910, -1.97866 143 | 531, -0.07738, -0.01637, -2.01743 144 | 532, -0.07209, -0.01400, -2.05636 145 | 533, -0.06704, -0.01189, -2.09553 146 | 534, -0.06210, -0.00994, -2.13503 147 | 535, -0.05714, -0.00805, -2.17496 148 | 536, -0.05208, -0.00615, -2.21538 149 | 537, -0.04701, -0.00433, -2.25624 150 | 538, -0.04206, -0.00269, -2.29745 151 | 539, -0.03735, -0.00136, -2.33891 152 | 540, -0.03303, -0.00043, -2.38056 153 | 541, -0.02918, -0.00002, -2.42230 154 | 542, -0.02583, -0.00013, -2.46413 155 | 543, -0.02296, -0.00077, -2.50607 156 | 544, -0.02058, -0.00191, -2.54812 157 | 545, -0.01866, -0.00358, -2.59028 158 | 546, -0.01718, -0.00572, -2.63256 159 | 547, -0.01601, -0.00822, -2.67498 160 | 548, -0.01498, -0.01093, -2.71754 161 | 549, -0.01395, -0.01368, -2.76026 162 | 550, -0.01276, -0.01634, -2.80313 163 | 551, -0.01130, -0.01880, -2.84617 164 | 552, -0.00966, -0.02118, -2.88932 165 | 553, -0.00798, -0.02365, -2.93253 166 | 554, -0.00640, -0.02637, -2.97574 167 | 555, -0.00505, -0.02953, -3.01890 168 | 556, -0.00403, -0.03323, -3.06197 169 | 557, -0.00330, -0.03741, -3.10495 170 | 558, -0.00276, -0.04192, -3.14788 171 | 559, -0.00233, -0.04663, -3.19077 172 | 560, -0.00193, -0.05142, -3.23365 173 | 561, -0.00150, -0.05619, -3.27653 174 | 562, -0.00105, -0.06102, -3.31942 175 | 563, -0.00063, -0.06601, -3.36228 176 | 564, -0.00028, -0.07126, -3.40512 177 | 565, -0.00006, -0.07689, -3.44790 178 | 566, 0.00000, -0.08298, -3.49061 179 | 567, -0.00011, -0.08952, -3.53326 180 | 568, -0.00039, -0.09648, -3.57583 181 | 569, -0.00085, -0.10380, -3.61832 182 | 570, -0.00149, -0.11147, -3.66073 183 | 571, -0.00232, -0.11946, -3.70305 184 | 572, -0.00339, -0.12784, -3.74527 185 | 573, -0.00476, -0.13670, -3.78740 186 | 574, -0.00649, -0.14613, -3.82942 187 | 575, -0.00863, -0.15622, -3.87133 188 | 576, -0.01121, -0.16702, -3.91312 189 | 577, -0.01408, -0.17840, -3.95478 190 | 578, -0.01705, -0.19018, -3.99632 191 | 579, -0.01993, -0.20220, -4.03772 192 | 580, -0.02252, -0.21429, -4.07899 193 | 581, -0.02472, -0.22632, -4.12012 194 | 582, -0.02663, -0.23834, -4.16109 195 | 583, -0.02843, -0.25044, -4.20192 196 | 584, -0.03033, -0.26272, -4.24259 197 | 585, -0.03249, -0.27526, -4.28311 198 | 586, -0.03507, -0.28817, -4.32346 199 | 587, -0.03806, -0.30148, -4.36364 200 | 588, -0.04142, -0.31525, -4.40365 201 | 589, -0.04510, -0.32951, -4.44349 202 | 590, -0.04907, -0.34432, -4.48316 203 | 591, -0.05329, -0.35969, -4.52264 204 | 592, -0.05775, -0.37562, -4.56194 205 | 593, -0.06247, -0.39207, -4.60105 206 | 594, -0.06746, -0.40900, -4.63998 207 | 595, -0.07271, -0.42637, -4.67871 208 | 596, -0.07823, -0.44417, -4.71725 209 | 597, -0.08401, -0.46240, -4.75559 210 | 598, -0.09001, -0.48107, -4.79373 211 | 599, -0.09622, -0.50020, -4.83167 212 | 600, -0.10261, -0.51981, -4.86941 213 | 601, -0.10916, -0.53990, -4.90694 214 | 602, -0.11593, -0.56045, -4.94426 215 | 603, -0.12295, -0.58145, -4.98137 216 | 604, -0.13029, -0.60287, -5.01827 217 | 605, -0.13801, -0.62468, -5.05496 218 | 606, -0.14613, -0.64686, -5.09143 219 | 607, -0.15465, -0.66939, -5.12769 220 | 608, -0.16354, -0.69227, -5.16373 221 | 609, -0.17277, -0.71546, -5.19955 222 | 610, -0.18231, -0.73896, -5.23514 223 | 611, -0.19215, -0.76275, -5.27052 224 | 612, -0.20228, -0.78684, -5.30568 225 | 613, -0.21273, -0.81124, -5.34061 226 | 614, -0.22350, -0.83597, -5.37532 227 | 615, -0.23461, -0.86103, -5.40980 228 | 616, -0.24607, -0.88645, 229 | 617, -0.25783, -0.91220, 230 | 618, -0.26982, -0.93830, 231 | 619, -0.28201, -0.96473, 232 | 620, -0.29432, -0.99150, 233 | 621, -0.30674, -1.01858, 234 | 622, -0.31939, -1.04596, 235 | 623, -0.33243, -1.07358, 236 | 624, -0.34601, -1.10142, 237 | 625, -0.36030, -1.12943, 238 | 626, -0.37542, -1.15759, 239 | 627, -0.39127, -1.18590, 240 | 628, -0.40776, -1.21441, 241 | 629, -0.42475, -1.24314, 242 | 630, -0.44212, -1.27212, 243 | 631, -0.45978, -1.30137, 244 | 632, -0.47769, -1.33086, 245 | 633, -0.49582, -1.36056, 246 | 634, -0.51416, -1.39045, 247 | 635, -0.53269, -1.42049, 248 | 636, -0.55139, -1.45068, 249 | 637, -0.57023, -1.48110, 250 | 638, -0.58918, -1.51185, 251 | 639, -0.60820, -1.54306, 252 | 640, -0.62726, -1.57482, 253 | 641, -0.64637, -1.60717, 254 | 642, -0.66566, -1.63988, 255 | 643, -0.68529, -1.67262, 256 | 644, -0.70542, -1.70510, 257 | 645, -0.72621, -1.73699, 258 | 646, -0.74780, -1.76809, 259 | 647, -0.77013, -1.79861, 260 | 648, -0.79311, -1.82889, 261 | 649, -0.81665, -1.85925, 262 | 650, -0.84067, -1.89000, 263 | 651, -0.86509, -1.92141, 264 | 652, -0.88985, -1.95344, 265 | 653, -0.91491, -1.98600, 266 | 654, -0.94025, -2.01900, 267 | 655, -0.96582, -2.05233, 268 | 656, -0.99158, -2.08591, 269 | 657, -1.01754, -2.11971, 270 | 658, -1.04369, -2.15368, 271 | 659, -1.07006, -2.18780, 272 | 660, -1.09663, -2.22203, 273 | 661, -1.12342, -2.25633, 274 | 662, -1.15043, -2.29061, 275 | 663, -1.17764, -2.32476, 276 | 664, -1.20506, -2.35868, 277 | 665, -1.23268, -2.39227, 278 | 666, -1.26050, -2.42545, 279 | 667, -1.28853, -2.45830, 280 | 668, -1.31676, -2.49092, 281 | 669, -1.34521, -2.52341, 282 | 670, -1.37388, -2.55589, 283 | 671, -1.40278, -2.58845, 284 | 672, -1.43191, -2.62108, 285 | 673, -1.46127, -2.65378, 286 | 674, -1.49089, -2.68655, 287 | 675, -1.52075, -2.71938, 288 | 676, -1.55087, -2.75226, 289 | 677, -1.58124, -2.78520, 290 | 678, -1.61183, -2.81818, 291 | 679, -1.64264, -2.85123, 292 | 680, -1.67365, -2.88433, 293 | 681, -1.70485, -2.91750, 294 | 682, -1.73631, -2.95079, 295 | 683, -1.76808, -2.98425, 296 | 684, -1.80024, -3.01795, 297 | 685, -1.83284, -3.05194, 298 | 686, -1.86590, -3.08623, 299 | 687, -1.89927, -3.12069, 300 | 688, -1.93274, -3.15516, 301 | 689, -1.96611, -3.18945, 302 | 690, -1.99917, -3.22339, 303 | 691, -2.03177, -3.25686, 304 | 692, -2.06399, -3.28991, 305 | 693, -2.09595, -3.32262, 306 | 694, -2.12779, -3.35508, 307 | 695, -2.15963, -3.38741, 308 | 696, -2.19157, -3.41966, 309 | 697, -2.22362, -3.45187, 310 | 698, -2.25573, -3.48405, 311 | 699, -2.28788, -3.51622, 312 | 700, -2.32004, -3.54839, 313 | 701, -2.35220, -3.58057, 314 | 702, -2.38440, -3.61281, 315 | 703, -2.41671, -3.64515, 316 | 704, -2.44920, -3.67763, 317 | 705, -2.48194, -3.71031, 318 | 706, -2.51497, -3.74321, 319 | 707, -2.54826, -3.77626, 320 | 708, -2.58174, -3.80941, 321 | 709, -2.61534, -3.84257, 322 | 710, -2.64902, -3.87567, 323 | 711, -2.68271, -3.90864, 324 | 712, -2.71635, -3.94146, 325 | 713, -2.74989, -3.97412, 326 | 714, -2.78329, -4.00660, 327 | 715, -2.81649, -4.03889, 328 | 716, -2.84945, -4.07097, 329 | 717, -2.88223, -4.10289, 330 | 718, -2.91489, -4.13469, 331 | 719, -2.94750, -4.16642, 332 | 720, -2.98012, -4.19812, 333 | 721, -3.01280, -4.22983, 334 | 722, -3.04551, -4.26151, 335 | 723, -3.07819, -4.29312, 336 | 724, -3.11077, -4.32461, 337 | 725, -3.14321, -4.35592, 338 | 726, -3.17547, -4.38704, 339 | 727, -3.20755, -4.41798, 340 | 728, -3.23951, -4.44878, 341 | 729, -3.27137, -4.47948, 342 | 730, -3.30318, -4.51014, 343 | 731, -3.33497, -4.54077, 344 | 732, -3.36677, -4.57140, 345 | 733, -3.39861, -4.60204, 346 | 734, -3.43052, -4.63269, 347 | 735, -3.46253, -4.66338, 348 | 736, -3.49464, -4.69408, 349 | 737, -3.52678, -4.72473, 350 | 738, -3.55883, -4.75522, 351 | 739, -3.59069, -4.78546, 352 | 740, -3.62227, -4.81534, 353 | 741, -3.65348, -4.84480, 354 | 742, -3.68442, -4.87394, 355 | 743, -3.71519, -4.90288, 356 | 744, -3.74590, -4.93176, 357 | 745, -3.77667, -4.96070, 358 | 746, -3.80758, -4.98981, 359 | 747, -3.83860, -5.01904, 360 | 748, -3.86965, -5.04833, 361 | 749, -3.90068, -5.07760, 362 | 750, -3.93161, -5.10679, 363 | 751, -3.96239, -5.13584, 364 | 752, -3.99302, -5.16474, 365 | 753, -4.02351, -5.19349, 366 | 754, -4.05387, -5.22209, 367 | 755, -4.08412, -5.25055, 368 | 756, -4.11426, -5.27886, 369 | 757, -4.14433, -5.30708, 370 | 758, -4.17435, -5.33524, 371 | 759, -4.20436, -5.36340, 372 | 760, -4.23438, -5.39159, 373 | 761, -4.26443, -5.41985, 374 | 762, -4.29447, -5.44814, 375 | 763, -4.32445, -5.47640, 376 | 764, -4.35431, -5.50458, 377 | 765, -4.38399, -5.53262, 378 | 766, -4.41348, -5.56049, 379 | 767, -4.44282, -5.58824, 380 | 768, -4.47210, -5.61594, 381 | 769, -4.50141, -5.64365, 382 | 770, -4.53081, -5.67146, 383 | 771, -4.56037, -5.69940, 384 | 772, -4.59000, -5.72740, 385 | 773, -4.61960, -5.75534, 386 | 774, -4.64907, -5.78314, 387 | 775, -4.67830, -5.81067, 388 | 776, -4.70721, -5.83787, 389 | 777, -4.73587, -5.86479, 390 | 778, -4.76433, -5.89151, 391 | 779, -4.79271, -5.91813, 392 | 780, -4.82106, -5.94471, 393 | 781, -4.84947, -5.97134, 394 | 782, -4.87791, -5.99800, 395 | 783, -4.90636, -6.02466, 396 | 784, -4.93478, -6.05128, 397 | 785, -4.96314, -6.07785, 398 | 786, -4.99142, -6.10433, 399 | 787, -5.01964, -6.13074, 400 | 788, -5.04780, -6.15710, 401 | 789, -5.07592, -6.18343, 402 | 790, -5.10404, -6.20974, 403 | 791, -5.13215, -6.23606, 404 | 792, -5.16024, -6.26233, 405 | 793, -5.18829, -6.28853, 406 | 794, -5.21625, -6.31461, 407 | 795, -5.24411, -6.34051, 408 | 796, -5.27185, -6.36622, 409 | 797, -5.29945, -6.39173, 410 | 798, -5.32693, -6.41707, 411 | 799, -5.35428, -6.44226, 412 | 800, -5.38150, -6.46732, 413 | 801, -5.40862, -6.49227, 414 | 802, -5.43566, -6.51716, 415 | 803, -5.46268, -6.54203, 416 | 804, -5.48972, -6.56693, 417 | 805, -5.51683, -6.59192, 418 | 806, -5.54404, -6.61701, 419 | 807, -5.57132, -6.64218, 420 | 808, -5.59861, -6.66736, 421 | 809, -5.62586, -6.69251, 422 | 810, -5.65303, -6.71758, 423 | 811, -5.68006, -6.74251, 424 | 812, -5.70694, -6.76731, 425 | 813, -5.73368, -6.79197, 426 | 814, -5.76026, -6.81650, 427 | 815, -5.78669, -6.84090, 428 | 816, -5.81296, -6.86518, 429 | 817, -5.83911, -6.88937, 430 | 818, -5.86518, -6.91353, 431 | 819, -5.89120, -6.93768, 432 | 820, -5.91722, -6.96187, 433 | 821, -5.94325, -6.98614, 434 | 822, -5.96929, -7.01048, 435 | 823, -5.99533, -7.03487, 436 | 824, -6.02135, -7.05929, 437 | 825, -6.04732, -7.08374, 438 | 826, -6.07324, -7.10819, 439 | 827, -6.09908, -7.13264, 440 | 828, -6.12483, -7.15706, 441 | 829, -6.15048, -7.18143, 442 | 830, -6.17600, -7.20576, 443 | -------------------------------------------------------------------------------- /astropysics/data/galaxy_lines.dat: -------------------------------------------------------------------------------- 1 | 912.00 Ly_limit 2 | 972.02 Ly_gamma 3 | 977.02 CIII_977 4 | 1025.72 Ly_beta 5 | 1032.00 OVI_1032 6 | 1038.00 OVI_1038 7 | 1175.80 CIII_1176 8 | 1190.42 SiII_1190 9 | 1193.29 SiII_1193 10 | 1199.97 NI_1200 11 | 1215.67 Ly_alpha 12 | 1238.82 NV_1239 13 | 1240.70 NV_1241 14 | 1253.81 SiII_1254 15 | 1259.52 SiII_1259 16 | 1260.42 SiII_1260 17 | 1264.74 SiII*_1265 18 | 1277.46 CI_1277 19 | 1294.54 (SiIIIs)_1295 20 | 1296.33 (CIIIs)_1296 21 | 1296.73 (SiIIIs)_1297 22 | 1302.17 OI_1302 23 | 1304.37 SiII_1304 24 | 1309.28 SiII*_1309 25 | 1317.22 NiII_1317 26 | 1323.93 (CIIs)_1324 27 | 1324.32 (NIIIs)_1324 28 | 1334.53 CII_1335 29 | 1335.71 CII*_1336 30 | 1343.35 (OIVs)_1343 31 | 1370.13 Ni_1370 32 | 1393.76 SiIV_1394 33 | 1402.77 SiIV_1403 34 | 1417.24 (SiIIIs)_1417 35 | 1427.85 (CIIIs)_1428 36 | 1486.50 NIV]_1486 37 | 1501.76 (SVs)_1502 38 | 1526.71 SiII_1527 39 | 1533.43 SiII*_1533 40 | 1548.20 CIV_1548 41 | 1550.77 CIV_1551 42 | 1608.45 FeII_1608 43 | 1640.40 HeII_1640 44 | 1661.00 OIII]_1661 45 | 1666.00 OIII]_1666 46 | 1670.79 AlII_1671 47 | 1709.60 NiII_1710 48 | 1718.55 (NIVs)_1719 49 | 1741.55 NiII_1742 50 | 1749.70 NIII]_1750 51 | 1751.91 NiII_1752 52 | 1808.01 SiII_1808 53 | 1854.72 AlIII_1855 54 | 1862.79 AlIII_1863 55 | 1909.00 [CIII]_1909 56 | 2382.80 FeII_2383 57 | 2344.20 FeII_2344 58 | 2586.70 FeII_2587 59 | 2600.20 FeII_2600 60 | 2796.35 MgII_2796 61 | 2800.00 MgII_doublet 62 | 2803.50 MgII_2804 63 | 2852.00 MgI_2852 64 | 2974.00 NeV_2974 65 | 3203.10 HeII_3203 66 | 3312.30 OIII_3312 67 | 3444.10 OIII_3444 68 | 3644.60 Balmer_limit 69 | 3727.55 [OII]_3727 70 | 3835.30 H_eta 71 | 3869.00 [NeIII]_3869 72 | 3889.10 H_zeta 73 | 3933.66 CaII_3934 74 | 3968.47 CaII_3969 75 | 3968.88 H_epsilon 76 | 4072.00 [SII]_4072 77 | 4101.74 H_delta 78 | 4305.00 G_band_4305 79 | 4340.46 H_gamma 80 | 4363.00 [OIII]_4363 81 | 4471.00 [HeI]_4471 82 | 4686.00 [HeII]_4686 83 | 4861.33 H_beta 84 | 4958.91 [OIII]_4959 85 | 5006.80 [OIII]_5007 86 | 5174.53 MgI_5175 87 | 5199.00 [NI]_5199 88 | 5648.00 [NII]_5648 89 | 5876.00 HeI_5876 90 | 5889.95 NaI_5890 91 | 5895.92 NaI_5896 92 | 6300.00 [OI]_6300 93 | 6312.00 [SIII]_6312 94 | 6364.00 [OI]_6364 95 | 6548.00 [NII]_6548 96 | 6562.82 H_alpha 97 | 6583.00 [NII]_6583 98 | 6678.00 HeI_6678 99 | 6717.00 [SII]_6717 100 | 6731.00 [SII]_6731 101 | 7065.00 HeI_7065 102 | 8498.0 CaII_8498(CaT) 103 | 8542.1 CaII_8542(CaT) 104 | 8662.2 CaII_8662(CaT) 105 | -------------------------------------------------------------------------------- /astropysics/data/iau00_cio_locator.tab: -------------------------------------------------------------------------------- 1 | Polynomial coefficients: 94.00e-6,3808.35e-6,-119.94e-6,-72574.09e-6,27.70e-6,15.61e-6 2 | 3 | #terms are l l' F D Om LVe LE pA sincoeff coscoeff 4 | 5 | 0th order: 6 | #0 7 | 0 0 0 0 1 0 0 0 -2640.73e-6 0.39e-6 8 | 0 0 0 0 2 0 0 0 -63.53e-6 0.02e-6 9 | 0 0 2 -2 3 0 0 0 -11.75e-6 -0.01e-6 10 | 0 0 2 -2 1 0 0 0 -11.21e-6 -0.01e-6 11 | 0 0 2 -2 2 0 0 0 4.57e-6 0.00e-6 12 | 0 0 2 0 3 0 0 0 -2.02e-6 0.00e-6 13 | 0 0 2 0 1 0 0 0 -1.98e-6 0.00e-6 14 | 0 0 0 0 3 0 0 0 1.72e-6 0.00e-6 15 | 0 1 0 0 1 0 0 0 1.41e-6 0.01e-6 16 | 0 1 0 0 -1 0 0 0 1.26e-6 0.01e-6 17 | 18 | 1 0 0 0 -1 0 0 0 0.63e-6 0.00e-6 19 | 1 0 0 0 1 0 0 0 0.63e-6 0.00e-6 20 | 0 1 2 -2 3 0 0 0 -0.46e-6 0.00e-6 21 | 0 1 2 -2 1 0 0 0 -0.45e-6 0.00e-6 22 | 0 0 4 -4 4 0 0 0 -0.36e-6 0.00e-6 23 | 0 0 1 -1 1 -8 12 0 0.24e-6 0.12e-6 24 | 0 0 2 0 0 0 0 0 -0.32e-6 0.00e-6 25 | 0 0 2 0 2 0 0 0 -0.28e-6 0.00e-6 26 | 1 0 2 0 3 0 0 0 -0.27e-6 0.00e-6 27 | 1 0 2 0 1 0 0 0 -0.26e-6 0.00e-6 28 | 29 | 0 0 2 -2 0 0 0 0 0.21e-6 0.00e-6 30 | 0 1 -2 2 -3 0 0 0 -0.19e-6 0.00e-6 31 | 0 1 -2 2 -1 0 0 0 -0.18e-6 0.00e-6 32 | 0 0 0 0 0 8 -13 -1 0.10e-6 -0.05e-6 33 | 0 0 0 2 0 0 0 0 -0.15e-6 0.00e-6 34 | 2 0 -2 0 -1 0 0 0 0.14e-6 0.00e-6 35 | 0 1 2 -2 2 0 0 0 0.14e-6 0.00e-6 36 | 1 0 0 -2 1 0 0 0 -0.14e-6 0.00e-6 37 | 1 0 0 -2 -1 0 0 0 -0.14e-6 0.00e-6 38 | 0 0 4 -2 4 0 0 0 -0.13e-6 0.00e-6 39 | 40 | 0 0 2 -2 4 0 0 0 0.11e-6 0.00e-6 41 | 1 0 -2 0 -3 0 0 0 -0.11e-6 0.00e-6 42 | #32 43 | 1 0 -2 0 -1 0 0 0 -0.11e-6 0.00e-6 44 | 45 | 1st order 46 | #33 47 | 0 0 0 0 2 0 0 0 -0.07e-6 3.57e-6 48 | 0 0 0 0 1 0 0 0 1.71e-6 -0.03e-6 49 | #35 50 | 0 0 2 -2 3 0 0 0 0.00e-6 0.48e-6 51 | 52 | 2nd order 53 | #36 54 | 0 0 0 0 1 0 0 0 743.53e-6 -0.17e-6 55 | 0 0 2 -2 2 0 0 0 56.91e-6 0.06e-6 56 | 0 0 2 0 2 0 0 0 9.84e-6 -0.01e-6 57 | 0 0 0 0 2 0 0 0 -8.85e-6 0.01e-6 58 | 0 1 0 0 0 0 0 0 -6.38e-6 -0.05e-6 59 | 1 0 0 0 0 0 0 0 -3.07e-6 0.00e-6 60 | 0 1 2 -2 2 0 0 0 2.23e-6 0.00e-6 61 | 0 0 2 0 1 0 0 0 1.67e-6 0.00e-6 62 | 1 0 2 0 2 0 0 0 1.30e-6 0.00e-6 63 | #45 64 | 0 1 -2 2 -2 0 0 0 0.93e-6 0.00e-6 65 | 66 | 1 0 0 -2 0 0 0 0 0.68e-6 0.00e-6 67 | 0 0 2 -2 1 0 0 0 -0.55e-6 0.00e-6 68 | 1 0 -2 0 -2 0 0 0 0.53e-6 0.00e-6 69 | 0 0 0 2 0 0 0 0 -0.27e-6 0.00e-6 70 | 1 0 0 0 1 0 0 0 -0.27e-6 0.00e-6 71 | 1 0 -2 -2 -2 0 0 0 -0.26e-6 0.00e-6 72 | 1 0 0 0 -1 0 0 0 -0.25e-6 0.00e-6 73 | 1 0 2 0 1 0 0 0 0.22e-6 0.00e-6 74 | 2 0 0 -2 0 0 0 0 -0.21e-6 0.00e-6 75 | #55 76 | 2 0 -2 0 -1 0 0 0 0.20e-6 0.00e-6 77 | 78 | 0 0 2 2 2 0 0 0 0.17e-6 0.00e-6 79 | 2 0 2 0 2 0 0 0 0.13e-6 0.00e-6 80 | 2 0 0 0 0 0 0 0 -0.13e-6 0.00e-6 81 | 1 0 2 -2 2 0 0 0 -0.12e-6 0.00e-6 82 | #60 83 | 0 0 2 0 0 0 0 0 -0.11e-6 0.00e-6 84 | 85 | 3rd order 86 | #61 87 | 0 0 0 0 1 0 0 0 0.30e-6 -23.51e-6 88 | 0 0 2 -2 2 0 0 0 -0.03e-6 -1.39e-6 89 | 0 0 2 0 2 0 0 0 -0.01e-6 -0.24e-6 90 | 0 0 0 0 2 0 0 0 0.00e-6 0.22e-6 91 | 92 | 4th order 93 | #65 94 | 0 0 0 0 1 0 0 0 -0.26e-6 -0.01e-6 95 | -------------------------------------------------------------------------------- /astropysics/data/iau00b_nutation.tab: -------------------------------------------------------------------------------- 1 | #l lprime F D Omega longitude_sin longitude_sin*t longitude_cos obliquity_cos obliquity_cos*t,obliquity_sin 2 | 3 | 0 0 0 0 1 -172064161.0 -174666.0 33386.0 92052331.0 9086.0 15377.0 4 | 0 0 2 -2 2 -13170906.0 -1675.0 -13696.0 5730336.0 -3015.0 -4587.0 5 | 0 0 2 0 2 -2276413.0 -234.0 2796.0 978459.0 -485.0 1374.0 6 | 0 0 0 0 2 2074554.0 207.0 -698.0 -897492.0 470.0 -291.0 7 | 0 1 0 0 0 1475877.0 -3633.0 11817.0 73871.0 -184.0 -1924.0 8 | 0 1 2 -2 2 -516821.0 1226.0 -524.0 224386.0 -677.0 -174.0 9 | 1 0 0 0 0 711159.0 73.0 -872.0 -6750.0 0.0 358.0 10 | 0 0 2 0 1 -387298.0 -367.0 380.0 200728.0 18.0 318.0 11 | 1 0 2 0 2 -301461.0 -36.0 816.0 129025.0 -63.0 367.0 12 | 0 -1 2 -2 2 215829.0 -494.0 111.0 -95929.0 299.0 132.0 13 | 0 0 2 -2 1 128227.0 137.0 181.0 -68982.0 -9.0 39.0 14 | -1 0 2 0 2 123457.0 11.0 19.0 -53311.0 32.0 -4.0 15 | -1 0 0 2 0 156994.0 10.0 -168.0 -1235.0 0.0 82.0 16 | 1 0 0 0 1 63110.0 63.0 27.0 -33228.0 0.0 -9.0 17 | -1 0 0 0 1 -57976.0 -63.0 -189.0 31429.0 0.0 -75.0 18 | -1 0 2 2 2 -59641.0 -11.0 149.0 25543.0 -11.0 66.0 19 | 1 0 2 0 1 -51613.0 -42.0 129.0 26366.0 0.0 78.0 20 | -2 0 2 0 1 45893.0 50.0 31.0 -24236.0 -10.0 20.0 21 | 0 0 0 2 0 63384.0 11.0 -150.0 -1220.0 0.0 29.0 22 | 0 0 2 2 2 -38571.0 -1.0 158.0 16452.0 -11.0 68.0 23 | 0 -2 2 -2 2 32481.0 0.0 0.0 -13870.0 0.0 0.0 24 | -2 0 0 2 0 -47722.0 0.0 -18.0 477.0 0.0 -25.0 25 | 2 0 2 0 2 -31046.0 -1.0 131.0 13238.0 -11.0 59.0 26 | 1 0 2 -2 2 28593.0 0.0 -1.0 -12338.0 10.0 -3.0 27 | -1 0 2 0 1 20441.0 21.0 10.0 -10758.0 0.0 -3.0 28 | 2 0 0 0 0 29243.0 0.0 -74.0 -609.0 0.0 13.0 29 | 0 0 2 0 0 25887.0 0.0 -66.0 -550.0 0.0 11.0 30 | 0 1 0 0 1 -14053.0 -25.0 79.0 8551.0 -2.0 -45.0 31 | -1 0 0 2 1 15164.0 10.0 11.0 -8001.0 0.0 -1.0 32 | 0 2 2 -2 2 -15794.0 72.0 -16.0 6850.0 -42.0 -5.0 33 | 0 0 -2 2 0 21783.0 0.0 13.0 -167.0 0.0 13.0 34 | 1 0 0 -2 1 -12873.0 -10.0 -37.0 6953.0 0.0 -14.0 35 | 0 -1 0 0 1 -12654.0 11.0 63.0 6415.0 0.0 26.0 36 | -1 0 2 2 1 -10204.0 0.0 25.0 5222.0 0.0 15.0 37 | 0 2 0 0 0 16707.0 -85.0 -10.0 168.0 -1.0 10.0 38 | 1 0 2 2 2 -7691.0 0.0 44.0 3268.0 0.0 19.0 39 | -2 0 2 0 0 -11024.0 0.0 -14.0 104.0 0.0 2.0 40 | 0 1 2 0 2 7566.0 -21.0 -11.0 -3250.0 0.0 -5.0 41 | 0 0 2 2 1 -6637.0 -11.0 25.0 3353.0 0.0 14.0 42 | 0 -1 2 0 2 -7141.0 21.0 8.0 3070.0 0.0 4.0 43 | 0 0 0 2 1 -6302.0 -11.0 2.0 3272.0 0.0 4.0 44 | 1 0 2 -2 1 5800.0 10.0 2.0 -3045.0 0.0 -1.0 45 | 2 0 2 -2 2 6443.0 0.0 -7.0 -2768.0 0.0 -4.0 46 | -2 0 0 2 1 -5774.0 -11.0 -15.0 3041.0 0.0 -5.0 47 | 2 0 2 0 1 -5350.0 0.0 21.0 2695.0 0.0 12.0 48 | 0 -1 2 -2 1 -4752.0 -11.0 -3.0 2719.0 0.0 -3.0 49 | 0 0 0 -2 1 -4940.0 -11.0 -21.0 2720.0 0.0 -9.0 50 | -1 -1 0 2 0 7350.0 0.0 -8.0 -51.0 0.0 4.0 51 | 2 0 0 -2 1 4065.0 0.0 6.0 -2206.0 0.0 1.0 52 | 1 0 0 2 0 6579.0 0.0 -24.0 -199.0 0.0 2.0 53 | 0 1 2 -2 1 3579.0 0.0 5.0 -1900.0 0.0 1.0 54 | 1 -1 0 0 0 4725.0 0.0 -6.0 -41.0 0.0 3.0 55 | -2 0 2 0 2 -3075.0 0.0 -2.0 1313.0 0.0 -1.0 56 | 3 0 2 0 2 -2904.0 0.0 15.0 1233.0 0.0 7.0 57 | 0 -1 0 2 0 4348.0 0.0 -10.0 -81.0 0.0 2.0 58 | 1 -1 2 0 2 -2878.0 0.0 8.0 1232.0 0.0 4.0 59 | 0 0 0 1 0 -4230.0 0.0 5.0 -20.0 0.0 -2.0 60 | -1 -1 2 2 2 -2819.0 0.0 7.0 1207.0 0.0 3.0 61 | -1 0 2 0 0 -4056.0 0.0 5.0 40.0 0.0 -2.0 62 | 0 -1 2 2 2 -2647.0 0.0 11.0 1129.0 0.0 5.0 63 | -2 0 0 0 1 -2294.0 0.0 -10.0 1266.0 0.0 -4.0 64 | 1 1 2 0 2 2481.0 0.0 -7.0 -1062.0 0.0 -3.0 65 | 2 0 0 0 1 2179.0 0.0 -2.0 -1129.0 0.0 -2.0 66 | -1 1 0 1 0 3276.0 0.0 1.0 -9.0 0.0 0.0 67 | 1 1 0 0 0 -3389.0 0.0 5.0 35.0 0.0 -2.0 68 | 1 0 2 0 0 3339.0 0.0 -13.0 -107.0 0.0 1.0 69 | -1 0 2 -2 1 -1987.0 0.0 -6.0 1073.0 0.0 -2.0 70 | 1 0 0 0 2 -1981.0 0.0 0.0 854.0 0.0 0.0 71 | -1 0 0 1 0 4026.0 0.0 -353.0 -553.0 0.0 -139.0 72 | 0 0 2 1 2 1660.0 0.0 -5.0 -710.0 0.0 -2.0 73 | -1 0 2 4 2 -1521.0 0.0 9.0 647.0 0.0 4.0 74 | -1 1 0 1 1 1314.0 0.0 0.0 -700.0 0.0 0.0 75 | 0 -2 2 -2 1 -1283.0 0.0 0.0 672.0 0.0 0.0 76 | 1 0 2 2 1 -1331.0 0.0 8.0 663.0 0.0 4.0 77 | -2 0 2 2 2 1383.0 0.0 -2.0 -594.0 0.0 -2.0 78 | -1 0 0 0 2 1405.0 0.0 4.0 -610.0 0.0 2.0 79 | 1 1 2 -2 2 1290.0 0.0 0.0 -556.0 0.0 0.0 80 | 81 | -------------------------------------------------------------------------------- /astropysics/data/ipy_profile_astpys.py: -------------------------------------------------------------------------------- 1 | """ 2 | The astropysics interactive IPython configuration file for ipython versions < .11 3 | """ 4 | 5 | import IPython.ipapi 6 | #this is only necessary if ipythonrc isn't in use, so if it is, this import can be commented out 7 | import ipy_defaults 8 | 9 | ip = IPython.ipapi.get() 10 | 11 | ip.ex("from __future__ import division") 12 | ip.ex("import numpy") 13 | ip.ex("import numpy as np") 14 | ip.ex("from numpy import *") 15 | ip.ex("from numpy.random import rand,randn,randint") 16 | 17 | ip.ex("import scipy") 18 | ip.ex("from scipy import stats,optimize,ndimage,integrate,interpolate,special") 19 | 20 | #import pyfits and asciitable if they are present 21 | try: 22 | ip.ex("import pyfits") 23 | except ImportError: 24 | pass 25 | try: 26 | ip.ex("import asciitable") 27 | except ImportError: 28 | pass 29 | 30 | try: 31 | ip.ex("import astropysics") 32 | #import typical modules 33 | ip.ex("from astropysics import phot,spec,coords,models,constants,objcat,obstools,plotting,utils") 34 | try: 35 | ip.ex("from astropysics import gui") 36 | except ImportError: 37 | pass #this just means traits isn't installed 38 | except ImportError: 39 | print "Unable to start astropysics profile, try re-running astpys-setup (or re-installing astropysics)" 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /astropysics/data/ipython_config_astpys.py: -------------------------------------------------------------------------------- 1 | """ 2 | The astropysics interactive IPython configuration file for ipython versions >=0.11 3 | """ 4 | 5 | load_subconfig('ipython_config.py') 6 | c = get_config() 7 | 8 | lines = """ 9 | import numpy 10 | import numpy as np 11 | from numpy import * 12 | from numpy.random import rand,randn,randint 13 | 14 | import scipy 15 | from scipy import stats,optimize,ndimage,integrate,interpolate,special 16 | 17 | try: 18 | import astropysics 19 | from astropysics import phot,spec,coords,models,constants,objcat,obstools,plotting,utils 20 | except ImportError: 21 | print "Unable to start astropysics profile, try re-running astpys-setup (or re-installing astropysics)" 22 | 23 | #silently ignore pyfits and asciitable if they are not present,as they are optional 24 | try: 25 | import pyfits 26 | except ImportError: 27 | pass 28 | try: 29 | import asciitable 30 | except ImportError: 31 | pass 32 | 33 | """ 34 | 35 | mpllines = """ 36 | import matplotlib 37 | matplotlib.interactive(True) 38 | matplotlib.use('{MPLBACK}') 39 | guiapp = %gui {GUITK} 40 | from matplotlib import pyplot as plt 41 | from matplotlib.pyplot import * 42 | """ 43 | 44 | c.Global.exec_lines.append(mpllines) 45 | c.Global.exec_lines.append(lines) 46 | 47 | 48 | -------------------------------------------------------------------------------- /astropysics/data/obsdb.dat: -------------------------------------------------------------------------------- 1 | # this file originally came from IRAF (iraf.noao.edu) 2 | # 3 | # Observatory Parameters. Taken from the Almanac. 4 | # 5 | # Extras in this version from http://tdc-www.harvard.edu/iraf/rvsao/bcvcorr/obsdb.html 6 | # 7 | # Observatories wishing to be added or make changes in the default 8 | # distributed database should send information to iraf@noao.edu. 9 | 10 | observatory = "kpno" 11 | name = "Kitt Peak National Observatory" 12 | longitude = 111:36.0 13 | latitude = 31:57.8 14 | altitude = 2120. 15 | timezone = 7 16 | 17 | observatory = "ctio" 18 | name = "Cerro Tololo Interamerican Observatory" 19 | longitude = 70.815 20 | latitude = -30.16527778 21 | altitude = 2215. 22 | timezone = 4 23 | 24 | observatory = "eso" 25 | name = "European Southern Observatory" 26 | longitude = 70:43.8 27 | latitude = -29:15.4 28 | altitude = 2347 29 | timezone = 4 30 | 31 | observatory = "lick" 32 | name = "Lick Observatory" 33 | longitude = 121:38.2 34 | latitude = 37:20.6 35 | altitude = 1290 36 | timezone = 8 37 | 38 | observatory = "mmto" 39 | name = "Multiple Mirror Telescope Observatory" 40 | longitude = 110:53.1 41 | latitude = 31:41.3 42 | altitude = 2600 43 | timezone = 7 44 | 45 | observatory = "mmt" 46 | name = "Whipple Observatory" 47 | longitude = 110:53.1 48 | latitude = 31:41.3 49 | altitude = 2608 50 | timezone = 7 51 | 52 | observatory = "flwo" 53 | name = "Whipple Observatory" 54 | longitude = 110:52:39 55 | latitude = 31:40:51.4 56 | altitude = 2320 57 | timezone = 7 58 | 59 | observatory = "cfht" 60 | name = "Canada-France-Hawaii Telescope" 61 | longitude = 155:28.3 62 | latitude = 19:49.6 63 | altitude = 4215 64 | timezone = 10 65 | 66 | observatory = "lapalma" 67 | name = "Roque de los Muchachos, La Palma" 68 | longitude = 17:52.8 69 | latitude = 28:45.5 70 | altitude = 2327 71 | timezone = 0 72 | 73 | observatory = "mso" 74 | name = "Mt. Stromlo Observatory" 75 | longitude = 210:58:32.4 76 | latitude = -35:19:14.34 77 | altitude = 767 78 | timezone = -10 79 | 80 | observatory = "sso" 81 | name = "Siding Spring Observatory" 82 | longitude = 210:56:19.70 83 | latitude = -31:16:24.10 84 | altitude = 1149 85 | timezone = -10 86 | 87 | observatory = "aao" 88 | name = "Anglo-Australian Observatory" 89 | longitude = 210:56:2.09 90 | latitude = -31:16:37.34 91 | altitude = 1164 92 | timezone = -10 93 | 94 | observatory = "mcdonald" 95 | name = "McDonald Observatory" 96 | longitude = 104.0216667 97 | latitude = 30.6716667 98 | altitude = 2075 99 | timezone = 6 100 | 101 | observatory = "lco" 102 | name = "Las Campanas Observatory" 103 | longitude = 70:42.1 104 | latitude = -29:0.2 105 | altitude = 2282 106 | timezone = 4 107 | 108 | # Submitted by Alan Koski 1/13/93 109 | observatory = "mtbigelow" 110 | name = "Catalina Observatory: 61 inch telescope" 111 | longitude = 110:43.9 112 | latitude = 32:25.0 113 | altitude = 2510. 114 | timezone = 7 115 | 116 | # Revised by Daniel Durand 2/23/93 117 | observatory = "dao" 118 | name = "Dominion Astrophysical Observatory" 119 | longitude = 123:25.0 120 | latitude = 48:31.3 121 | altitude = 229 122 | timezone = 8 123 | 124 | # Submitted by Patrick Vielle 5/4/93 125 | observatory = "spm" 126 | name = "Observatorio Astronomico Nacional, San Pedro Martir" 127 | longitude = 115:29:13 128 | latitude = 31:01:45 129 | altitude = 2830 130 | timezone = 7 131 | 132 | # Submitted by Patrick Vielle 5/4/93 133 | observatory = "tona" 134 | name = "Observatorio Astronomico Nacional, Tonantzintla" 135 | longitude = 98:18:50 136 | latitude = 19:01:58 137 | timezone = 8 138 | 139 | # Submitted by Don Hamilton 8/18/93 140 | observatory = "Palomar" 141 | name = "The Hale Telescope" 142 | longitude = 116:51:46.80 143 | latitude = 33:21:21.6 144 | altitude = 1706. 145 | timezone = 8 146 | 147 | # Submitted by Pat Seitzer 10/31/93 148 | observatory = "mdm" 149 | name = "Michigan-Dartmouth-MIT Observatory" 150 | longitude = 111:37.0 151 | latitude = 31:57.0 152 | altitude = 1938.5 153 | timezone = 7 154 | 155 | # Submitted by Ignacio Ferrin 9/1/94 156 | observatory = "NOV" 157 | name = "National Observatory of Venezuela" 158 | longitude = 70:52.0 159 | latitude = 8:47.4 160 | altitude = 3610 161 | timezone = 4 162 | 163 | # Submitted by Alan Welty 10/28/94 164 | observatory = "bmo" 165 | name = "Black Moshannon Observatory" 166 | longitude = 78:00.3 167 | latitude = 40:55.3 168 | altitude = 738 169 | timezone = 5 170 | 171 | # Submitted by Biwei JIANG 11/28/95 172 | observatory = "BAO" 173 | name = "Beijing XingLong Observatory" 174 | longitude = 242:25.5 175 | latitude = 40:23.6 176 | altitude = 950. 177 | timezone = -8 178 | 179 | # From Astronomical Almanac 1996 180 | observatory = "keck" 181 | name = "W. M. Keck Observatory" 182 | longitude = 155:28.7 183 | latitude = 19:49.7 184 | altitude = 4160 185 | timezone = 10 186 | 187 | # Padova Astronomical Observatory, Asiago, Italy. 188 | # Submitted by Lina Tomasella 6/11/96 189 | observatory = "ekar" 190 | name = "Mt. Ekar 182 cm. Telescope" 191 | longitude = 348:25:07.92 192 | latitude = 45:50:54.92 193 | altitude = 1413.69 194 | timezone = -1 195 | 196 | # Submitted by Michael Ledlow 8/8/96 197 | observatory = "apo" 198 | name = "Apache Point Observatory" 199 | longitude = 105:49.2 200 | latitude = 32:46.8 201 | altitude = 2798. 202 | timezone = 7 203 | 204 | # Submitted by Michael Ledlow 8/8/96 205 | observatory = "lowell" 206 | name = "Lowell Observatory" 207 | longitude = 111:32.1 208 | latitude = 35:05.8 209 | altitude = 2198. 210 | timezone = 7 211 | 212 | # Submitted by S.G. Bhargavi 8/12/96 213 | observatory = "vbo" 214 | name = "Vainu Bappu Observatory" 215 | longitude = 281.1734 216 | latitude = 12.57666 217 | altitude = 725. 218 | timezone = -5.5 219 | -------------------------------------------------------------------------------- /astropysics/data/ss_elems_1.dat: -------------------------------------------------------------------------------- 1 | #===================================================================== 2 | # These data are to be used as described in the related document 3 | # titled "Keplerian Elements for Approximate Positions of the 4 | # Major Planets" by E.M. Standish (JPL/Caltech) available from 5 | # the JPL Solar System Dynamics web site (http://ssd.jpl.nasa.gov/). 6 | #===================================================================== 7 | 8 | 9 | #Table 1. 10 | 11 | #Keplerian elements and their rates, with respect to the mean ecliptic 12 | #and equinox of J2000, valid for the time-interval 1800 AD - 2050 AD. 13 | 14 | 15 | # a e I L long.peri. long.node. 16 | # AU, AU/Cy rad, rad/Cy deg, deg/Cy deg, deg/Cy deg, deg/Cy deg, deg/Cy 17 | #----------------------------------------------------------------------------------------------------------- 18 | Mercury 0.38709927 0.20563593 7.00497902 252.25032350 77.45779628 48.33076593 19 | 0.00000037 0.00001906 -0.00594749 149472.67411175 0.16047689 -0.12534081 20 | Venus 0.72333566 0.00677672 3.39467605 181.97909950 131.60246718 76.67984255 21 | 0.00000390 -0.00004107 -0.00078890 58517.81538729 0.00268329 -0.27769418 22 | EM Bary 1.00000261 0.01671123 -0.00001531 100.46457166 102.93768193 0.0 23 | 0.00000562 -0.00004392 -0.01294668 35999.37244981 0.32327364 0.0 24 | Mars 1.52371034 0.09339410 1.84969142 -4.55343205 -23.94362959 49.55953891 25 | 0.00001847 0.00007882 -0.00813131 19140.30268499 0.44441088 -0.29257343 26 | Jupiter 5.20288700 0.04838624 1.30439695 34.39644051 14.72847983 100.47390909 27 | -0.00011607 -0.00013253 -0.00183714 3034.74612775 0.21252668 0.20469106 28 | Saturn 9.53667594 0.05386179 2.48599187 49.95424423 92.59887831 113.66242448 29 | -0.00125060 -0.00050991 0.00193609 1222.49362201 -0.41897216 -0.28867794 30 | Uranus 19.18916464 0.04725744 0.77263783 313.23810451 170.95427630 74.01692503 31 | -0.00196176 -0.00004397 -0.00242939 428.48202785 0.40805281 0.04240589 32 | Neptune 30.06992276 0.00859048 1.77004347 -55.12002969 44.96476227 131.78422574 33 | 0.00026291 0.00005105 0.00035372 218.45945325 -0.32241464 -0.00508664 34 | Pluto 39.48211675 0.24882730 17.14001206 238.92903833 224.06891629 110.30393684 35 | -0.00031596 0.00005170 0.00004818 145.20780515 -0.04062942 -0.01183482 36 | -------------------------------------------------------------------------------- /astropysics/data/ss_elems_2.dat: -------------------------------------------------------------------------------- 1 | #===================================================================== 2 | # These data are to be used as described in the related document 3 | # titled "Keplerian Elements for Approximate Positions of the 4 | # Major Planets" by E.M. Standish (JPL/Caltech) available from 5 | # the JPL Solar System Dynamics web site (http://ssd.jpl.nasa.gov/). 6 | #===================================================================== 7 | 8 | 9 | #Table 2a. 10 | 11 | #Keplerian elements and their rates, with respect to the mean ecliptic and equinox of J2000, 12 | #valid for the time-interval 3000 BC -- 3000 AD. NOTE: the computation of M for Jupiter through 13 | #Pluto *must* be augmented by the additional terms given in Table 2b (below). 14 | 15 | # a e I L long.peri. long.node. 16 | # AU, AU/Cy rad, rad/Cy deg, deg/Cy deg, deg/Cy deg, deg/Cy deg, deg/Cy 17 | #------------------------------------------------------------------------------------------------------ 18 | Mercury 0.38709843 0.20563661 7.00559432 252.25166724 77.45771895 48.33961819 19 | 0.00000000 0.00002123 -0.00590158 149472.67486623 0.15940013 -0.12214182 20 | Venus 0.72332102 0.00676399 3.39777545 181.97970850 131.76755713 76.67261496 21 | -0.00000026 -0.00005107 0.00043494 58517.81560260 0.05679648 -0.27274174 22 | EM Bary 1.00000018 0.01673163 -0.00054346 100.46691572 102.93005885 -5.11260389 23 | -0.00000003 -0.00003661 -0.01337178 35999.37306329 0.31795260 -0.24123856 24 | Mars 1.52371243 0.09336511 1.85181869 -4.56813164 -23.91744784 49.71320984 25 | 0.00000097 0.00009149 -0.00724757 19140.29934243 0.45223625 -0.26852431 26 | Jupiter 5.20248019 0.04853590 1.29861416 34.33479152 14.27495244 100.29282654 27 | -0.00002864 0.00018026 -0.00322699 3034.90371757 0.18199196 0.13024619 28 | Saturn 9.54149883 0.05550825 2.49424102 50.07571329 92.86136063 113.63998702 29 | -0.00003065 -0.00032044 0.00451969 1222.11494724 0.54179478 -0.25015002 30 | Uranus 19.18797948 0.04685740 0.77298127 314.20276625 172.43404441 73.96250215 31 | -0.00020455 -0.00001550 -0.00180155 428.49512595 0.09266985 0.05739699 32 | Neptune 30.06952752 0.00895439 1.77005520 304.22289287 46.68158724 131.78635853 33 | 0.00006447 0.00000818 0.00022400 218.46515314 0.01009938 -0.00606302 34 | Pluto 39.48686035 0.24885238 17.14104260 238.96535011 224.09702598 110.30167986 35 | 0.00449751 0.00006016 0.00000501 145.18042903 -0.00968827 -0.00809981 36 | #----------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------- /astropysics/data/ss_elems_2b.dat: -------------------------------------------------------------------------------- 1 | #===================================================================== 2 | # These data are to be used as described in the related document 3 | # titled "Keplerian Elements for Approximate Positions of the 4 | # Major Planets" by E.M. Standish (JPL/Caltech) available from 5 | # the JPL Solar System Dynamics web site (http://ssd.jpl.nasa.gov/). 6 | #===================================================================== 7 | 8 | 9 | 10 | #Table 2b. 11 | # 12 | #Additional terms which must be added to the computation of M 13 | #for Jupiter through Pluto, 3000 BC to 3000 AD, as described 14 | #in the related document. 15 | # 16 | # b c s f 17 | #--------------------------------------------------------------- 18 | Jupiter -0.00012452 0.06064060 -0.35635438 38.35125000 19 | Saturn 0.00025899 -0.13434469 0.87320147 38.35125000 20 | Uranus 0.00058331 -0.97731848 0.17689245 7.67025000 21 | Neptune -0.00041348 0.68346318 -0.10162547 7.67025000 22 | Pluto -0.01262724 23 | #--------------------------------------------------------------- 24 | 25 | -------------------------------------------------------------------------------- /astropysics/data/stellar_lines.dat: -------------------------------------------------------------------------------- 1 | 6562.82 H_alpha 2 | 4861.3 H_beta 3 | 4341. H_gamma 4 | 4102. H_delta 5 | 3968.5 H_eps 6 | 8183.25 NaI_a 7 | 8194.79 NaI_b 8 | 8498.0 CaII_a 9 | 8542.1 CaII_b 10 | 8662.2 CaII_c 11 | 12 | -------------------------------------------------------------------------------- /astropysics/data/vega_k93.fits.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eteq/astropysics/3d8fa228f84700d5e45e4a5273b88f4e2d3dd5c7/astropysics/data/vega_k93.fits.gz -------------------------------------------------------------------------------- /astropysics/data/vega_k93.pydict: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eteq/astropysics/3d8fa228f84700d5e45e4a5273b88f4e2d3dd5c7/astropysics/data/vega_k93.pydict -------------------------------------------------------------------------------- /astropysics/data/washingtonbands.dat: -------------------------------------------------------------------------------- 1 | #Source: Bessell 2001 PASP 113,779,66-71 2 | 3 | Band C 4 | 300 0.000 5 | 310 0.030 6 | 320 0.157 7 | 330 0.364 8 | 340 0.591 9 | 350 0.762 10 | 360 0.860 11 | 370 0.935 12 | 380 0.984 13 | 390 1.004 14 | 400 0.987 15 | 410 0.920 16 | 420 0.819 17 | 430 0.682 18 | 440 0.542 19 | 450 0.366 20 | 460 0.168 21 | 470 0.049 22 | 480 0.000 23 | 24 | Band M 25 | 430 0.000 26 | 440 0.015 27 | 450 0.158 28 | 460 0.448 29 | 470 0.708 30 | 480 0.866 31 | 490 0.950 32 | 500 0.993 33 | 510 0.996 34 | 520 0.944 35 | 530 0.886 36 | 540 0.800 37 | 550 0.682 38 | 560 0.518 39 | 570 0.339 40 | 580 0.190 41 | 590 0.084 42 | 600 0.016 43 | 610 0.000 44 | 45 | Band T1 46 | 560 0.000 47 | 570 0.037 48 | 580 0.103 49 | 590 0.197 50 | 600 0.663 51 | 610 0.968 52 | 620 1.011 53 | 630 0.937 54 | 640 0.842 55 | 650 0.744 56 | 660 0.656 57 | 670 0.556 58 | 680 0.448 59 | 690 0.359 60 | 700 0.291 61 | 710 0.241 62 | 720 0.164 63 | 730 0.118 64 | 740 0.069 65 | 750 0.042 66 | 760 0.024 67 | 770 0.000 68 | 69 | Band T2 70 | 720 0.000 71 | 730 0.130 72 | 740 0.540 73 | 750 0.698 74 | 760 0.803 75 | 770 0.875 76 | 780 0.911 77 | 790 0.932 78 | 800 0.954 79 | 810 0.975 80 | 820 0.987 81 | 830 0.999 82 | 840 0.999 83 | 850 0.979 84 | 860 0.945 85 | 870 0.844 86 | 880 0.620 87 | 890 0.000 88 | 89 | 90 | -------------------------------------------------------------------------------- /astropysics/external/__init__.py: -------------------------------------------------------------------------------- 1 | #Copyright 2010 Erik Tollerud 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | """ 16 | This package contains small external packages that are included with astropysics 17 | to simplify installation. Currently, this includes: 18 | 19 | * ConfigObj v4.7.2 (http://www.voidspace.org.uk/python/configobj.html) 20 | 21 | """ 22 | 23 | def setup_module(module): 24 | """ 25 | Used by doctests 26 | """ 27 | from nose.plugins.skip import SkipTest 28 | raise SkipTest('Skipping tests for external modules/packages') -------------------------------------------------------------------------------- /astropysics/gui/__init__.py: -------------------------------------------------------------------------------- 1 | #Copyright 2009 Erik Tollerud 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | """ 16 | This module contains GUI applications, elements, and adapters for various 17 | parts of astropysics. 18 | 19 | Note that this module makes heavy use of Enthought Traits and TraitsGUI 20 | (http://code.enthought.com/projects/traits/) -- if it is not installed, 21 | nearly everything in this package will raise an exception. 22 | 23 | GUI tools (each in their own modules): 24 | 25 | * spectarget: a tool for making slitmasks from fiducial CMDs and photometric 26 | catalogs. Currently only has direct support for Keck/DEIMOS 27 | * spylot: spectrum plotter 28 | 29 | Convinence functions for launching the apps and the primary application classes 30 | are also aliased in this module for ease of use. This also includes the 31 | :func:`pymodelfit.fitgui.fit_data` function, used for launching the FitGUI 32 | interactive curve-fitter. 33 | 34 | """ 35 | try: 36 | from spectarget import spec_target,SpecTarget 37 | from pymodelfit.fitgui import fit_data 38 | from spylot import spylot_specs,Spylot 39 | except ImportError,e: 40 | if 'traits' in e.message: 41 | from warnings import warn 42 | warn('Traits or Traits GUI not installed! most of gui module will be unuseable') 43 | else: 44 | raise 45 | 46 | #Use lines below as imports for new gui apps 47 | #from __future__ import division 48 | #from enthought.traits.api import HasTraits 49 | #from enthought.traits.ui.api import View 50 | 51 | -------------------------------------------------------------------------------- /astropysics/sphinxext/__init__.py: -------------------------------------------------------------------------------- 1 | #Copyright 2011 Erik Tollerud 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | """ 16 | ========================================================== 17 | sphinext -- extentensions for sphinx documentation builder 18 | ========================================================== 19 | 20 | This module contains various extensions for the `sphinx 21 | ` documentation building tool. These extensions are 22 | used to build the astropysics sphinx documentation, although they can be used 23 | elsewhere simply by including ``astropysics.sphinxext.`` in the 24 | extensions list in a project's ``conf.py``. 25 | """ -------------------------------------------------------------------------------- /astropysics/sphinxext/todomod.py: -------------------------------------------------------------------------------- 1 | #Copyright 2011 Erik Tollerud 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | """ 16 | The todomod sphinx extension adds the `todomodule` directive which will show all 17 | the ``todo`` directives in a given module all in one place in the sphinx 18 | documentation. Like the :mod:`sphinx.ext.todo` extension, it will not be shown 19 | for non-release versions. 20 | """ 21 | 22 | from sphinx.ext.todo import Todo,todo_node,nodes 23 | from sphinx.pycode import ModuleAnalyzer,PycodeError 24 | 25 | 26 | class TodoModule(Todo): 27 | required_arguments = 1 28 | has_content = True 29 | 30 | def run(self): 31 | try: 32 | modfn = ModuleAnalyzer.for_module(self.arguments[0]).srcname 33 | except PycodeError,e: 34 | warnstr = "can't find module %s for todomodule: %s"%(self.arguments[0],e) 35 | return [self.state.document.reporter.warning(warnstr,lineno=self.lineno)] 36 | 37 | todolines = [] 38 | with open(modfn) as f: 39 | for l in f: 40 | if l.startswith('#TODO'): 41 | todolines.append(l) 42 | 43 | todoreses = [] 44 | for tl in todolines: 45 | text = tl.replace('#TODO:','').replace('#TODO','').strip() 46 | env = self.state.document.settings.env 47 | 48 | targetid = "todo-%s" % env.index_num 49 | env.index_num += 1 50 | targetnode = nodes.target('', '', ids=[targetid]) 51 | 52 | td_node = todo_node(text) 53 | 54 | title_text = _('Module Todo') 55 | textnodes, messages = self.state.inline_text(title_text, self.lineno) 56 | td_node += nodes.title(title_text, '', *textnodes) 57 | td_node += messages 58 | if 'class' in self.options: 59 | classes = self.options['class'] 60 | else: 61 | classes = ['admonition-' + nodes.make_id(title_text)] 62 | td_node['classes'] += classes 63 | 64 | td_node.append(nodes.paragraph(text,text)) 65 | td_node.line = self.lineno 66 | 67 | todoreses.append(targetnode) 68 | todoreses.append(td_node) 69 | return todoreses 70 | 71 | 72 | def setup(app): 73 | app.add_directive('todomodule', TodoModule) #add this directive to document TODO comments in the root of the module 74 | -------------------------------------------------------------------------------- /astropysics/utils/__init__.py: -------------------------------------------------------------------------------- 1 | #Copyright 2010 Erik Tollerud 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | """ 16 | ====================================== 17 | utils -- utility classes and functions 18 | ====================================== 19 | 20 | Overview 21 | -------- 22 | 23 | The :mod:`utils` module contains classes and funtions of general utility used in 24 | multiple places throughout `astropysics`. Some of these are 25 | astropyhysics-specific algorithms while others are more python tricks. 26 | 27 | The :mod:`~astropysics.utils` module is composed of three submodules to make 28 | organization clearer. The submodules are fairly different from each other, but 29 | the main uniting theme is that all of these submodules are not specific to a 30 | particularly astronomical application. Hence, they are available for re-use in 31 | astropysics or anywhere else they are deemed useful. The detailed documentation 32 | for each of the sub-modules is described below. 33 | 34 | .. note:: 35 | 36 | The :mod:`~astropysics.utils` module is composed of submodules that can be 37 | accessed seperately. However, they are all also included in the base module. 38 | Thus, as an example, ``astropysics.utils.gen.DataObjectRegistry`` and 39 | ``astropysics.utils.DataObjectRegistry`` are different names for the same 40 | class (:class:`~astropysics.utils.gen.DataObjectRegistry`). The 41 | ``astropysics.utils.DataObjectRegistry`` usage is preferred as this allows 42 | the internal organization to be changed if it is deemed necessary. 43 | 44 | 45 | 46 | utils.gen -- general-purpose (python-specific) utilities 47 | -------------------------------------------------------- 48 | 49 | .. automodule:: astropysics.utils.gen 50 | :members: 51 | :undoc-members: 52 | :show-inheritance: 53 | 54 | 55 | utils.alg -- common/repeated algorithms 56 | --------------------------------------- 57 | 58 | .. automodule:: astropysics.utils.alg 59 | :members: 60 | :undoc-members: 61 | :show-inheritance: 62 | 63 | utils.stats -- statistcs-related tools 64 | -------------------------------------- 65 | 66 | .. automodule:: astropysics.utils.stats 67 | :members: 68 | :undoc-members: 69 | :show-inheritance: 70 | 71 | utils.io -- input/output and various file format tools 72 | ------------------------------------------------------ 73 | 74 | .. automodule:: astropysics.utils.io 75 | :members: 76 | :undoc-members: 77 | :show-inheritance: 78 | 79 | """ 80 | 81 | 82 | from gen import * 83 | from alg import * 84 | from io import * 85 | from stats import * 86 | 87 | del np #clean up namespace 88 | -------------------------------------------------------------------------------- /astropysics/version.py: -------------------------------------------------------------------------------- 1 | #Copyright 2010 Erik Tollerud 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from __future__ import division,with_statement 16 | 17 | #Warning: this file is overwritten in the build_py stage of setup.py to freeze 18 | #the version number - this file is only used in dev mode or during build. 19 | 20 | #these components can be changed for new versions 21 | major = 1 22 | minor = 1 23 | bugfix = 0 24 | dev = True 25 | 26 | 27 | #everything below here is derived 28 | release = not dev 29 | _warntxt = ', so no revision number available for dev build of astropysics - this may prevent this install from overwriting the previous version' 30 | 31 | 32 | def _get_bzr_devstr(): 33 | """ 34 | Returns the bzr devstring. 35 | 36 | :returns: The revision devstring (to be appended to the version number) 37 | :rtype: str 38 | 39 | :except ValueError: If this is a release version. 40 | """ 41 | import os 42 | from os import path 43 | 44 | if release: 45 | raise ValueError('revsion devstring not valid for a release version') 46 | 47 | try: 48 | bzrdir = path.join(path.split(__file__)[0],'..','.bzr') 49 | if not path.exists(bzrdir): 50 | raise IOError('.bzr directory does not exist, cannot get revision') 51 | 52 | lrevfn = path.join(bzrdir,'branch','last-revision') 53 | if not path.exists(lrevfn): 54 | raise IOError('last-revision file does not exist, cannot get revision') 55 | 56 | with open(lrevfn) as f: 57 | s = f.read() 58 | 59 | rnum = int(s.split()[0]) 60 | return 'dev-r'+str(rnum) 61 | except IOError: 62 | from warnings import warn 63 | warn('Could not find bzr'+_warntxt) 64 | return 'dev' 65 | 66 | def _get_hg_devstr(idtype='rev'): 67 | """ 68 | Returns the mercurial devstring. 69 | 70 | :param idtype: Can be 'rev','short',or 'hex' 71 | :type idtype: str 72 | 73 | :returns: The revision devstring (to be appended to the version number) 74 | :rtype: str 75 | 76 | :except ValueError: If this is a release version 77 | :except TypeError: If idtype is invalid 78 | """ 79 | from os import path 80 | 81 | if release: 82 | raise ValueError('revsion devstring not valid for a release version') 83 | 84 | try: 85 | from mercurial import hg,ui 86 | from mercurial.node import hex,short 87 | from mercurial.error import RepoError 88 | 89 | try: 90 | basedir = path.join(path.split(__file__)[0],'..') 91 | repo = hg.repository(ui.ui(),basedir) 92 | 93 | if idtype == 'rev': 94 | rstr = 'r'+str(repo['tip'].rev()) 95 | elif idtype == 'short': 96 | rstr = 'hg-'+short(repo.lookup('tip')) 97 | elif idtype == 'hex': 98 | rstr = 'hg-'+hex(repo.lookup('tip')) 99 | else: 100 | raise TypeError('invalid idtype') 101 | 102 | return 'dev-'+rstr 103 | 104 | except RepoError: 105 | from warnings import warn 106 | warn('No mercurial repository present'+_warntxt) 107 | return 'dev' 108 | 109 | except ImportError: 110 | from warnings import warn 111 | warn('Could not find mercurial'+_warntxt) 112 | return 'dev' 113 | 114 | 115 | def _get_git_devstr(sha=False): 116 | """ 117 | Returns the git devstring. 118 | 119 | :param bool sha: 120 | If True, the full SHA1 hash will be at the end of the devstr, otherwise, 121 | a revision number. 122 | :returns: The revision devstring (to be appended to the version number) 123 | :rtype: str 124 | 125 | :except ValueError: If this is a release version 126 | """ 127 | from os import path 128 | from subprocess import Popen,PIPE 129 | from warnings import warn 130 | 131 | if release: 132 | raise ValueError('revsion devstring not valid for a release version') 133 | 134 | currdir = path.abspath(path.split(__file__)[0]) 135 | # gitdir = path.join(currdir,'.git') 136 | 137 | # while not path.exists(gitdir): 138 | # currdir = path.split(currdir)[0] 139 | # gitdir = path.join(currdir,'.git') 140 | # if currdir=='/' and not path.exists(gitdir): 141 | # warn('No git repository present'+_warntxt) 142 | # return 'dev' 143 | try: 144 | p = Popen(['git','rev-list','HEAD'],cwd=currdir, 145 | stdout=PIPE,stderr=PIPE,stdin=PIPE) 146 | stdout,stderr = p.communicate() 147 | except OSError: 148 | stdout = stderr = None 149 | 150 | if stdout is None: 151 | warn("git couldn't be run to determine git version number") 152 | return 'dev' 153 | elif p.returncode == 128: 154 | warn('No git repository present'+_warntxt) 155 | return 'dev' 156 | elif p.returncode != 0: 157 | warn('Git failed: '+stderr) 158 | return 'dev' 159 | 160 | if sha: 161 | return 'dev-git-'+stdout[:40] 162 | else: 163 | nrev = stdout.count('\n') 164 | return 'dev-r%i'%nrev 165 | 166 | _get_devstr = _get_git_devstr 167 | 168 | version = str(major)+'.' +\ 169 | str(minor) +\ 170 | (('.'+str(bugfix)) if bugfix else '') +\ 171 | ('.'+_get_devstr() if dev else '') 172 | 173 | _frozen_version_py_template = """#Autogenerated in astropysics setup.py on %s 174 | #these components can be changed for new versions 175 | version = '%s' 176 | 177 | major = %s 178 | minor = %s 179 | bugfix = %s 180 | dev = %s 181 | 182 | release = not dev 183 | """ 184 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | PAPER = 8 | BUILDDIR = _build 9 | 10 | # Internal variables. 11 | PAPEROPT_a4 = -D latex_paper_size=a4 12 | PAPEROPT_letter = -D latex_paper_size=letter 13 | ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . 14 | 15 | .PHONY: help clean html dirhtml pickle json htmlhelp qthelp latex changes linkcheck doctest 16 | 17 | help: 18 | @echo "Please use \`make ' where is one of" 19 | @echo " html to make standalone HTML files" 20 | @echo " dirhtml to make HTML files named index.html in directories" 21 | @echo " pickle to make pickle files" 22 | @echo " json to make JSON files" 23 | @echo " htmlhelp to make HTML files and a HTML help project" 24 | @echo " qthelp to make HTML files and a qthelp project" 25 | @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" 26 | @echo " changes to make an overview of all changed/added/deprecated items" 27 | @echo " linkcheck to check all external links for integrity" 28 | @echo " doctest to run all doctests embedded in the documentation (if enabled)" 29 | @echo " coverage to run coverage tests (if enabled)" 30 | 31 | clean: 32 | -rm -rf $(BUILDDIR)/* 33 | 34 | html: 35 | $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html 36 | @echo 37 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." 38 | 39 | dirhtml: 40 | $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml 41 | @echo 42 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." 43 | 44 | pickle: 45 | $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle 46 | @echo 47 | @echo "Build finished; now you can process the pickle files." 48 | 49 | json: 50 | $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json 51 | @echo 52 | @echo "Build finished; now you can process the JSON files." 53 | 54 | htmlhelp: 55 | $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp 56 | @echo 57 | @echo "Build finished; now you can run HTML Help Workshop with the" \ 58 | ".hhp project file in $(BUILDDIR)/htmlhelp." 59 | 60 | qthelp: 61 | $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp 62 | @echo 63 | @echo "Build finished; now you can run "qcollectiongenerator" with the" \ 64 | ".qhcp project file in $(BUILDDIR)/qthelp, like this:" 65 | @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Astropysics.qhcp" 66 | @echo "To view the help file:" 67 | @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Astropysics.qhc" 68 | 69 | latex: 70 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 71 | @echo 72 | @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." 73 | @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \ 74 | "run these through (pdf)latex." 75 | 76 | changes: 77 | $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes 78 | @echo 79 | @echo "The overview file is in $(BUILDDIR)/changes." 80 | 81 | linkcheck: 82 | $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck 83 | @echo 84 | @echo "Link check complete; look for any errors in the above output " \ 85 | "or in $(BUILDDIR)/linkcheck/output.txt." 86 | 87 | doctest: 88 | $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest 89 | @echo "Testing of doctests in the sources finished, look at the " \ 90 | "results in $(BUILDDIR)/doctest/output.txt." 91 | 92 | coverage: 93 | $(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage 94 | @echo "Coverage tests for all the sources finished, look at the " \ 95 | "results in $(BUILDDIR)/coverage/*.txt." 96 | -------------------------------------------------------------------------------- /docs/_static/logo16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eteq/astropysics/3d8fa228f84700d5e45e4a5273b88f4e2d3dd5c7/docs/_static/logo16.png -------------------------------------------------------------------------------- /docs/_templates/layout.html: -------------------------------------------------------------------------------- 1 | {% extends "!layout.html" %} 2 | 3 | {% block rootrellink %} 4 |
  • 6 |
  • {{ shorttitle }}{{ reldelim1 }}
  • 7 | {% endblock %} 8 | 9 | {%- block document %} 10 |
    11 | {%- if render_sidebar %} 12 |
    13 | {%- endif %} 14 |
    15 |
    Sphinx logo
    16 | {% block body %} {% endblock %} 17 |
    18 | {%- if render_sidebar %} 19 |
    20 | {%- endif %} 21 |
    22 | {%- endblock %} 23 | -------------------------------------------------------------------------------- /docs/conf.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # Astropysics documentation build configuration file, created by 4 | # sphinx-quickstart on Wed Feb 24 00:07:20 2010. 5 | # 6 | # This file is execfile()d with the current directory set to its containing dir. 7 | # 8 | # Note that not all possible configuration values are present in this 9 | # autogenerated file. 10 | # 11 | # All configuration values have a default; values that are commented out 12 | # serve to show the default. 13 | 14 | import sys, os 15 | 16 | # If extensions (or modules to document with autodoc) are in another directory, 17 | # add these directories to sys.path here. If the directory is relative to the 18 | # documentation root, use os.path.abspath to make it absolute, like shown here. 19 | #sys.path.append(os.path.abspath('.')) 20 | 21 | sys.path.insert(1,os.path.abspath('..')) #make sure it's on top except maybe local dirs 22 | 23 | #with open(os.path.join('..','setup.py')) as f: 24 | # for l in f: 25 | # if 'version' in l: 26 | # break 27 | # else: 28 | # raise RuntimeError('could not locate setup.py to determine version') 29 | #setup_version = l.split("'")[1] 30 | 31 | from astropysics.version import version as setup_version 32 | 33 | # -- General configuration ----------------------------------------------------- 34 | 35 | # Builtin sphinx extensions 36 | extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx', 'sphinx.ext.todo', 37 | 'sphinx.ext.pngmath', 'sphinx.ext.inheritance_diagram', 38 | 'sphinx.ext.coverage','sphinx.ext.ifconfig','sphinx.ext.doctest'] 39 | #'matplotlib.sphinxext.plot_directive','matplotlib.sphinxext.ipython_console_highlighting'] 40 | 41 | #custom extensions 42 | extensions.extend(['astropysics.sphinxext.todomod']) 43 | 44 | # Add any paths that contain templates here, relative to this directory. 45 | templates_path = ['_templates'] 46 | 47 | # The suffix of source filenames. 48 | source_suffix = '.rst' 49 | 50 | # The encoding of source files. 51 | #source_encoding = 'utf-8' 52 | 53 | # The master toctree document. 54 | master_doc = 'index' 55 | 56 | # General information about the project. 57 | project = u'Astropysics' 58 | copyright = u'2010, Erik Tollerud' 59 | 60 | # The version info for the project you're documenting, acts as replacement for 61 | # |version| and |release|, also used in various other places throughout the 62 | # built documents. 63 | # 64 | # The short X.Y version. 65 | version = '.'.join(setup_version.split('.')[:2]) 66 | # The full version, including alpha/beta/rc tags. 67 | release = setup_version 68 | 69 | # The language for content autogenerated by Sphinx. Refer to documentation 70 | # for a list of supported languages. 71 | language = 'en' 72 | 73 | # There are two options for replacing |today|: either, you set today to some 74 | # non-false value, then it is used: 75 | #today = '' 76 | # Else, today_fmt is used as the format for a strftime call. 77 | #today_fmt = '%B %d, %Y' 78 | 79 | # List of documents that shouldn't be included in the build. 80 | #unused_docs = [] 81 | 82 | # List of directories, relative to source directory, that shouldn't be searched 83 | # for source files. 84 | exclude_trees = ['_build'] 85 | 86 | # The reST default role (used for this markup: `text`) to use for all documents. 87 | #default_role = None 88 | 89 | # If true, '()' will be appended to :func: etc. cross-reference text. 90 | #add_function_parentheses = True 91 | 92 | # If true, the current module name will be prepended to all description 93 | # unit titles (such as .. function::). 94 | #add_module_names = True 95 | 96 | # If true, sectionauthor and moduleauthor directives will be shown in the 97 | # output. They are ignored by default. 98 | #show_authors = False 99 | 100 | # The name of the Pygments (syntax highlighting) style to use. 101 | pygments_style = 'sphinx' 102 | 103 | # A list of ignored prefixes for module index sorting. 104 | #modindex_common_prefix = [] 105 | 106 | 107 | # -- Options for HTML output --------------------------------------------------- 108 | 109 | # The theme to use for HTML and HTML Help pages. Major themes that come with 110 | # Sphinx are currently 'default' and 'sphinxdoc'. 111 | html_theme = 'default' 112 | 113 | # Theme options are theme-specific and customize the look and feel of a theme 114 | # further. For a list of options available for each theme, see the 115 | # documentation. 116 | html_theme_options = {'rightsidebar':True,'stickysidebar':True, 117 | 'bodyfont':'Verdana, Geneva, Helvetica, sans-serif', 118 | 'headfont':'Georgia, Times, serif', 119 | 'footerbgcolor' :'#0053A6', 120 | 'footertextcolor' :'#ffffff', 121 | 'sidebarbgcolor' :'#707373', 122 | 'sidebartextcolor' :'#e2e2ea', 123 | 'sidebarlinkcolor' :'#FF970D', 124 | #'sidebarbgcolor' :'#A3890E', 125 | #'sidebartextcolor' :'#e2e2ea', 126 | #'sidebarlinkcolor' :'#121D70', 127 | 'relbarbgcolor' :'#003366', 128 | #'relbarbgcolor' :'#5D68BC', 129 | 'relbartextcolor' :'#ffffff', 130 | 'relbarlinkcolor' :'#ffffff', 131 | 'bgcolor' :'#eaeeee', 132 | 'textcolor' :'#000000', 133 | 'headbgcolor' :'#f2f2f2', 134 | 'headtextcolor' :'#20435c', 135 | 'headlinkcolor' :'#c60f0f', 136 | 'linkcolor' :'#ce5c00', 137 | 'visitedlinkcolor' :'#ce5c00', 138 | 'codebgcolor' :'#eeffcc', 139 | 'codetextcolor' :'#333333' 140 | } 141 | 142 | # Add any paths that contain custom themes here, relative to this directory. 143 | #html_theme_path = [] 144 | 145 | # The name for this set of Sphinx documents. If None, it defaults to 146 | # " v documentation". 147 | #html_title = None 148 | 149 | # A shorter title for the navigation bar. Default is the same as html_title. 150 | #html_short_title = None 151 | 152 | # The name of an image file (relative to this directory) to place at the top 153 | # of the sidebar. 154 | #html_logo = '../logo/logo.png' 155 | 156 | # The name of an image file (within the static path) to use as favicon of the 157 | # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 158 | # pixels large. 159 | html_favicon = 'logo32thin.ico' 160 | 161 | # Add any paths that contain custom static files (such as style sheets) here, 162 | # relative to this directory. They are copied after the builtin static files, 163 | # so a file named "default.css" will overwrite the builtin "default.css". 164 | html_static_path = ['_static','../logo/logo32thin.ico','../logo/logotext.png'] 165 | 166 | # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, 167 | # using the given strftime format. 168 | #html_last_updated_fmt = '%b %d, %Y' 169 | 170 | # If true, SmartyPants will be used to convert quotes and dashes to 171 | # typographically correct entities. 172 | #html_use_smartypants = True 173 | 174 | # Custom sidebar templates, maps document names to template names. 175 | #html_sidebars = {} 176 | 177 | # Additional templates that should be rendered to pages, maps page names to 178 | # template names. 179 | #html_additional_pages = {} 180 | 181 | # If false, no module index is generated. 182 | #html_use_modindex = True 183 | 184 | # If false, no index is generated. 185 | #html_use_index = True 186 | 187 | # If true, the index is split into individual pages for each letter. 188 | #html_split_index = False 189 | 190 | # If true, links to the reST sources are added to the pages. 191 | #html_show_sourcelink = True 192 | 193 | # If true, an OpenSearch description file will be output, and all pages will 194 | # contain a tag referring to it. The value of this option must be the 195 | # base URL from which the finished HTML is served. 196 | #html_use_opensearch = '' 197 | 198 | # If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml"). 199 | #html_file_suffix = '' 200 | 201 | # Output file base name for HTML help builder. 202 | htmlhelp_basename = 'Astropysicsdoc' 203 | 204 | 205 | # -- Options for LaTeX output -------------------------------------------------- 206 | 207 | # The paper size ('letter' or 'a4'). 208 | #latex_paper_size = 'letter' 209 | 210 | # The font size ('10pt', '11pt' or '12pt'). 211 | #latex_font_size = '10pt' 212 | 213 | # Grouping the document tree into LaTeX files. List of tuples 214 | # (source start file, target name, title, author, documentclass [howto/manual]). 215 | latex_documents = [ 216 | ('index', 'Astropysics.tex', u'Astropysics Documentation', 217 | u'Erik Tollerud', 'manual'), 218 | ] 219 | 220 | # The name of an image file (relative to this directory) to place at the top of 221 | # the title page. 222 | latex_logo = '../logo/logo.png' 223 | 224 | # For "manual" documents, if this is true, then toplevel headings are parts, 225 | # not chapters. 226 | #latex_use_parts = False 227 | 228 | # Additional stuff for the LaTeX preamble. 229 | #latex_preamble = '' 230 | 231 | # Documents to append as an appendix to all manuals. 232 | #latex_appendices = [] 233 | 234 | # If false, no module index is generated. 235 | #latex_use_modindex = True 236 | 237 | 238 | intersphinx_mapping = {'python':('http://docs.python.org/',None), 239 | 'numpy':('http://docs.scipy.org/doc/numpy/',None), 240 | 'scipy':('http://docs.scipy.org/doc/scipy/reference/',None), 241 | 'matplotlib':('http://matplotlib.sourceforge.net/',None), 242 | 'pymc':('https://pymcmc.readthedocs.org/en/latest/',None), 243 | 'networkx':('http://networkx.lanl.gov/',None), 244 | 'pymodelfit':('http://packages.python.org/PyModelFit/',None)} 245 | 246 | autoclass_content = 'both' 247 | 248 | todo_include_todos = 'dev' in release 249 | 250 | graphviz_output_format = 'png' #can be 'svg' or 'png' 251 | inheritance_graph_attrs = dict(size='"12.0, 12.0"',fontsize=12) 252 | 253 | # This string is included at the bottom of all source documents, and has 254 | #global replacements. 255 | rst_epilog = """ 256 | .. _ADS: http://www.adsabs.harvard.edu/ 257 | """ 258 | 259 | 260 | 261 | 262 | 263 | #This makes the add_doc family of functions in astropysics do nothing, as those 264 | #are intended for in-shell use - Sphinx links are better 265 | import astropysics 266 | astropysics._ignore_add_docs = True 267 | -------------------------------------------------------------------------------- /docs/coremods/ccd.rst: -------------------------------------------------------------------------------- 1 | 2 | .. automodule:: astropysics.ccd 3 | :members: 4 | :undoc-members: 5 | :show-inheritance: 6 | -------------------------------------------------------------------------------- /docs/coremods/config.rst: -------------------------------------------------------------------------------- 1 | 2 | .. automodule:: astropysics.config 3 | :members: 4 | :undoc-members: 5 | :show-inheritance: 6 | -------------------------------------------------------------------------------- /docs/coremods/constants.rst: -------------------------------------------------------------------------------- 1 | 2 | .. automodule:: astropysics.constants 3 | :members: 4 | :undoc-members: 5 | :show-inheritance: 6 | -------------------------------------------------------------------------------- /docs/coremods/coords.rst: -------------------------------------------------------------------------------- 1 | 2 | .. automodule:: astropysics.coords 3 | :members: 4 | :undoc-members: 5 | :show-inheritance: 6 | -------------------------------------------------------------------------------- /docs/coremods/intro.rst: -------------------------------------------------------------------------------- 1 | 2 | Core Modules 3 | ============ 4 | 5 | The modules forming the core of astropysics' functionality are documented below. 6 | These are primarily useful in a script or interpreter setting, and hence are 7 | non-GUI. All plotting functions in these modules use `matplotlib 8 | `_, allowing them to be used in 9 | `ipython `_ without blocking the interactive 10 | interpreter. 11 | 12 | .. toctree:: 13 | :maxdepth: 2 14 | 15 | 16 | constants 17 | coords 18 | models 19 | objcat 20 | ccd 21 | spec 22 | phot 23 | obstools 24 | plotting 25 | pipeline 26 | publication 27 | utils 28 | config 29 | -------------------------------------------------------------------------------- /docs/coremods/models.rst: -------------------------------------------------------------------------------- 1 | 2 | .. automodule:: astropysics.models 3 | :members: 4 | :undoc-members: 5 | :show-inheritance: 6 | -------------------------------------------------------------------------------- /docs/coremods/objcat.rst: -------------------------------------------------------------------------------- 1 | 2 | .. automodule:: astropysics.objcat 3 | :members: 4 | :undoc-members: 5 | :show-inheritance: 6 | :exclude-members: EquatorialCoordinates 7 | 8 | -------------------------------------------------------------------------------- /docs/coremods/obstools.rst: -------------------------------------------------------------------------------- 1 | 2 | .. automodule:: astropysics.obstools 3 | :members: 4 | :undoc-members: 5 | :show-inheritance: 6 | :exclude-members: tzmod,tzoffset 7 | -------------------------------------------------------------------------------- /docs/coremods/phot.rst: -------------------------------------------------------------------------------- 1 | 2 | .. automodule:: astropysics.phot 3 | :members: 4 | :undoc-members: 5 | :show-inheritance: 6 | -------------------------------------------------------------------------------- /docs/coremods/pipeline.rst: -------------------------------------------------------------------------------- 1 | 2 | .. automodule:: astropysics.pipeline 3 | :members: 4 | :undoc-members: 5 | :show-inheritance: 6 | -------------------------------------------------------------------------------- /docs/coremods/plotting.rst: -------------------------------------------------------------------------------- 1 | 2 | .. automodule:: astropysics.plotting 3 | :members: 4 | :undoc-members: 5 | :show-inheritance: 6 | 7 | -------------------------------------------------------------------------------- /docs/coremods/publication.rst: -------------------------------------------------------------------------------- 1 | 2 | .. automodule:: astropysics.publication 3 | :members: 4 | :undoc-members: 5 | :show-inheritance: 6 | -------------------------------------------------------------------------------- /docs/coremods/spec.rst: -------------------------------------------------------------------------------- 1 | 2 | .. automodule:: astropysics.spec 3 | :members: 4 | :undoc-members: 5 | :show-inheritance: 6 | 7 | .. automethod:: astropysics.spec.HasSpecUnits._applyUnits 8 | -------------------------------------------------------------------------------- /docs/coremods/utils.rst: -------------------------------------------------------------------------------- 1 | 2 | .. automodule:: astropysics.utils 3 | :members: 4 | :undoc-members: 5 | :show-inheritance: 6 | -------------------------------------------------------------------------------- /docs/develop.rst: -------------------------------------------------------------------------------- 1 | Developer Guidelines for Astropysics 2 | ==================================== 3 | 4 | Astropysics welcomes contributions from anyone interested, from simple bugfixes to contributing new functionality. 5 | If you want to check out the most recent version to contribute (or just want the latest and greatest), you can pull the current development version from the `github page `_. 6 | 7 | 8 | Getting the Code 9 | ---------------- 10 | 11 | You will need to have `git `_ installed - it is available for all major OSes. Once you have it working, simply execute:: 12 | 13 | git clone git://github.com/eteq/astropysics.git astropysics-dev 14 | 15 | This will create a directory with the name ``astropysics-dev`` containing the latest and greatest version of astropysics. 16 | If at any time you want to update this version, go into the directory and do:: 17 | 18 | git pull 19 | 20 | then re-install following the directions at :doc:`install`. Usage of git to edit source code is well-documented elsewhere - github's `help page `_ covers the important basics. 21 | 22 | If you plan on editing the astropysics source code (please do so, and submit patches/new features!), a useful way to immediately see changes without having to re-install every time is to use the command:: 23 | 24 | python setup.py develop 25 | 26 | possibly prefixed with ``sudo`` depending on your OS. This will install links to the source code directory instead of copying over the source code, so any changes you make to a module can be seen just be doing ``reload(module)``. 27 | 28 | Cloning the Repository to Submit Code 29 | ------------------------------------- 30 | 31 | If you intend to regularly contribute changes or patches to astropysics, a great way to submit changes is to use github's "fork" feature. Just go to the `astropysics page `_ 32 | and click the "fork" button in the upper-right. Make a new branch in your fork with whatever change you want to make, and when you've fixed the bug of added whatever new fancy 33 | thing you want to add, just submit a pull request (button in the upper-right) to the main astropysics project. 34 | 35 | Coding Style Guidelines 36 | ----------------------- 37 | 38 | Naming Conventions 39 | ^^^^^^^^^^^^^^^^^^ 40 | 41 | For general coding style, `PEP8 `_ provides the main coding style for astropysics, with an important exception: PEP8 calls for methods (i.e. functions that are in the scope of a class) to use the ``lower_case_with_underscores`` convention. 42 | Astropysics instead uses ``camelCase`` (e.g. first letter of each word upper case, first letter of the method lower case) for method names. Functions that are not methods (i.e. directly in a module scope) remain ``lowercase_with_underscores``. 43 | This allows methods and functions to be easily distinguished (but keeps method names distinct from class names, for which the first letter is always upper case). This could change in the future to be fully PEP8 compliant, but for now, given the already existing codebase, ``camelCase`` it is. 44 | 45 | To summarize, the naming conventions are: 46 | 47 | * Module names are always ``lowercase``. 48 | * Class names are always ``CamelCaseFirstLetterUppercase``. 49 | * Methods (including static methods and class methods) are always ``camelCaseFirstLetterLowercase``. 50 | * Functions are always ``lowercase_with_underscore``. 51 | * Variables and class attributes should be ``lowercase`` and kept to a single word if possible. 52 | * Private/internal functions, methods, or variables should be ``_leadingUnderscore`` with the appropriate convention for the type. Python and sphinx both know to hide these unless you specifically request them. Python also supports ``__doubleLeadingUnderscore`` for private class methods (the double-underscore is `mangled `_), but this generally just leads to confusion if you're not careful, so it should be avoided unless there's some very good reason. 53 | 54 | 55 | Documentation Standards 56 | ^^^^^^^^^^^^^^^^^^^^^^^ 57 | 58 | Documentation should be provided with every object, using `sphinx `_ REStructuredText markup. 59 | Functions and methods should use `info field lists `_ To specify input parameters, return values, and exceptions (where relevant). Below is an example of the standard format:: 60 | 61 | def a_function(arg1,arg2=None,flag=False): 62 | """ 63 | A short description of the function. 64 | 65 | Multiple paragraphs if necessary, i.e. background is needed. 66 | 67 | :param arg1: 68 | This argument is important input data, although I'm not specifying 69 | exactly what it's type is (maybe it'd duck-typed?) Also, the 70 | description is more than one line, so it has to start underneath 71 | and indented. 72 | :param arg2: This argument is an optional input. 73 | :type arg2: You can specify a type here if you want. 74 | :param bool flag: You can also give the type in param if it fits. 75 | 76 | :except ValueError: 77 | If you raise an exception, specify here what type it is and why. 78 | 79 | :returns: A description of the return value, if there is one. 80 | 81 | **Examples** 82 | 83 | If an examples are needed, they should go here, ideally in doctest 84 | format so that they can be used as tests: 85 | 86 | >>> inpt = 'something for a_function' 87 | >>> a_function(inpt,flag=True) 88 | 'whatever a_function should output' 89 | 90 | """ 91 | 92 | 93 | Classes with public attributes can document using the sphinx construct for documenting class attributes:: 94 | 95 | class MyClass(object): 96 | 97 | #: Documentation for :attr:`value` attribute. 98 | value = None 99 | 100 | def __init__(self,value): 101 | self.value = value 102 | 103 | Testing Astropysics 104 | ------------------- 105 | 106 | There is a test suite that should be periodically run to ensure everything that has tests is still working correctly. It requires `nose `_. 107 | It can be run from the astropysics source directory (where setup.cfg lives) with the command:: 108 | 109 | nosetests 110 | 111 | Note that this is also set up to easily debug in the event that some of the tests fail. Simply do:: 112 | 113 | nosetest --failed 114 | 115 | And nose will only run those tests that failed the last time around. If you want to run a particular test, do:: 116 | 117 | nostest --with-id 3 118 | 119 | Where the '3' can be replaced by whatever number test you want. 120 | 121 | When writing functionality in astropysics, it's a good idea to add tests. These should go in the 'tests' directory, and should have module names with the word 'test' in them, along with the function names themselves. 122 | This naming is necessary to allow nose to find all the tests. Alternatively, snippets of code as they would appear on the python interpreter (*with* output) can be placed directly in the docstrings, and they will be automatically included in the tests. 123 | 124 | -------------------------------------------------------------------------------- /docs/getstarted.rst: -------------------------------------------------------------------------------- 1 | Getting Started/Tutorial 2 | ======================== 3 | 4 | If you have not done so, install astropysics as described in :doc:`install`, and 5 | be sure to run the setup command ``astpys-setup`` as described in 6 | :ref:`inst-setup`. Be sure you have IPython installed for the rest of this 7 | section to function correctly. 8 | 9 | Interactive Environment 10 | ----------------------- 11 | 12 | Astropysics uses `IPython `_ to provide an 13 | interactive environment to run python. To start using astropysics in ipython, 14 | just run the helper script ``ipyastpys`` - that will run ipython with a 15 | customized profile that automatically imports commonly-used parts of of 16 | astropysics (and :mod:`numpy`). 17 | 18 | 19 | Projects 20 | -------- 21 | 22 | The ``ipyastpys`` environment also supports "projects", allowing the interactive 23 | environment to be started such that it automatically moves to a given directory 24 | and runs a given script. This directory can then hold all necessary data files 25 | and the script can load data and store functions to generate plots for the 26 | project/paper. A project can be created using the command:: 27 | 28 | ipyastpys -c projectname 29 | 30 | This will create a project named "projectname", with a directory 31 | "/path/to/currentdir/projectname" and script "projectname/projectname.py". If 32 | the directory or script don't exist, they will be created. A different directory or 33 | script name can be used by calling the script as:: 34 | 35 | ipyastpys -c projectname /path/to/projectdir projectscript.py 36 | 37 | Note that the script must be inside the project directory (in the above example, 38 | the script's full path is "/path/to/projectdir/projectscript.py"). 39 | 40 | The interactive environment should then be started using:: 41 | 42 | ipyastpys -p projectname 43 | 44 | And it will start ipython in /path/to/projectdir, with the projectscript.py 45 | script automatically run inside the interactive environment (the ``-s`` option 46 | can be used to give projectscript.py any necessary command line arguments). 47 | 48 | 49 | If a project script does not already exist, it will be generated from 50 | :download:`a template ` that allows 51 | for easy interactive work to create plots. In the script, add as many functions 52 | as necessary with the function decorator :func:`plotfunc` (see the template 53 | itself for detailed syntax), and then load any necessary data variables at 54 | the end of the script. The :func:`make_plots` function can then be used to 55 | generate the plots by passing it the name of the plot function. The script can 56 | also be used at the command line to auto-generate all plots. 57 | 58 | 59 | Module Tutorials 60 | ---------------- 61 | 62 | Most of the modlues in astropysics have their own tutorials and examples that 63 | are relevant to their specific functionality. This is the best place to go to 64 | find examples of how to actually use astropysics. See :doc:`coremods/intro` and 65 | :doc:`gui/intro` for a list of these modules. 66 | 67 | .. todo:: Add links to the relevant tutorials in some automated way 68 | -------------------------------------------------------------------------------- /docs/gui/intro.rst: -------------------------------------------------------------------------------- 1 | GUI applications 2 | ================ 3 | 4 | Astropysics includes a variety of graphical applications for various data 5 | analysis tasks. Their full power is acheived when used interactively or as part 6 | of scripts, but some operate as stand-alone command-line tools when the 7 | situation warrants. 8 | 9 | Note that these applications make heavy use of `Enthought Traits 10 | `_ and the associated `Enthought 11 | Tools Suite `_ if they are not 12 | installed, most of these will not function. 13 | 14 | Another important related GUI used in astropysics is the Fit GUI from 15 | :mod:`pymodelfit`. This GUI is used wherever interactive curve-fitting is 16 | needed (and was, in fact, originally made for astropysics). 17 | 18 | .. toctree:: 19 | :maxdepth: 2 20 | 21 | spylot 22 | spectarget 23 | 24 | 25 | the :mod:`gui` module also imports the convinience functions and primary 26 | application classes for these GUIs. These include: 27 | 28 | * :func:`fit_data ` (imported from :mod:`pymodelfit`) 29 | * :class:`Spylot ` 30 | * :func:`spylot_specs ` 31 | * :class:`SpecTarget ` 32 | * :func:`spec_target ` 33 | -------------------------------------------------------------------------------- /docs/gui/spectarget.rst: -------------------------------------------------------------------------------- 1 | 2 | Spectarget -- MOS Targeting 3 | =========================== 4 | 5 | This application is a tool based on `Traits `_ for interactively identifying spectroscopic targets for use with a multi-object spectograph. Note that this module is a bit rough around the edges and hasn't been too tested with anything other than `Keck/DEIMOS `_. 6 | 7 | .. automodule:: astropysics.gui.spectarget 8 | :members: 9 | :undoc-members: 10 | -------------------------------------------------------------------------------- /docs/gui/spylot.rst: -------------------------------------------------------------------------------- 1 | 2 | Spylot -- Spectrum Plotter 3 | ========================== 4 | 5 | This application is a spectrum plotting/interactive analysis tool based on `Traits `_. It is essentially a GUI wrapper and interface around a collection of :class:`astropysics.spec.Spectrum` objects. 6 | 7 | It can be run as part of a python script or interactively in ipython by generating :class:`astropysics.gui.spylot.Spylot` objects or calling the :func:`astropysics.gui.spylot.spylot_specs` function as detailed below. A command-line script 'spylot' is also installed when you install astropysics. The command-line tool takes the name of the spectrum file to display and the following options: 8 | 9 | -h, --help show help message and exit 10 | -t TYPE, --type=TYPE file format of spectra: "wcs", "deimos", or "astropysics"(default) 11 | -e EXT, --extension=EXT Fits extension number 12 | -c CONFIGFILE, --config=CONFIGFILE File to save Spylot configuration to 13 | 14 | 15 | .. todo:: Write a Tutorial/examples for both code and command-line script 16 | 17 | 18 | .. autoclass:: astropysics.gui.spylot.Spylot 19 | :members: 20 | :undoc-members: 21 | :exclude-members: majorlineeditor,minorlineeditor 22 | 23 | .. autofunction:: astropysics.gui.spylot.spylot_specs 24 | -------------------------------------------------------------------------------- /docs/index.rst: -------------------------------------------------------------------------------- 1 | .. Astropysics documentation master file, created by 2 | sphinx-quickstart on Wed Feb 24 00:07:20 2010. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Astropysics: astrophysics utilities for python 7 | ============================================== 8 | :Author: `Erik Tollerud `_ 9 | 10 | Astropysics is a library containing a variety of utilities and algorithms for 11 | reducing, analyzing, and visualizing astronomical data. Best of all, it 12 | encourages the user to leverage the existing capabilities of Python to make this 13 | quick, easy, and as painless as cutting-edge science can even actually be. There 14 | do exist other Python packages with some of the capabilities of this project, 15 | but the goal of this project is to integrate all these tools together and make 16 | them interact in the most straightforward ways possible. 17 | 18 | .. note :: 19 | The functionality of Astropysics is currently being incorporated 20 | into `the Astropy project `_. Astropy is a 21 | wider community effort, and to avoid wasting resources, most of the 22 | energy that initially went into developing Astropysics have been 23 | shifted to Astropy. As a result, Astropysics is no longer getting 24 | new features - those efforts are now in Astropy. Within the next few 25 | versions of Astropy, we expect it will include all the functionality 26 | of Astropysics (and more). 27 | 28 | Astropysics will continue to be supported in the form of bug fixes, 29 | though, and will be available for use roughly in its current form 30 | for the foreseeable future. So any existing code can continue to 31 | use Astropysics, but for new work, I suggest you begin transitioning 32 | to Astropy if it supports your needs. 33 | 34 | .. _contents: 35 | 36 | Contents 37 | ======== 38 | 39 | Astropysics is divided into two major subcomponents - the core modules that 40 | contain functions and classes to the calculations and organize data, and the gui 41 | module that contains a number of useful small-scale astronomy applications. 42 | 43 | .. toctree:: 44 | :maxdepth: 2 45 | 46 | install 47 | getstarted 48 | coremods/intro 49 | gui/intro 50 | develop 51 | 52 | 53 | Quick Install 54 | ============= 55 | 56 | See :doc:`install` for full install instructions, including prerequisite 57 | packages. 58 | 59 | To install a current release of astropysics, the simplest approach is:: 60 | 61 | pip install astropysics 62 | 63 | (on unix-like systems or OS X, add "sudo " before this command) 64 | 65 | If you want the must up-to-date (possible unstable) version, do:: 66 | 67 | hg clone https://astropysics.googlecode.com/hg/ astropysics-dev 68 | cd astropysics-dev 69 | python setup.py develop 70 | 71 | (note that `mercurial `_ must be installed, and 72 | on some systems the last command may need to have "sudo " at the beginning) 73 | 74 | You can also alter the source code if you use this approach (see :doc:`develop` 75 | for guidelines of working contributing source code). 76 | 77 | In either case, afterwords you can run:: 78 | 79 | astpys-setup 80 | 81 | to install optional packages and setup the environment. 82 | 83 | 84 | Bug Reports 85 | =========== 86 | 87 | The best place to report bugs is via the `google code bug tracker `_. That way they won't be forgotten unless an asteroid impact destroys all of google's servers. 88 | 89 | People 90 | ============ 91 | 92 | Lead Developer 93 | -------------- 94 | 95 | * Erik Tollerud 96 | 97 | Contributors 98 | ------------ 99 | 100 | * Sebastian Gurovich 101 | * Alex Hagen 102 | * Frederic Grollier 103 | 104 | 105 | Logo Image Credit 106 | ================= 107 | 108 | The multiwavelength image of M81 was put together by the folks at the Chandra X-Ray Observatory (http://chandra.harvard.edu/photo/2008/m81/), and they credit: "X-ray: NASA/CXC/Wisconsin/D.Pooley & CfA/A.Zezas; Optical: NASA/ESA/CfA/A.Zezas; UV: NASA/JPL-Caltech/CfA/J.Huchra et al.; IR: NASA/JPL-Caltech/CfA". The Python logo can be found at ``_. 109 | 110 | Indices and tables 111 | ================== 112 | 113 | * :ref:`genindex` 114 | * :ref:`modindex` 115 | * :ref:`search` 116 | 117 | -------------------------------------------------------------------------------- /docs/install.rst: -------------------------------------------------------------------------------- 1 | Installing Astropysics 2 | ====================== 3 | 4 | 5 | Requirements 6 | ------------ 7 | Before you do anything with astropysics, you'll need: 8 | 9 | * `Python `_ 2.5 or higher (2.6 highly recommended), although 3.x is not yet supported. 10 | * `numpy `_ 11 | * `scipy `_ 12 | 13 | Follow the instructions on those sites, or, far easier, install them as packages from your operating system (e.g. apt-get or the synaptic GUI on Ubuntu, `Macports `_ on OS X, etc.). 14 | 15 | 16 | Install 17 | ------- 18 | 19 | Once you have the requirements satisfied, you have a few options for installing astropysics. 20 | 21 | .. note:: 22 | On most unix-like systems, you will need to either execute these commands as the root user, or preface them with ``sudo``. 23 | 24 | If you have `pip `_ (the new, better easy installer) or `easy_install/setuptools `_ (you should probably install pip...), just run either:: 25 | 26 | pip install astropysics 27 | 28 | or:: 29 | 30 | easy_install astropysics 31 | 32 | If you are installing from source code, instead, just do:: 33 | 34 | python setup.py install 35 | 36 | If you plan on using the most up-to-date version of astropysics or if you wish 37 | to alter the source code (see :doc:`develop`), a useful way to immediately 38 | see changes without having to re-install every time is to use the command:: 39 | 40 | python setup.py develop 41 | 42 | 43 | .. _inst-setup: 44 | 45 | Setup 46 | ----- 47 | 48 | After the package has been installed, at the command line, run:: 49 | 50 | astpys-setup 51 | 52 | This script does two things: 53 | 54 | * Prompts you to select which optional packages you want to download and install. 55 | * Configures IPython to support the ``ipyastpys`` script (described in :doc:`getstarted`). 56 | 57 | The first of these involves an interactive process that downloads and installed 58 | requested packages. To install all of them, type ``a`` (and hit enter), 59 | otherwise choose a number to install that package. If you want to quit before 60 | installing all of the package (for example, if some don't install correctly), 61 | choose ``q``. For information on a package, type ``i#`` (where # is the number 62 | for the package). 63 | 64 | Note that if you can't get any packages to install, you might try running the 65 | script as:: 66 | 67 | astpys-setup -s 68 | 69 | Depending on your operating system, you may want to use your package management 70 | system to install the recommended packages, before running the setup (although 71 | you may need the more up-to-date versions given here). 72 | 73 | 74 | .. _inst-rec: 75 | 76 | Recommended Packages 77 | -------------------- 78 | 79 | A number of other packages are necessary for added functionality in astropysics 80 | or to provide functionality that has no need to be duplicated. These packages 81 | can be installed with the ``astpys-setup`` script as described in 82 | :ref:`inst-setup`, but if available from your system's package management 83 | system, it may be better to try installing that way, instead. 84 | 85 | * `Matplotlib `_ 86 | *highly recommended*, as it is necessary for all plotting (aside from 87 | the GUI applications). 88 | 89 | * `IPython `_ 90 | *highly recommended*, as it is a far better interactive shell than the 91 | python default and has many wonderful features. Necessary for the 92 | ``ipyastpys`` script. 93 | 94 | * `NetworkX `_ 95 | *highly recommended*, as it is used for a variety of internal purposes 96 | as well as any place where a network/graph is plotted. 97 | 98 | * `PyGraphviz `_ 99 | It might also be useful to have a closely related package for generating 100 | `graphviz `_ graphs from networkx. 101 | 102 | * `pyfits `_ 103 | *highly recommended*, necessary for reading FITS files (the most common 104 | astronomy data format). 105 | 106 | * `asciitable ` 107 | A valuable tool for loading and writing ASCII tables. 108 | 109 | * `ATpy ` 110 | Astronomical Tables in Python - a general tool for dealing with tabular 111 | data, both ASCII (uses asciitable) and other formats. 112 | 113 | * `pidly ` 114 | IDL within Python. For those times when someone sends you an IDL code 115 | that you don't have the time to convert to python, but want to be able 116 | to call from inside python. Requires IDL to be installed. 117 | 118 | 119 | * `Traits `_, `TraitsGUI `_, `Chaco `_, and `Mayavi `_. Alternatively, `ETS `_ is all bundled in one. 120 | Necessary for the interfaces in the :mod:`gui` modules:: 121 | 122 | pip install ETS 123 | 124 | or:: 125 | 126 | pip install traits 127 | pip install traitsGUI 128 | pip install chaco 129 | pip install mayavi 130 | 131 | 132 | Astropysics also includes pythonic wrappers around some astronomy-related tools that need to be installed seperately if their functionality is desired: 133 | 134 | * `SExtractor `_ 135 | * `Kcorrect `_ -------------------------------------------------------------------------------- /licenses/CONFIGOBJ_LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2003-2010, Michael Foord 2 | All rights reserved. 3 | E-mail : fuzzyman AT voidspace DOT org DOT uk 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are 7 | met: 8 | 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | 13 | * Redistributions in binary form must reproduce the above 14 | copyright notice, this list of conditions and the following 15 | disclaimer in the documentation and/or other materials provided 16 | with the distribution. 17 | 18 | * Neither the name of Michael Foord nor the name of Voidspace 19 | may be used to endorse or promote products derived from this 20 | software without specific prior written permission. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 23 | AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 25 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 26 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 27 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 28 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 29 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 30 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 32 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | -------------------------------------------------------------------------------- /licenses/LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /licenses/SOFA_LICENSE: -------------------------------------------------------------------------------- 1 | ** Copyright (C) 2009 2 | ** Standards Of Fundamental Astronomy Review Board 3 | ** of the International Astronomical Union. 4 | ** 5 | ** ===================== 6 | ** SOFA Software License 7 | ** ===================== 8 | ** 9 | ** NOTICE TO USER: 10 | ** 11 | ** BY USING THIS SOFTWARE YOU ACCEPT THE FOLLOWING TERMS AND CONDITIONS 12 | ** WHICH APPLY TO ITS USE. 13 | ** 14 | ** 1. The Software is owned by the IAU SOFA Review Board ("SOFA"). 15 | ** 16 | ** 2. Permission is granted to anyone to use the SOFA software for any 17 | ** purpose, including commercial applications, free of charge and 18 | ** without payment of royalties, subject to the conditions and 19 | ** restrictions listed below. 20 | ** 21 | ** 3. You (the user) may copy and distribute SOFA source code to others, 22 | ** and use and adapt its code and algorithms in your own software, 23 | ** on a world-wide, royalty-free basis. That portion of your 24 | ** distribution that does not consist of intact and unchanged copies 25 | ** of SOFA source code files is a "derived work" that must comply 26 | ** with the following requirements: 27 | ** 28 | ** a) Your work shall be marked or carry a statement that it 29 | ** (i) uses routines and computations derived by you from 30 | ** software provided by SOFA under license to you; and 31 | ** (ii) does not itself constitute software provided by and/or 32 | ** endorsed by SOFA. 33 | ** 34 | ** b) The source code of your derived work must contain descriptions 35 | ** of how the derived work is based upon, contains and/or differs 36 | ** from the original SOFA software. 37 | ** 38 | ** c) The name(s) of all routine(s) in your derived work shall not 39 | ** include the prefix "iau_". 40 | ** 41 | ** d) The origin of the SOFA components of your derived work must 42 | ** not be misrepresented; you must not claim that you wrote the 43 | ** original software, nor file a patent application for SOFA 44 | ** software or algorithms embedded in the SOFA software. 45 | ** 46 | ** e) These requirements must be reproduced intact in any source 47 | ** distribution and shall apply to anyone to whom you have 48 | ** granted a further right to modify the source code of your 49 | ** derived work. 50 | ** 51 | ** Note that, as originally distributed, the SOFA software is 52 | ** intended to be a definitive implementation of the IAU standards, 53 | ** and consequently third-party modifications are discouraged. All 54 | ** variations, no matter how minor, must be explicitly marked as 55 | ** such, as explained above. 56 | ** 57 | ** 4. In any published work or commercial products which includes 58 | ** results achieved by using the SOFA software, you shall 59 | ** acknowledge that the SOFA software was used in obtaining those 60 | ** results. 61 | ** 62 | ** 5. You shall not cause the SOFA software to be brought into 63 | ** disrepute, either by misuse, or use for inappropriate tasks, or 64 | ** by inappropriate modification. 65 | ** 66 | ** 6. The SOFA software is provided "as is" and SOFA makes no warranty 67 | ** as to its use or performance. SOFA does not and cannot warrant 68 | ** the performance or results which the user may obtain by using the 69 | ** SOFA software. SOFA makes no warranties, express or implied, as 70 | ** to non-infringement of third party rights, merchantability, or 71 | ** fitness for any particular purpose. In no event will SOFA be 72 | ** liable to the user for any consequential, incidental, or special 73 | ** damages, including any lost profits or lost savings, even if a 74 | ** SOFA representative has been advised of such damages, or for any 75 | ** claim by any third party. 76 | ** 77 | ** 7. The provision of any version of the SOFA software under the terms 78 | ** and conditions specified herein does not imply that future 79 | ** versions will also be made available under the same terms and 80 | ** conditions. 81 | ** 82 | ** Correspondence concerning SOFA software should be addressed as 83 | ** follows: 84 | ** 85 | ** By email: sofa@rl.ac.uk 86 | ** By post: IAU SOFA Center 87 | ** STFC Rutherford Appleton Laboratory 88 | ** Harwell Science and Innovation Campus 89 | ** Didcot, Oxfordshire, OX11 0QX 90 | ** United Kingdom 91 | -------------------------------------------------------------------------------- /logo/imagecredits: -------------------------------------------------------------------------------- 1 | M81 Image by NASA/CXC/SAO : http://chandra.harvard.edu/photo/2008/m81 2 | 3 | X-ray: NASA/CXC/Wisconsin/D.Pooley & CfA/A.Zezas 4 | Optical: NASA/ESA/CfA/A.Zezas 5 | UV: NASA/JPL-Caltech/CfA/J.Huchra et al. 6 | IR: NASA/JPL-Caltech/CfA) 7 | 8 | Python logo from The Python Software Foundation: http://www.python.org/community/logos/ 9 | -------------------------------------------------------------------------------- /logo/logo.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eteq/astropysics/3d8fa228f84700d5e45e4a5273b88f4e2d3dd5c7/logo/logo.ico -------------------------------------------------------------------------------- /logo/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eteq/astropysics/3d8fa228f84700d5e45e4a5273b88f4e2d3dd5c7/logo/logo.png -------------------------------------------------------------------------------- /logo/logo.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eteq/astropysics/3d8fa228f84700d5e45e4a5273b88f4e2d3dd5c7/logo/logo.xcf -------------------------------------------------------------------------------- /logo/logo16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eteq/astropysics/3d8fa228f84700d5e45e4a5273b88f4e2d3dd5c7/logo/logo16.png -------------------------------------------------------------------------------- /logo/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eteq/astropysics/3d8fa228f84700d5e45e4a5273b88f4e2d3dd5c7/logo/logo192.png -------------------------------------------------------------------------------- /logo/logo32.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eteq/astropysics/3d8fa228f84700d5e45e4a5273b88f4e2d3dd5c7/logo/logo32.ico -------------------------------------------------------------------------------- /logo/logo32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eteq/astropysics/3d8fa228f84700d5e45e4a5273b88f4e2d3dd5c7/logo/logo32.png -------------------------------------------------------------------------------- /logo/logo32thin.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eteq/astropysics/3d8fa228f84700d5e45e4a5273b88f4e2d3dd5c7/logo/logo32thin.ico -------------------------------------------------------------------------------- /logo/logo32thin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eteq/astropysics/3d8fa228f84700d5e45e4a5273b88f4e2d3dd5c7/logo/logo32thin.png -------------------------------------------------------------------------------- /logo/logo64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eteq/astropysics/3d8fa228f84700d5e45e4a5273b88f4e2d3dd5c7/logo/logo64.png -------------------------------------------------------------------------------- /logo/logo64thin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eteq/astropysics/3d8fa228f84700d5e45e4a5273b88f4e2d3dd5c7/logo/logo64thin.png -------------------------------------------------------------------------------- /logo/logorot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eteq/astropysics/3d8fa228f84700d5e45e4a5273b88f4e2d3dd5c7/logo/logorot.png -------------------------------------------------------------------------------- /logo/logorot.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eteq/astropysics/3d8fa228f84700d5e45e4a5273b88f4e2d3dd5c7/logo/logorot.xcf -------------------------------------------------------------------------------- /logo/logotext.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eteq/astropysics/3d8fa228f84700d5e45e4a5273b88f4e2d3dd5c7/logo/logotext.png -------------------------------------------------------------------------------- /logo/logotext.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eteq/astropysics/3d8fa228f84700d5e45e4a5273b88f4e2d3dd5c7/logo/logotext.xcf -------------------------------------------------------------------------------- /scripts/astpys-setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #Copyright 20 Erik Tollerud 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | from optparse import OptionParser 17 | from astropysics import config 18 | 19 | parser = OptionParser() 20 | parser.add_option("-p", "--no-package-install", dest="install", 21 | help="Skip the installation tool.", 22 | action="store_false",default=True) 23 | parser.add_option("-i", "--no-ipython", dest="ipython", 24 | help="Skip the ipython setup tool.", 25 | action="store_false",default=True) 26 | parser.add_option("-s", "--sudo", dest="sudo", 27 | help="Runs the install step prefixed by 'sudo' (or turns sudo *off* if this platform normally expects to use sudo).", 28 | action="store_true",default=False) 29 | 30 | ops, args = parser.parse_args() 31 | 32 | if ops.install: 33 | config.run_install_tool(sudo='toggleauto' if ops.sudo else 'auto') 34 | 35 | if ops.ipython: 36 | config.run_ipython_setup() 37 | -------------------------------------------------------------------------------- /scripts/fitsinfo: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #Copyright 2009 Erik Tollerud 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | """ 17 | This script runs on fits and fits.gz files and extracts header or summary 18 | information from the files. If no files are given it looks at all fits and 19 | fits.gz files in the current directory. 20 | """ 21 | 22 | import sys 23 | from optparse import OptionParser 24 | from glob import glob 25 | 26 | try: 27 | import pyfits 28 | except ImportError: 29 | print 'PyFits not found, cannot continue - exiting...' 30 | sys.exit(1) 31 | 32 | op = OptionParser() 33 | op.usage = '%prog [options] [filename(s)]' 34 | op.add_option('-e','--extension',dest='ext',help='Extension of fits file from which to read header. If not specified, a summary will be shown.',metavar='EXT',default=None) 35 | op.add_option('-r','--record',dest='rec',help='Record names to lookup',metavar='REC') 36 | op.add_option('-c','--coords',dest='coords',help='Decimal coordinate lookup',action='store_true',default=False) 37 | op.add_option('-f','--flat',dest='flat',help='Flat listing for each entry',action='store_true',default=False) 38 | 39 | ops,args=op.parse_args() 40 | if len(args) < 1: 41 | args.append('*.fits') 42 | args.append('*.fits.gz') 43 | 44 | fns = [] 45 | for a in args: 46 | fns.extend(glob(a)) 47 | 48 | if ops.ext is None: 49 | rec = ops.rec 50 | if rec is not None and ',' in rec: 51 | print "Can't show multiple records in summary mode" 52 | sys.exit(2) 53 | 54 | dosep = False 55 | for fn in fns: 56 | if dosep: 57 | print '-------------------------------------------','\n' 58 | if not (fn.endswith('fits') or fn.endswith('fits.gz')): 59 | print 'File',fn,'is not FITS, skipping...','\n' 60 | else: 61 | try: 62 | f = pyfits.open(fn,memmap=1) 63 | try: 64 | print 'File',fn,'contains',len(f),'HDU'+('s' if len(f)>1 else ''),':' 65 | for i,hdu in enumerate(f): 66 | print 'HDU #%i, name:%s, type:%s'%(i,hdu.name,hdu.__class__.__name__) 67 | print '\tHeader has %i entries'%len(hdu.header.keys()) 68 | if rec: 69 | if hdu.header.has_key(rec): 70 | print '\t',rec,'=',hdu.header.get(rec) 71 | else: 72 | print '\t',rec,'not found in this header' 73 | if hdu.data is None: 74 | print '\tContains no Data' 75 | else: 76 | print '\tData shape:',hdu.data.shape 77 | finally: 78 | f.close() 79 | dosep = True 80 | except Exception,e: 81 | print 'Problem summarizing file',fn+':',str(e) 82 | else: 83 | flat = ops.flat 84 | ext = int(ops.ext) 85 | rec = ops.rec 86 | if rec is not None: 87 | if ops.coords: 88 | print "Can't use coordinate mode and records to lookup, exiting" 89 | sys.exit(2) 90 | rec = rec.split(',') 91 | elif ops.coords: 92 | from astropysics.coords import EquatorialPosition 93 | rec = ['RA','DEC'] 94 | ap = EquatorialPosition() 95 | aplast = None 96 | 97 | for fn in fns: 98 | if not (fn.endswith('fits') or fn.endswith('fits.gz')): 99 | print 'File',fn,'is not FITS, skipping...' 100 | else: 101 | h = pyfits.getheader(fn,ext) 102 | if not flat: 103 | print 'File',fn,'HDU #',ext,':' 104 | if rec is None: 105 | print str(h).strip() 106 | else: 107 | for r in rec: 108 | val = h.get(r) 109 | 110 | if val is None: 111 | if flat: 112 | print fn+':',r,'Record does not exist' 113 | else: 114 | print '\t',r,'Record does not exist' 115 | else: 116 | if ops.coords: 117 | if r == 'RA': 118 | ap.ra.hms = [float(e) for e in val.split(':')] 119 | val = ap.ra.d 120 | if aplast == 'DEC': 121 | if flat: 122 | print fn+':','coords',ap.ra.d,ap.dec.d 123 | else: 124 | print '\tcoords',ap.ra.d,ap.dec.d 125 | aplast = None 126 | else: 127 | aplast = 'RA' 128 | elif r == 'DEC': 129 | ap.dec.dms = [float(e) for e in val.split(':')] 130 | val = ap.dec.d 131 | if aplast == 'RA': 132 | if flat: 133 | print fn+':','coords',ap.ra.d,ap.dec.d 134 | else: 135 | print '\tcoords',ap.ra.d,ap.dec.d 136 | aplast = None 137 | else: 138 | aplast = 'DEC' 139 | else: 140 | raise ValueError("This should be unreachable!") 141 | if flat: 142 | print fn+':',r,'=',val 143 | else: 144 | print '\t',r,'=',val 145 | if not flat: 146 | print '' #newline to split files 147 | 148 | -------------------------------------------------------------------------------- /scripts/ipyastpys: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | try: 4 | import IPython 5 | except ImportError: 6 | print 'IPython not installed - ipyastpys requires IPython' 7 | sys.exit(3) 8 | import os,sys 9 | from IPython.utils.path import get_ipython_dir 10 | from optparse import OptionParser 11 | from astropysics import config 12 | 13 | ipdir = get_ipython_dir() 14 | #get version info to figure out how to launch ipy 15 | majver,minver = IPython.__version__.split('.')[:2] 16 | majver,minver = int(majver),int(minver) 17 | 18 | op = OptionParser() 19 | op.usage = '%prog [options] [projdir projfile]' 20 | op.add_option('-a','--ipy-args',dest='iargs',help='IPython command line arguments - enclose the intended arguments in " marks.') 21 | op.add_option('-p','--project',dest='project',metavar='PROJECT',help='Run a project in this session. Project script will be run with any arguments passed to ipyastpys.') 22 | op.add_option('-c','--create-project',dest='create',metavar='PROJECT',help='Create a project with the specified name. Cannot be used with -p or -d. Directory and scripts file (relative to directory) may be provided as arguments. Directory and script are created if they do not exist.') 23 | op.add_option('-d','--delete-project',dest='delete',metavar='PROJECT',help='Delete the project with the specified name. Cannot be used with -p or -c. This does not delete the directory for the project.') 24 | op.add_option('-l','--list-projects',dest='list',help='List all projects - all other options are ignored',action='store_true') 25 | op.add_option('-s','--script-args',dest='sargs',help='Arguments to be used in the profile script. Ignored if -p/--profile is not given.') 26 | 27 | 28 | #parse ipyastpys args 29 | ops,args = op.parse_args() 30 | 31 | if ops.list: 32 | for n,t in config.get_projects().iteritems(): 33 | print n 34 | print '\tDirectory:',t[0] 35 | print '\tScript:',t[1] 36 | sys.exit(0) 37 | 38 | pdir = pfn = None 39 | if ops.project: 40 | if ops.create or ops.delete: 41 | print "Can't both run and create a project." 42 | sys.exit(1) 43 | elif ops.delete: 44 | print "Can't both run and delete a project." 45 | sys.exit(1) 46 | 47 | pname = ops.project 48 | 49 | projs = config.get_projects() 50 | if ops.project not in projs: 51 | print 'Project,',ops.project,'not found' 52 | sys.exit(2) 53 | 54 | pdir,pfn = projs[ops.project] 55 | 56 | elif ops.create: 57 | pname = ops.create 58 | if ops.delete: 59 | print "Can't both create and delete a project." 60 | sys.exit(1) 61 | 62 | addps = [pname] 63 | addps.extend(args) 64 | pdir,pfn = config.add_project(*addps) 65 | print 'Created project',pname,'at',pdir,'with script',pfn 66 | sys.exit(0) 67 | elif ops.delete: 68 | pname = ops.delete 69 | try: 70 | config.del_project(pname) 71 | print 'Deleted project',pname 72 | sys.exit(0) 73 | except KeyError: 74 | print 'Project',pname,'not found' 75 | sys.exit(2) 76 | 77 | 78 | 79 | 80 | #figure out ipython expected command line 81 | if ops.iargs: 82 | ipyargs = ops.iargs.split() 83 | ipyargs.insert(0,sys.argv[0]) 84 | #insert necessary ipython arguments if they aren't already there 85 | if '-p' not in ipyargs and '--profile' not in ipyargs: 86 | if majver>0 or minver>=11: 87 | ipyargs.append('--profile=astpys') 88 | else: 89 | ipyargs.append('-p') 90 | ipyargs.append('astpys') 91 | else: 92 | if majver>0 or minver>=11: 93 | ipyargs = [sys.argv[0],'--profile=astpys'] 94 | else: 95 | ipyargs = [sys.argv[0],'-p','astpys'] 96 | #replace sys.argv with args appropriate for ipython 97 | sys.argv[:] = ipyargs 98 | 99 | if pdir is not None: 100 | os.chdir(pdir) 101 | 102 | if pfn is not None: 103 | runstr = ['run',pfn] 104 | if ops.sargs: 105 | runstr.extend(ops.sargs.split()) 106 | runstr = ' '.join(runstr) 107 | 108 | if majver>0 or minver>=11: 109 | if any([a.startswith('c=') for a in sys.argv]): 110 | print 'Cannot run a profile script if "c" is in the ipython arguments.' 111 | sys.exit(3) 112 | 113 | print 'Executing "'+runstr+'" on startup.' 114 | sys.argv.append('c="%s"'%runstr) 115 | if '--i' not in sys.argv: 116 | sys.argv.append('--i') 117 | else: 118 | if '-c' in sys.argv: 119 | print 'Cannot run a profile script if "c" is in the ipython arguments.' 120 | sys.exit(3) 121 | 122 | print 'Executing "'+runstr+'" on startup.' 123 | sys.argv.append('-c') 124 | sys.argv.append(runstr) 125 | if '-i' not in sys.argv: 126 | sys.argv.append('-i') 127 | 128 | if majver>0 or minver>=11: 129 | #check to make sure profile file is present - these two locations are due 130 | #to changes in the profile system during the course of 0.11's dev cycle 131 | betaloc = os.path.exists(os.path.join(ipdir,'ipython_config_astpys.py')) 132 | newapploc = os.path.exists(os.path.join(ipdir,'profile_astpys')) 133 | if not (betaloc or newapploc): 134 | print 'Astropysics IPython profile missing - run astpys-setup' 135 | sys.exit(2) 136 | 137 | #Use entry point mechanism 138 | from pkg_resources import load_entry_point 139 | sys.exit(load_entry_point('ipython', 'console_scripts', 'ipython')()) 140 | else: 141 | #check to make sure profile file is present 142 | if not os.path.exists(os.path.join(ipdir,'ipy_profile_astpys.py')): 143 | print 'Astropysics IPython profile missing - run astpys-setup' 144 | sys.exit(2) 145 | 146 | #add pylab if version < 0.11, 147 | if '--pylab' not in sys.argv: 148 | sys.argv.append('--pylab') 149 | 150 | #Launch via the .start mechanism 151 | import IPython.Shell 152 | IPython.Shell.start().mainloop() 153 | 154 | 155 | 156 | -------------------------------------------------------------------------------- /scripts/prepforpub: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #Copyright 2009 Erik Tollerud 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | import sys,os,glob 17 | from subprocess import Popen 18 | from optparse import OptionParser 19 | from astropysics import version,publication 20 | 21 | 22 | vstr = '%prog '+version.version 23 | parser = OptionParser(usage='%prog [options] texfile format',version=vstr) 24 | parser.description="""Prepares a LaTeX papers for a variety of different 25 | publication locations. Currently supported format: 'arxiv'(prepares publication 26 | for posting to arXiv.org), 'apj'(prepares publication for submission to the 27 | Astrophysical Journal using aastex style), 'emulateapj'(prepares publication 28 | for submission to the Astrophysical Journal using emulateapj style) 29 | """ 30 | parser.add_option("-d", "--directory", dest="directory",metavar="DIR",default='', 31 | help="Specifies a directory for the files to be published.") 32 | parser.add_option("-q", "--quiet",action="store_true", dest="quiet", 33 | default=False,help="Supresses messages about actions taken.") 34 | parser.add_option("-w", "--overwrite",action="store_true", dest="overwrite", 35 | default=False,help="Overwrite the directory instead of making a new one.") 36 | parser.add_option("-c", "--compile",action="store_true", dest="compile", 37 | default=False,help="Attempt to compile using latex and possibly bibtex.") 38 | parser.add_option("-f", "--figure-exts", dest="figexts",metavar="FIGEXTS",default='eps,pdf', 39 | help="Specifies filename extensions to copy for figures.") 40 | parser.add_option("-i", "--dont-flatten-inputs", dest="flatin",action='store_false',default=True, 41 | help="Don't flatten files supplied with the \\input command") 42 | 43 | ops, args = parser.parse_args() 44 | 45 | if len(args) != 2: 46 | parser.print_usage() 47 | sys.exit(1) 48 | texfn,fmt = args 49 | 50 | kwargs = dict(overwritedir=ops.overwrite,verbose=not ops.quiet,flatteninputs=ops.flatin) 51 | if ops.directory != '': 52 | kwargs['newdir'] = ops.directory 53 | if ops.figexts is not None: 54 | kwargs['figexts'] = ops.figexts.split(',') 55 | 56 | publication.print_warnings = True 57 | 58 | if fmt == 'arxiv': 59 | if not ops.quiet: 60 | print 'Preparing for arXiv publication' 61 | f,dir = publication.prep_for_arxiv_pub(texfn,**kwargs) 62 | elif fmt == 'apj': 63 | if not ops.quiet: 64 | print 'Preparing for ApJ publication' 65 | f,dir = publication.prep_for_apj_pub(texfn,**kwargs) 66 | 67 | elif fmt == 'emulateapj': 68 | if not ops.quiet: 69 | print 'Preparing for ApJ publication w/emulateapj' 70 | kwargs['emulateapj'] = True 71 | f,dir = publication.prep_for_apj_pub(texfn,**kwargs) 72 | else: 73 | print 'Unrecognized format "'+fmt+'", exiting with no action' 74 | 75 | if ops.compile: 76 | def ecode_check(ecode,prog='latex'): 77 | if ecode!=0: 78 | print prog,'failed with exit code',ecode,'... aborting compilation!' 79 | sys.exit(ecode) 80 | 81 | cwd = os.path.join(os.path.abspath('.'),dir) 82 | if not ops.quiet: 83 | print 'Compiling file ',os.path.join(cwd,f.lastsavefn) 84 | 85 | texfn = os.path.split(f.lastsavefn)[-1] 86 | bibs = f.visit(lambda n:n.reqargs[0] if isinstance(n,publication.Command) and n.name=='bibliography' else None) 87 | bibfn = os.path.join(cwd,bibs[0]+'.bib') 88 | 89 | if os.path.exists(bibfn): 90 | ecode_check(Popen(['latex',texfn],executable='latex',cwd=cwd).wait()) 91 | ecode_check(Popen(['bibtex',texfn.replace('.tex','')],executable='bibtex',cwd=cwd).wait(),'bibtex') 92 | ecode_check(Popen(['latex',texfn],executable='latex',cwd=cwd).wait()) 93 | ecode_check(Popen(['latex',texfn],executable='latex',cwd=cwd).wait()) 94 | ecode_check(Popen(['latex',texfn],executable='latex',cwd=cwd).wait()) 95 | 96 | -------------------------------------------------------------------------------- /scripts/spylot: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #Copyright 2009 Erik Tollerud 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | import warnings 17 | warnings.filterwarnings('ignore','PyArray_FromDimsAndDataAndDescr: use PyArray_NewFromDescr.*'.lower()) 18 | warnings.filterwarnings('ignore','the sets module is deprecated') 19 | from numpy import seterr 20 | seterr(all='ignore') 21 | 22 | import sys,os 23 | from optparse import OptionParser 24 | from glob import glob 25 | 26 | op = OptionParser() 27 | op.usage = '%prog [ops] [file(s)]' 28 | op.add_option('-t','--type',dest='type',default='astropysics',help='file format of spectra: "wcs", "deimos", or "astropysics"(default)') 29 | op.add_option('-e','--extension',dest='ext',default=None,help='Fits extension number') 30 | op.add_option('-c','--config',dest='configfile',default=None,help='File to save Spylot configuration') 31 | 32 | ops,args = op.parse_args() 33 | 34 | #if ops.configfile is None or not os.path.exists(ops.configfile): 35 | #if input is ok import the gui stuff 36 | from astropysics.gui import spylot 37 | from astropysics import spec 38 | 39 | if len(args) == 0: 40 | fns = [] 41 | fns.extend(glob('*.fits')) 42 | fns.extend(glob('*.fits.gz')) 43 | else: 44 | fns = [] 45 | for pattern in args: 46 | fns.extend(glob(pattern)) 47 | 48 | if len(fns) == 0: 49 | print 'No files found!' 50 | sys.exit(1) 51 | 52 | ss = [] 53 | if ops.type == 'wcs': 54 | specs = [] 55 | ext = ops.ext 56 | for fn in fns: 57 | try: 58 | print 'Loading wcs spectrum file',fn 59 | ss.append(spec.load_wcs_spectrum(fn,ext)) 60 | except Exception,e: 61 | print 'Could not load',fn,':',e 62 | elif ops.type == 'deimos': 63 | for fn in fns: 64 | try: 65 | if 'spec1d' in fn.lower(): 66 | print 'Loading deimos spectrum file',fn 67 | ss.append(spec.load_deimos_spectrum(fn,False)) 68 | else: 69 | raise ValueError('Deimos spectrum must be spec1d format!') 70 | except Exception,e: 71 | print 'Could not load',fn,':',e 72 | elif ops.type == 'astropysics': 73 | for fn in fns: 74 | try: 75 | print 'Loading astropysics spectrum file',fn 76 | ss.append(spec.Spectrum.load(fn)) 77 | except Exception,e: 78 | print 'Could not load',fn,':',e 79 | 80 | else: 81 | print 'Unrecognized spectrum type ',ops.type 82 | sys.exit(1) 83 | 84 | if len(ss)>0: 85 | print 'Loaded',len(ss),'spectra' 86 | sp = spylot.Spylot(ss) 87 | sp.configure_traits(ops.configfile) 88 | else: 89 | print 'Could not load any spectra, exiting' 90 | sys.exit(1) 91 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [build_sphinx] 2 | source-dir = docs 3 | build-dir = docs/_build 4 | all_files = 1 5 | 6 | [upload_docs] 7 | upload-dir = docs/_build/html 8 | show-response = 1 9 | 10 | [aliases] 11 | upload_rev = sdist bdist_egg upload build_sphinx upload_docs 12 | 13 | [nosetests] 14 | verbosity = 2 15 | with-doctest = 1 16 | with-id = 1 17 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #Copyright (c) 2008 Erik Tollerud (erik.tollerud@gmail.com) 3 | from __future__ import division,with_statement 4 | 5 | from glob import glob 6 | from distribute_setup import use_setuptools 7 | use_setuptools() 8 | from setuptools import setup,find_packages 9 | from distutils.command.build_py import build_py as du_build_py 10 | from distutils.core import Command 11 | 12 | from astropysics.version import version as versionstr 13 | from astropysics.config import _recpkgs,_guipkgs 14 | 15 | 16 | descrip = """ 17 | `astropysics` contains a variety of utilities and algorithms for reducing, analyzing, and visualizing astronomical data. 18 | 19 | See http://packages.python.org/Astropysics/ for detailed documentation. 20 | """ 21 | 22 | apyspkgs = find_packages(exclude=['tests']) 23 | scripts = glob('scripts/*') 24 | 25 | #recommended/gui packages are stored in config module - used in extras 26 | recpkgs = [pkg.name for pkg in _recpkgs] 27 | guipkgs = [pkg.name for pkg in _guipkgs] 28 | 29 | 30 | #custom build_py overwrites version.py with a version overwriting the revno-generating version.py 31 | class apy_build_py(du_build_py): 32 | def run(self): 33 | from os import path 34 | res = du_build_py.run(self) 35 | 36 | versfile = path.join(self.build_lib,'astropysics','version.py') 37 | print 'freezing version number to',versfile 38 | with open(versfile,'w') as f: #this overwrites the actual version.py 39 | f.write(self.get_version_py()) 40 | 41 | return res 42 | 43 | def get_version_py(self): 44 | import datetime 45 | from astropysics.version import _frozen_version_py_template 46 | from astropysics.version import version,major,minor,bugfix,dev 47 | 48 | 49 | timestamp = str(datetime.datetime.now()) 50 | t = (timestamp,version,major,minor,bugfix,dev) 51 | return _frozen_version_py_template%t 52 | 53 | 54 | #custom sphinx builder just makes the directory to build if it hasn't already been made 55 | try: 56 | from sphinx.setup_command import BuildDoc 57 | 58 | class apy_build_sphinx(BuildDoc): 59 | def finalize_options(self): 60 | from os.path import isfile 61 | from distutils.cmd import DistutilsOptionError 62 | 63 | if self.build_dir is not None: 64 | if isfile(self.build_dir): 65 | raise DistutilsOptionError('Attempted to build_sphinx into a file '+self.build_dir) 66 | self.mkpath(self.build_dir) 67 | return BuildDoc.finalize_options(self) 68 | 69 | except ImportError: #sphinx not present 70 | apy_build_sphinx = None 71 | 72 | 73 | #command to count the number of lines of code (mostly for curiosity's sake) in the main dirs 74 | class CountLines(Command): 75 | # Brief (40-50 characters) description of the command 76 | description = "Print the number of lines in the major directories to the terminal." 77 | 78 | # List of option tuples: long name, short name (None if no short 79 | # name), and help string. 80 | user_options = [('includeempty', 'e', 81 | "Include empty lines in the count"), 82 | ] 83 | 84 | def initialize_options (self): 85 | self.includeempty = False 86 | 87 | def finalize_options (self): 88 | pass 89 | 90 | def visit_files(self,lists,dirname,fnames): 91 | lcountlist,fcountlist = lists 92 | from os import path 93 | 94 | #prefilter for valid extentions 95 | if dirname != 'scripts': 96 | fnames = [fn for fn in fnames if (fn.endswith('.py') or fn.endswith('.pyx')) ] 97 | 98 | cnt = 0 99 | for fn in fnames: 100 | fn = path.join(dirname,fn) 101 | with open(fn) as f: 102 | if self.includeempty: 103 | for l in f: 104 | cnt += 1 105 | else: 106 | for l in f: 107 | if l.strip()!='': 108 | cnt += 1 109 | 110 | lcountlist.append(cnt) 111 | fcountlist.append(len(fnames)) 112 | 113 | def run(self): 114 | from os import path 115 | 116 | dir,name = path.split(__file__) 117 | 118 | apydir = path.join(dir,'astropysics') 119 | apyllst,apyflst = [],[] 120 | path.walk(apydir,self.visit_files,(apyllst,apyflst)) 121 | self.apylinecount = sum(apyllst) 122 | self.apyfilecount = sum(apyflst) 123 | 124 | scrdir = path.join(dir,'scripts') 125 | scrllst,scrflst = [],[] 126 | path.walk(scrdir,self.visit_files,(scrllst,scrflst)) 127 | self.scrlinecount = sum(scrllst) 128 | self.scrfilecount = sum(scrflst) 129 | 130 | tstdir = path.join(dir,'tests') 131 | tstllst,tstflst = [],[] 132 | path.walk(tstdir,self.visit_files,(tstllst,tstflst)) 133 | self.tstlinecount = sum(tstllst) 134 | self.tstfilecount = sum(tstflst) 135 | 136 | self.linecount = self.apylinecount + self.scrlinecount + self.tstlinecount 137 | self.filecount = self.apyfilecount + self.scrfilecount + self.tstfilecount 138 | 139 | print 'Astropysics source directory has %i lines in %i files'%(self.apylinecount,self.apyfilecount) 140 | print 'Scripts directory has %i lines in %i files'%(self.scrlinecount,self.scrfilecount) 141 | print 'Tests directory has %i lines in %i files'%(self.tstlinecount,self.tstfilecount) 142 | print 'Total %i lines in %i files'%(self.linecount,self.filecount) 143 | 144 | 145 | cmdclassd = {'build_py' : apy_build_py,'count_lines':CountLines} 146 | if apy_build_sphinx is not None: 147 | cmdclassd['build_sphinx'] = apy_build_sphinx 148 | 149 | setup(name='Astropysics', 150 | version=versionstr, 151 | description='Astrophysics libraries for Python', 152 | 153 | packages=apyspkgs, 154 | package_data={'astropysics':['data/*']}, 155 | scripts=scripts, 156 | requires=['numpy','scipy'], 157 | install_requires=['numpy'], 158 | provides=['astropysics'], 159 | extras_require={'all':recpkgs+guipkgs, 160 | 'nogui':recpkgs}, 161 | author='Erik Tollerud', 162 | author_email='erik.tolleru@gmail.com', 163 | license = 'Apache License 2.0', 164 | url='http://packages.python.org/Astropysics/', 165 | long_description=descrip, 166 | cmdclass = cmdclassd 167 | ) 168 | -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eteq/astropysics/3d8fa228f84700d5e45e4a5273b88f4e2d3dd5c7/tests/__init__.py -------------------------------------------------------------------------------- /tests/__main__.py: -------------------------------------------------------------------------------- 1 | 2 | if __name__=='__main__': 3 | from nose import run,config 4 | from nose.plugins import doctests,testid 5 | import os,sofatests 6 | 7 | print 'Running nose tests' 8 | cfg = config.Config(verbosity=2) 9 | run(config=cfg,plugins=[testid.TestId(),doctests.Doctest()]) 10 | 11 | print 'Completed nose tests, running SOFA-based tests' 12 | if not os.path.abspath(os.curdir).endswith('tests'): 13 | os.chdir(os.path.join(os.curdir,'tests')) 14 | sofatests.main(compile=True,epoch=None) 15 | 16 | -------------------------------------------------------------------------------- /tests/centroiding.py: -------------------------------------------------------------------------------- 1 | """ 2 | Tests exploring how well centroiding performs in various conditions 3 | """ 4 | 5 | from __future__ import division 6 | import numpy as np 7 | from numpy.random import poisson,randn,rand 8 | 9 | from astropysics import models,utils 10 | 11 | def do_centroid(model,size,sampling): 12 | 13 | F = poisson(m.pixelize(-size/2,size/2,-size/2,size/2, 14 | size,size,sampling=sampling)) 15 | x = np.linspace(-size/2,size/2,size) 16 | y = np.linspace(-size/2,size/2,size) 17 | 18 | I = np.sum(F,axis=1) 19 | J = np.sum(F,axis=0) 20 | 21 | Isub = I-np.sum(I)/size 22 | Isub[Isub<0] = 0 23 | Jsub = J-np.sum(J)/size 24 | Jsub[Jsub<0] = 0 25 | 26 | truex,truey = model.mux,model.muy 27 | xc_howell = np.sum(Isub*x)/np.sum(Isub) 28 | yc_howell = np.sum(Jsub*y)/np.sum(Jsub) 29 | res_howell = (xc_howell-truex,yc_howell-truey) 30 | 31 | resx,resy = utils.centroid(F,axes=(x,y)) 32 | cenres = (resx-truex,resy-truey) 33 | 34 | Fsub = F-np.mean(F) 35 | Fsub[Fsub<0] = 0 36 | meancenx,meanceny = utils.centroid(Fsub,axes=(x,y)) 37 | meancenres = (meancenx-truex,meanceny-truey) 38 | 39 | return res_howell,meancenres,cenres 40 | 41 | n = 100 42 | size = 50 43 | sampling = 10 44 | xs = rand(n)*20-10 #[-10,10] 45 | ys = rand(n)*20-10 #[-10,10] 46 | sigs = rand(n)*8+2 #[2,10] 47 | A = 1000 48 | 49 | print 'Gaussian:' 50 | res = [] 51 | for i,(x,y,s) in enumerate(zip(xs,ys,sigs)): 52 | print 'doing',i+1,'of',n 53 | m = models.Gaussian2DModel(A=A,mux=x,muy=y) 54 | m.sigx = m.sigy = s 55 | res.append(do_centroid(m,size,sampling)) 56 | res = np.array(res) 57 | ressep = np.sum(res**2,axis=-1)**0.5 58 | hm = np.mean(ressep[:,1]-ressep[:,0]) 59 | hc = np.mean(ressep[:,2]-ressep[:,0]) 60 | mc = np.mean(ressep[:,2]-ressep[:,1]) 61 | print 'howell','better than' if hm>0 else 'worse than','meancen',hm 62 | print 'howell','better than' if hc>0 else 'worse than','bgcentroid',hc 63 | print 'meancen','better than' if mc>0 else 'worse than','bgcentroid',mc 64 | 65 | -------------------------------------------------------------------------------- /tests/sofatests.build: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | SOFALIB=~/lib/ 3 | SOFAINC=~/include/ 4 | 5 | gcc sofatests.c -o sofatests -lm -lsofa_c -I$SOFAINC -L$SOFALIB 6 | -------------------------------------------------------------------------------- /tests/sofatests.c: -------------------------------------------------------------------------------- 1 | #include "sofa.h" 2 | #include "stdio.h" 3 | #include "stdlib.h" 4 | #include "strings.h" 5 | #define PI 3.1415926535897931 6 | 7 | //Helpers 8 | void printmat(char* title, double mat[3][3]) { 9 | printf("%s:\n[[ %e,%e,%e]\n [%e,%e,%e]\n[%e,%e,%e]]\n",title, 10 | mat[0][0],mat[0][1],mat[0][2], 11 | mat[1][0],mat[1][1],mat[1][2], 12 | mat[2][0],mat[2][1],mat[2][2]); 13 | } 14 | 15 | void printvec(char* title, double vec[3]) { 16 | printf("%s:\n[%e,%e,%e]\n",title, 17 | vec[0],vec[1],vec[2]); 18 | } 19 | 20 | void deg2dms(double deg,int* d,int* m,double* s) { 21 | *d = (int)(deg); 22 | *m = (int)((deg-*d)*60); 23 | *s = ((deg-*d-*m/60.)*3600); 24 | } 25 | 26 | //Test functions 27 | void trans_matricies(double ep, double jd1) { 28 | double dpsi,deps,epsa,rb[3][3],rp[3][3],rbp[3][3],rn[3][3],rbpn[3][3],rc2i[3][3]; 29 | 30 | iauNut00b(jd1,0,&dpsi,&deps); 31 | iauPn00(jd1,0,dpsi,deps,&epsa,rb,rp,rbp,rn,rbpn); 32 | printmat("B",rb); 33 | printmat("P",rp); 34 | printmat("N",rn); 35 | printmat("BPN",rbpn); 36 | 37 | iauC2i00b(jd1,0,rc2i); 38 | printmat("C",rc2i); 39 | 40 | } 41 | 42 | void trans_coords(double ep, double jd) { 43 | double vec[3],transvec[3],rc2i[3][3],rbpn[3][3],rc2t[3][3]; 44 | double theta,phi,rasec,decsec; 45 | int rahr,ramin,decdegi,decmin; 46 | 47 | double lng = 10; //ra 48 | double lat = 20; //dec 49 | 50 | iauS2c(lng*PI/180,lat*PI/180,vec); 51 | iauC2i00b(jd,0,rc2i); 52 | //printmat("C2I",rc2i); 53 | //printvec("cartesian vec",vec); 54 | iauPnm00b(jd, 0, rbpn); 55 | //printmat("BPN",rbpn); 56 | //printvec("cartesian vec",vec); 57 | iauC2t00b(jd,0,jd,0,0,0,rc2t); 58 | //printmat("C2T",rc2t); 59 | //printvec("cartesian vec",vec); 60 | 61 | iauRxp(rc2i,vec,transvec); 62 | iauC2s(transvec,&theta,&phi); 63 | 64 | 65 | deg2dms(theta*180/PI/15,&rahr,&ramin,&rasec); 66 | deg2dms(phi*180/PI,&decdegi,&decmin,&decsec); 67 | printf("CIRS coords: ra:%ih%im%gs dec:%id%im%gs\n",rahr,ramin,rasec,decdegi,decmin,decsec); 68 | 69 | iauRxp(rbpn,vec,transvec); 70 | iauC2s(transvec,&theta,&phi); 71 | 72 | deg2dms(theta*180/PI/15,&rahr,&ramin,&rasec); 73 | deg2dms(phi*180/PI,&decdegi,&decmin,&decsec); 74 | printf("Equinox/BPN coords: ra:%ih%im%gs dec:%id%im%gs\n",rahr,ramin,rasec,decdegi,decmin,decsec); 75 | 76 | iauRxp(rc2t,vec,transvec); 77 | iauC2s(transvec,&theta,&phi); 78 | printf("ITRS coords: lat:%.12g long:%.12g\n",phi*180/PI,theta*180/PI); 79 | 80 | } 81 | 82 | void earth_rotation(double ep, double jd) { 83 | printf("ERA:%.12g\n",iauEra00(jd,0)); 84 | printf("GAST:%.12g\n",iauGst00b(jd,0)); 85 | printf("GMST:%.12g\n",iauGmst00(jd,0,jd,0)); 86 | } 87 | 88 | void earth_pv(double ep, double jd) { 89 | int res; 90 | double pvh[2][3],pvb[2][3]; 91 | 92 | res = iauEpv00(jd,0,pvh,pvb); 93 | 94 | if (res!=0) { 95 | printf("JD not in range 1900-2100 CE as expected by SOFA function!"); 96 | } 97 | 98 | printf("Heliocentric pos: %g,%g,%g\n",pvh[0][0],pvh[0][1],pvh[0][2]); 99 | printf("Heliocentric vel: %g,%g,%g\n",pvh[1][0],pvh[1][1],pvh[1][2]); 100 | 101 | printf("SS Barycentric pos: %g,%g,%g\n",pvb[0][0],pvb[0][1],pvb[0][2]); 102 | printf("SS Barycentric vel: %g,%g,%g\n",pvb[1][0],pvb[1][1],pvb[1][2]); 103 | } 104 | 105 | int main(int argc, const char* argv[] ){ 106 | if (argc != 4){ 107 | printf("Need command line arguments: testname epoch jd\n"); 108 | } else { 109 | double epoch,jd; 110 | char* testname = argv[1]; 111 | int doall = strcmp(testname,"all")==0; 112 | 113 | epoch = atof(argv[2]); 114 | jd = atof(argv[3]); 115 | 116 | if (doall|(strcmp(testname,"trans_matricies")==0)) { 117 | trans_matricies(epoch,jd); 118 | } 119 | if (doall|(strcmp(testname,"trans_coords")==0)) { 120 | trans_coords(epoch,jd); 121 | } 122 | if (doall|(strcmp(testname,"earth_rotation")==0)) { 123 | earth_rotation(epoch,jd); 124 | } 125 | if (doall|(strcmp(testname,"earth_pv")==0)) { 126 | earth_pv(epoch,jd); 127 | } 128 | } 129 | 130 | return 0; 131 | 132 | } 133 | -------------------------------------------------------------------------------- /tests/sofatests.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """ 3 | This script runs tests of astropysics functionality that can be tested against 4 | SOFA equivalents or semi-equivalents. 5 | """ 6 | from __future__ import division 7 | 8 | from astropysics import coords,obstools 9 | from math import pi 10 | import os 11 | import numpy as np 12 | 13 | 14 | #HELPERS 15 | def _cartesian_transform(coord): 16 | from math import sin,cos 17 | 18 | lat = coord.lat.radians 19 | lng = coord.long.radians 20 | 21 | sb = sin(lat) 22 | cb = cos(lat) 23 | sl = sin(lng) 24 | cl = cos(lng) 25 | 26 | #spherical w/ r=1 > cartesian 27 | x = cb*cl 28 | y = cb*sl 29 | z = sb 30 | return x,y,z 31 | 32 | def _computematrix(intype,outtype,epoch): 33 | #(x,y,z)=(1,0,0) 34 | incx = intype(epoch=epoch) 35 | incx.lat.d = 0 36 | incx.long.d = 0 37 | outcx = incx.convert(outtype) 38 | 39 | #(x,y,z)=(0,1,0) 40 | incy = intype(epoch=epoch) 41 | incy.lat.d = 0 42 | incy.long.d = 90 43 | outcy = incy.convert(outtype) 44 | 45 | #(x,y,z)=(0,0,1) 46 | incz = intype(epoch=epoch) 47 | incz.lat.d = 90 48 | incz.long.d = 0 49 | outcz = incz.convert(outtype) 50 | 51 | Mt = (_cartesian_transform(outcx),_cartesian_transform(outcy),_cartesian_transform(outcz)) 52 | return np.matrix(Mt).T 53 | 54 | #END HELPERS 55 | 56 | tests = [] 57 | 58 | @tests.append 59 | def earth_rotation(epoch,jd): 60 | ERA = coords.earth_rotation_angle(jd,False) 61 | print 'ERA',ERA 62 | GAST = coords.greenwich_sidereal_time(jd,True)*pi/12 63 | print '2000B GAST',GAST 64 | GMST = coords.greenwich_sidereal_time(jd,False)*pi/12 65 | print 'GMST', GMST 66 | 67 | def cmpfunc(cstdout,ERA,GAST,GMST): 68 | from warnings import warn 69 | 70 | ls = [l.split(':')[-1].strip() for l in cstdout.split('\n') if l.strip()!=''] 71 | dERA = ERA-float(ls[0]) 72 | dGAST = GAST-float(ls[1]) 73 | dGMST = GMST-float(ls[2]) 74 | 75 | for s in ('dERA','dGAST','dGMST'): 76 | val = locals()[s] 77 | if abs(val)>1e-8: 78 | warn('%s too large:%g !!!'%(s,val)) 79 | 80 | return cmpfunc,ERA,GAST,GMST 81 | 82 | @tests.append 83 | def trans_matricies(epoch,jd): 84 | icrs = coords.ICRSCoordinates(0,0,epoch=epoch) 85 | 86 | B = coords.ICRSCoordinates.frameBiasJ2000 87 | P = coords.coordsys._precession_matrix_J2000_Capitaine(epoch) 88 | N = coords.coordsys._nutation_matrix(epoch) 89 | print 'B',B #disagrees in 6thish decimal? 90 | print 'P',P #disagrees in 4thish decimal? 91 | print 'N',N #good 92 | 93 | BPN = _computematrix(coords.ICRSCoordinates,coords.EquatorialCoordinatesEquinox,epoch) 94 | print 'BPN\n',BPN 95 | C = _computematrix(coords.ICRSCoordinates,coords.CIRSCoordinates,epoch) 96 | print 'C\n',C 97 | 98 | def cmpfunc(cstdout,B,P,N,BPN,C): 99 | from warnings import warn 100 | 101 | ls = [l for l in cstdout.split('\n') if l.strip()!=''] 102 | cB = np.matrix(eval(','.join(ls[1:4]))) 103 | cP = np.matrix(eval(','.join(ls[5:8]))) 104 | cN = np.matrix(eval(','.join(ls[9:12]))) 105 | cBPN = np.matrix(eval(','.join(ls[13:16]))) 106 | cC = np.matrix(eval(','.join(ls[17:20]))) 107 | 108 | dB = np.abs(cB-B).max() 109 | dP = np.abs(cP-P).max() 110 | dN = np.abs(cN-N).max() 111 | dBPN = np.abs(cBPN-BPN).max() 112 | dC = np.abs(cC-C).max() 113 | 114 | for s in ('dB','dP','dN','dBPN','dC'): 115 | val = locals()[s] 116 | if val>5e-7: 117 | warn('%s too large:%g !!!'%(s,val)) 118 | 119 | return cmpfunc,B,P,N,BPN,C 120 | 121 | @tests.append 122 | def trans_coords(epoch,jd): 123 | icrs = coords.ICRSCoordinates('10d','20d',epoch=epoch) 124 | print icrs 125 | #print "cartesian",_cartesian_transform(icrs) 126 | c = icrs.convert(coords.CIRSCoordinates) 127 | e = icrs.convert(coords.EquatorialCoordinatesEquinox) 128 | i = icrs.convert(coords.ITRSCoordinates) 129 | print 'ICRS->',c 130 | print 'ICRS->',e 131 | print 'ICRS->',i 132 | 133 | def cmpfunc(cstdout,c,e,i): 134 | from warnings import warn 135 | 136 | ldats = [l[(l.index(':')+2):].strip() for l in cstdout.split('\n') if l.strip()!=''] 137 | racs,deccs = (ldats[0].split()[0])[3:],(ldats[0].split()[1])[4:] 138 | raes,deces = (ldats[1].split()[0])[3:],(ldats[1].split()[1])[4:] 139 | ilat,ilong = (ldats[2].split()[0])[4:],(ldats[2].split()[1])[5:] 140 | 141 | drac = coords.AngularCoordinate(racs).d-c.ra.d 142 | ddecc = coords.AngularCoordinate(deccs).d-c.dec.d 143 | drae = coords.AngularCoordinate(raes).d-e.ra.d 144 | ddece = coords.AngularCoordinate(deces).d-e.dec.d 145 | dlat = float(ilat)-i.lat.d 146 | dlong = float(ilong)-i.long.d 147 | 148 | for s in ('drac','ddecc','drae','ddece','dlat','dlong'): 149 | val = locals()[s] 150 | if abs(val)>5e-8: 151 | warn('%s too large:%g !!!'%(s,val)) 152 | 153 | 154 | return cmpfunc,c,e,i 155 | 156 | @tests.append 157 | def earth_pv(epoch,jd): 158 | p,v = coords.ephems.earth_pos_vel(jd,barycentric=False,kms=False) 159 | pb,vb = coords.ephems.earth_pos_vel(jd,barycentric=True,kms=False) 160 | 161 | print 'Heliocentric pos:',p 162 | print 'Heliocentric vel:',v/365.25 163 | print 'SS Barycentric pos:',pb 164 | print 'SS Barycentric vel:',vb/365.25 165 | 166 | def cmpfunc(cstdout,p,v,pb,vb): 167 | from warnings import warn 168 | 169 | ldats = [l.split(':')[-1].strip() for l in cstdout.split('\n') if l.strip()!=''] 170 | pc,vc,pbc,vbc = [np.array(l.split(','),dtype=float) for l in ldats] 171 | 172 | if np.abs(p-pc).max() > 1e-6: 173 | warn('earth_pv C and python do not match: p-pc=%g !!!'%(p-pc)) 174 | if np.abs(v-vc).max() > 1e-6: 175 | warn('earth_pv C and python do not match: v-vc=%g !!!'%(v-vc)) 176 | if np.abs(pb-pbc).max() > 1e-6: 177 | warn('earth_pv C and python do not match: pb-pbc=%g !!!'%(pb-pbc)) 178 | if np.abs(vb-vbc).max() > 1e-6: 179 | warn('earth_pv C and python do not match: vb-vbc=%g !!!'%(vb-vbc)) 180 | 181 | return cmpfunc,p,v/365.25,pb,vb/365.25 182 | 183 | def compile_c(): 184 | if not os.path.exists('sofatests'): 185 | res = os.system('./sofatests.build') 186 | if res != 0: 187 | raise ValueError('Could not build C sofatests. Is SOFA installed, and are the paths in sofatests.build correct?') 188 | 189 | def run_test(testname,testfunc,epoch,jd): 190 | """ 191 | Run the python and C tests with the given name and python function - the 192 | name will be used to infer the C test. 193 | 194 | if the python functions return anything other than None, it will be assumed 195 | that the first return value is a function of the form f(cstdoput,*pyreturn). 196 | """ 197 | import subprocess 198 | 199 | print '\n\n\nRunning PYTHON test',testname 200 | pyres = testfunc(epoch,jd) 201 | 202 | 203 | cmd = './sofatests %s %.16g %.16g'%(testname,epoch,jd) 204 | print '\nRunning C test',testname,'as','"'+cmd+'"' 205 | 206 | if pyres is None: 207 | os.system(cmd) 208 | else: 209 | cmpfunc = pyres[0] 210 | 211 | sp = subprocess.Popen(cmd,shell=True,stdout=subprocess.PIPE) 212 | cstdout,cstderr = sp.communicate() 213 | if sp.returncode==0: 214 | print 'C code complete - output:\n',cstdout 215 | else: 216 | print 'Problem with C - retcode',sp.returncode,'- output:\n',cstdout,'\nstd err:',cstderr 217 | 218 | cmps = [] 219 | cmps.append(cstdout) 220 | cmps.extend(pyres[1:]) 221 | print 'Comparing python to C' 222 | cmpfunc(*cmps) 223 | print 'Comparison complete' 224 | 225 | 226 | tests = [(tfunc.func_name,tfunc) for tfunc in tests] 227 | 228 | def main(compile=False,epoch=None,teststorun=None): 229 | if not os.path.exists('sofatests') or compile: 230 | print 'Compiling:','./sofatests.build' 231 | res = os.system('./sofatests.build') 232 | if res != 0: 233 | raise ValueError('Could not build C sofatests. Is SOFA installed, and are the paths in sofatests.build correct?') 234 | 235 | if epoch is None: 236 | epoch = obstools.jd_to_epoch(None) 237 | jd = obstools.epoch_to_jd(epoch) 238 | print 'No Epoch given - current:',epoch,'JD:',jd 239 | else: 240 | epoch = float(ops.epoch) 241 | jd = obstools.epoch_to_jd(ops.epoch) 242 | 243 | if teststorun is None: 244 | print 'No Tests specified - running all.' 245 | for tn,tf in tests: 246 | run_test(tn,tf,epoch,jd) 247 | print 'Done running tests!' 248 | else: 249 | testd = dict(tests) 250 | for arg in args: 251 | try: 252 | run_test(arg,testd[arg],epoch,jd) 253 | except KeyError: 254 | print "Couldn't find python test %s, skipping"%arg 255 | 256 | if __name__ == '__main__': 257 | from optparse import OptionParser 258 | 259 | op = OptionParser() 260 | op.add_option('-e','--epoch',default=None,help="the epoch to assume") 261 | op.add_option('-c','--compile',action='store_true',default=False,help="compile C tests even if they're already present") 262 | op.usage = '%prog [options] [testname1 testname2 ...]' 263 | ops,args = op.parse_args() 264 | 265 | if len(args)==0: 266 | args = None 267 | main(ops.compile,ops.epoch,args) 268 | -------------------------------------------------------------------------------- /tests/test_models.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | from __future__ import division,with_statement 3 | import numpy as np 4 | from astropysics import models 5 | 6 | def test_1d_model_funcs(): 7 | for modname in models.list_models(baseclass=models.FunctionModel1D): 8 | cls = models.get_model_class(modname) 9 | # ignore datacentric models because they are data-dependant 10 | if not issubclass(cls,models.DatacentricModel1D): 11 | #test both ways of generating the model instance 12 | if models.get_model_class(modname).isVarnumModel(): 13 | #just try it w/ 3 variable arguments w/ default values 14 | mod = cls(3,) 15 | mod = models.get_model_instance(modname,nvarparams=3) 16 | else: 17 | mod = cls() 18 | mod = models.get_model_instance(modname) 19 | 20 | if mod.rangehint is None: 21 | x1 = 0 22 | x2 = 01 23 | else: 24 | x1,x2 = mod.rangehint 25 | 26 | avgval = mod((x1+x2)/2) #single value output 27 | rangevals = mod(np.linspace(x1,x2,12)[1:-1]) #array output 28 | 29 | assert np.all(np.isfinite(avgval)),'Non-finite value encountered for model '+modname 30 | assert np.all(np.isfinite(rangevals)),'Non-finite value encountered for model '+modname 31 | 32 | 33 | if __name__ == '__main__': 34 | import nose 35 | nose.main() 36 | -------------------------------------------------------------------------------- /tests/test_objcat.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | from __future__ import division,with_statement 3 | from astropysics.constants import pi 4 | import numpy as np 5 | from astropysics.objcat import StructuredFieldNode,Catalog,Field,CycleError, \ 6 | CycleWarning,LinkField 7 | from nose import tools 8 | 9 | class Test1(StructuredFieldNode): 10 | num = Field('num',(float,int),(4.2,1,2)) 11 | num2 = Field('num2',(float,int),(5.6,1.5,0.3)) 12 | 13 | @StructuredFieldNode.derivedFieldFunc 14 | def f(num='num',num2='num2'): 15 | return 2*num+1+num2 16 | 17 | @StructuredFieldNode.derivedFieldFunc(ferr=True) 18 | def f2(num='num',num2='num2'): 19 | num,unum,lnum = num 20 | val = 2/num 21 | uerr = unum*2*num**-2 22 | lerr = lnum*2*num**-2 23 | return val,uerr,lerr 24 | 25 | @StructuredFieldNode.derivedFieldFunc 26 | def f3(num='num',num2='num2'): 27 | return num2*num 28 | 29 | class Test2(StructuredFieldNode): 30 | val = Field('val',float,4.2) 31 | 32 | @StructuredFieldNode.derivedFieldFunc 33 | def d1(val='val',d2='d2'): 34 | if d2 is not None: 35 | return val+np.exp(d2) 36 | 37 | @StructuredFieldNode.derivedFieldFunc(type=float) 38 | def d2(d1='d1'): 39 | if d1 is not None: 40 | return np.log(d1) 41 | 42 | 43 | class Test3(StructuredFieldNode): 44 | a = Field('a',float) 45 | b = Field('b',float) 46 | 47 | @StructuredFieldNode.derivedFieldFunc(units='Msun',b='b') 48 | #b2 should fail because it doesn't exist, but b='b' above overrides 49 | def d(a='a',b='b2'): 50 | return a - b/2 51 | 52 | class Test4(StructuredFieldNode): 53 | """ 54 | Tests the string locator mini-language with test_deps below. 55 | """ 56 | val4 = Field(type=float) 57 | top = LinkField(type=Test1) 58 | 59 | @StructuredFieldNode.derivedFieldFunc 60 | def d1(val4='val4',val='^-val',num='^^-num'): 61 | return val4+val+num 62 | 63 | @StructuredFieldNode.derivedFieldFunc 64 | def d2(val4='^.0-val4',val='^^.0-val',num='.top-num'): 65 | return val4+val+num 66 | 67 | def test_deps(): 68 | """ 69 | Test DependentValue objects. 70 | 71 | They must correctly deduce their values and follow the proper rules. 72 | """ 73 | import warnings 74 | 75 | #supress warnings from initialization of cycle-producing objects 76 | warnings.simplefilter('ignore',CycleWarning) 77 | 78 | #check basic dependency results and units 79 | o2 = Test2(None) 80 | tools.assert_equal(o2.val(),4.2) #default value 81 | 82 | #these should both result in a cycle with each other 83 | tools.assert_raises(CycleError,o2.d1) 84 | tools.assert_raises(CycleError,o2.d2) 85 | 86 | #Try setting o2.d2 to various non-float objects, unless they're float-able 87 | def settoval(o,val): 88 | o[None] = val 89 | tools.assert_raises(TypeError,settoval,o2.d2,'astring') 90 | #tools.assert_raises(TypeError,settoval,o2.d2,1) 91 | tools.assert_raises(TypeError,settoval,o2.d2,[4.0,2.3]) 92 | #tools.assert_raises(TypeError,settoval,o2.d2,np.array(1.5)) 93 | 94 | o2.d2[None] = 1.5 95 | #should still fail b/c it is not set to the current value 96 | tools.assert_raises(CycleError,o2.d1) 97 | o2['d2'] = None #sets current to None/default 98 | tools.assert_almost_equal(o2.d1(),8.6816890703380647,12) 99 | 100 | def test_locator_language(): 101 | """ 102 | Test derived value locator mini-language. 103 | """ 104 | #need tree of the form T1->T2->T4 for T4 to work correctly. 105 | o1 = Test1(None) 106 | o2 = Test2(o1) 107 | o4 = Test4(o2) 108 | 109 | o4.top[None] = o1 110 | o4.val4[None] = 4.2 111 | 112 | #both derived values should give the same result 113 | tools.assert_equal(o4.d1(),o4.d2()) 114 | 115 | def test_derived_order(): 116 | """ 117 | Test that drived value arguments appeare in proper order. 118 | """ 119 | o3 = Test3(None) 120 | o3['a'] = (None,930016275284.81763) 121 | o3['b'] = (None,3000000000.0) 122 | 123 | #If a and b are swapped, this gives the wrong answer. 124 | tools.assert_equal(o3.d(),o3.a()-o3.b()/2.0) 125 | 126 | 127 | def test_cat(): 128 | """ 129 | Test Catalog objects and related basic actions 130 | """ 131 | c = Catalog() 132 | t1 = Test1(c) 133 | t2 = Test1(c) 134 | t2['num'] = ('testsrc1',7) 135 | 136 | subc = Catalog('sub-cat',c) 137 | ts1 = Test1(subc) 138 | ts1['num'] = ('testsrc2',8.5) 139 | ts2 = Test1(subc,num=('testsrc2',12.7),f=('testows',123.45)) 140 | ts3 = Test1(subc) 141 | ts3['num'] = ('testsrc2',10.3) 142 | 143 | return c 144 | 145 | def test_sed(): 146 | """ 147 | Test SEDField 148 | """ 149 | from numpy.random import randn,rand 150 | from numpy import linspace 151 | from astropysics.spec import Spectrum 152 | from astropysics.phot import PhotObservation 153 | from astropysics.models import BlackbodyModel 154 | from astropysics.objcat import SEDField 155 | 156 | f = SEDField() 157 | scale = 1e-9 158 | 159 | f['s1'] = Spectrum(linspace(3000,8000,1024),scale*(randn(1024)/4+2.2),scale*rand(1024)/12) 160 | m = BlackbodyModel(T=3300) 161 | m.peak = 2.2 162 | x2 = linspace(7500,10000,512) 163 | err = randn(512)/12 164 | f['s2'] = Spectrum(x2,scale*(m(x2)+err),scale*err) 165 | 166 | f['o1'] = PhotObservation('BVRI',[13,12.1,11.8,11.5],.153) 167 | f['o2'] = PhotObservation('ugriz',randn(5,12)+12,rand(5,12)/3) 168 | 169 | return f 170 | -------------------------------------------------------------------------------- /tests/test_obs_site.py: -------------------------------------------------------------------------------- 1 | import astropysics.coords 2 | import astropysics.obstools 3 | import datetime, pytz 4 | import unittest 5 | 6 | from astropysics.coords.coordsys import FK5Coordinates 7 | 8 | #--------------------------------------------------------------------------- 9 | #Test data: 10 | 11 | def greenwich(): 12 | return astropysics.obstools.Site(lat=51.5, 13 | long=0, 14 | alt=0, 15 | tz=0, 16 | name="Greenwich" 17 | ) 18 | 19 | vernal_equinox_2012 = datetime.datetime(2012, 03, 20, 20 | 5, 14, 21 | tzinfo=pytz.utc) 22 | 23 | vernal_equinox_2012_p12h = vernal_equinox_2012 + datetime.timedelta(hours=12) 24 | 25 | 26 | #Greenwich LST at V.E. (h:m:s) = 17:6:32 approx 27 | greenwish_lst_at_ve = 17.1096992 #decimal hours 28 | #12 hours later: 29 | greenwish_lst_at_ve_p12h = 5.1425530145722549 30 | 31 | 32 | ##NB this is approximately zenith at the 2012 vernal equinox (at greenwich): 33 | equatorial_transiting_at_ve = FK5Coordinates("17:6:32 +0.0 J2000.0") 34 | equatorial_transiting_at_ve_p12hr = FK5Coordinates("5:6:32 +0.0 J2000.0") 35 | equatorial_transiting_at_ve_m1hr = FK5Coordinates("16:6:32 +0.0 J2000.0") 36 | 37 | #NB, this one sets the day after VE. 38 | equatorial_transiting_at_ve_p13hr = FK5Coordinates("6:6:32 +0.0 J2000.0") 39 | 40 | equatorial_transiting_at_ve_m5hr = FK5Coordinates("12:6:32 +0.0 J2000.0") 41 | 42 | #NB, this has not set from yesterdays transit at VE. 43 | equatorial_transiting_at_ve_m6hr = FK5Coordinates("11:6:32 +0.0 J2000.0") 44 | 45 | circumpolar_north_transit_at_ve_m1hr = FK5Coordinates("16:6:32 +89.0 J2000.0") 46 | circumpolar_north_transit_at_ve = FK5Coordinates("17:6:32 +89.0 J2000.0") 47 | circumpolar_north_transit_at_ve_p12hr = FK5Coordinates("5:6:32 +89.0 J2000.0") 48 | 49 | never_visible_source = FK5Coordinates("17:6:32 -70.0 J2000.0") 50 | #--------------------------------------------------------------------------- 51 | 52 | 53 | class TestLocalToSiderealConversions(unittest.TestCase): 54 | def setUp(self): 55 | self.site = greenwich() 56 | 57 | def test_local_sidereal_time(self): 58 | computed_lst_at_ve = self.site.localSiderialTime(vernal_equinox_2012) 59 | self.assertAlmostEqual(computed_lst_at_ve, greenwish_lst_at_ve) 60 | 61 | computed_lst_at_ve_p12 = self.site.localSiderialTime(vernal_equinox_2012 + 62 | datetime.timedelta(hours=12)) 63 | self.assertAlmostEqual(computed_lst_at_ve_p12 , greenwish_lst_at_ve_p12h) 64 | 65 | def test_local_time_at_ve(self): 66 | computed_local_time_at_ve = self.site.localTime(greenwish_lst_at_ve, 67 | vernal_equinox_2012.date(), 68 | returntype='datetime', 69 | utc=True) 70 | self.assertEqual(computed_local_time_at_ve.date(), 71 | vernal_equinox_2012.date()) 72 | 73 | ct = computed_local_time_at_ve 74 | ve = vernal_equinox_2012 75 | delta = max(ct, ve) - min(ct, ve) 76 | self.assertTrue(abs(delta.seconds) < 30) 77 | 78 | def test_local_time_at_ve_p12h(self): 79 | computed_local_time_at_ve_p12 = self.site.localTime(greenwish_lst_at_ve_p12h, 80 | vernal_equinox_2012.date(), 81 | returntype='datetime', 82 | utc=True) 83 | self.assertEqual(computed_local_time_at_ve_p12.date(), 84 | vernal_equinox_2012.date()) 85 | 86 | ct = computed_local_time_at_ve_p12 87 | ve_p12 = vernal_equinox_2012_p12h 88 | delta = max(ct, ve_p12) - min(ct, ve_p12) 89 | self.assertTrue(abs(delta.seconds) < 30) 90 | 91 | 92 | class TestRiseSetTransit(unittest.TestCase): 93 | def setUp(self): 94 | self.site = greenwich() 95 | 96 | def test_on_sky_equatorial_source(self): 97 | 98 | r, s, t = self.site.riseSetTransit(eqpos=equatorial_transiting_at_ve, 99 | date=vernal_equinox_2012.date(), 100 | timeobj=True, 101 | utc=True 102 | ) 103 | for result in r, s, t: 104 | self.assertIsInstance(result, datetime.datetime) 105 | 106 | #Always True (by specification): 107 | self.assertEqual(t.date(), vernal_equinox_2012.date()) 108 | 109 | #True in this case: 110 | self.assertTrue(r.date() < vernal_equinox_2012.date()) 111 | self.assertEqual(s.date(), vernal_equinox_2012.date()) 112 | 113 | ve = vernal_equinox_2012 114 | delta = max(t, ve) - min(t, ve) 115 | self.assertTrue(delta.seconds < 30) 116 | 117 | def test_off_sky_equatorial_source(self): 118 | 119 | r, s, t = self.site.riseSetTransit(eqpos=equatorial_transiting_at_ve_p12hr, 120 | date=vernal_equinox_2012.date(), 121 | timeobj=True, 122 | utc=True 123 | ) 124 | for result in r, s, t: 125 | self.assertIsInstance(result, datetime.datetime) 126 | 127 | #Always True (by specification): 128 | self.assertEqual(t.date(), vernal_equinox_2012.date()) 129 | 130 | #True in this case: 131 | self.assertEqual(r.date() , vernal_equinox_2012.date()) 132 | self.assertEqual(s.date(), vernal_equinox_2012.date()) 133 | # 134 | ve_p12 = vernal_equinox_2012_p12h 135 | delta = max(t, ve_p12) - min(t, ve_p12) 136 | self.assertTrue(delta.seconds < 140) 137 | 138 | def test_source_setting_tomorrow(self): 139 | 140 | r, s, t = self.site.riseSetTransit(eqpos=equatorial_transiting_at_ve_p13hr, 141 | date=vernal_equinox_2012.date(), 142 | timeobj=True, 143 | utc=True 144 | ) 145 | for result in r, s, t: 146 | self.assertIsInstance(result, datetime.datetime) 147 | 148 | #Always True (by specification): 149 | self.assertEqual(t.date(), vernal_equinox_2012.date()) 150 | 151 | #True in this case: 152 | self.assertEqual(r.date() , vernal_equinox_2012.date()) 153 | self.assertGreater(s.date(), vernal_equinox_2012.date()) 154 | 155 | 156 | def regression_test_equatorial_sources(self): 157 | #NB these were simply generated by desk-checking current 158 | #(sensible looking) output. 159 | #So it's currently just a regression test. 160 | #TO DO: Implement a cross-check against pyephem / catalog results. 161 | 162 | previous_sensible_results = [ 163 | ['2012-03-19 23:11:18.175698+00:00', # Rose yesterday evening 164 | '2012-03-20 11:16:36.004857+00:00', 165 | '2012-03-20 05:13:57.090277+00:00'], #Transit 5am VE day 166 | ['2012-03-20 11:09:20.223480+00:00', 167 | '2012-03-20 23:14:38.052638+00:00', 168 | '2012-03-20 17:11:59.138059+00:00'], #Transit ~5pm VE day 169 | ['2012-03-20 12:09:10.394128+00:00', 170 | '2012-03-21 00:14:28.223287+00:00', #Sets day after VE 171 | '2012-03-20 18:11:49.308707+00:00'] 172 | ] 173 | 174 | test_results = [] 175 | for pos in (equatorial_transiting_at_ve, 176 | equatorial_transiting_at_ve_p12hr, 177 | equatorial_transiting_at_ve_p13hr) : 178 | r, s, t = self.site.riseSetTransit(eqpos=pos, 179 | date=vernal_equinox_2012.date(), 180 | timeobj=True, utc=True 181 | ) 182 | test_results.append([str(r), str(s), str(t)]) 183 | # print 184 | # print test_results 185 | # print 186 | self.assertEqual(previous_sensible_results, test_results) 187 | 188 | def test_circumpolar_source(self): 189 | for t in vernal_equinox_2012, vernal_equinox_2012_p12h: 190 | r, s, t = self.site.riseSetTransit(circumpolar_north_transit_at_ve, 191 | t.date(), 192 | timeobj=True, utc=True 193 | ) 194 | 195 | equinox_day = vernal_equinox_2012.date() 196 | self.assertEqual(t.date(), equinox_day) 197 | self.assertEqual([r, s], [None, None]) 198 | 199 | 200 | def test_never_visible_source(self): 201 | for t in vernal_equinox_2012, vernal_equinox_2012_p12h: 202 | r, s, t = self.site.riseSetTransit(eqpos=never_visible_source, 203 | date=t.date(), 204 | timeobj=True, utc=True 205 | ) 206 | self.assertEqual([r, s, t], [None, None, None]) 207 | 208 | 209 | class TestNextRiseSetTransit(unittest.TestCase): 210 | def setUp(self): 211 | self.site = greenwich() 212 | 213 | def test_circumpolar_source_not_yet_transited_today(self): 214 | r, s, t = self.site.nextRiseSetTransit(circumpolar_north_transit_at_ve_p12hr, 215 | vernal_equinox_2012, 216 | ) 217 | self.assertEqual(t.date(), vernal_equinox_2012.date()) 218 | self.assertGreater(t, vernal_equinox_2012) 219 | self.assertEqual([r, s], [None, None]) 220 | 221 | def test_circumpolar_source_already_transited_today(self): 222 | r, s, t = self.site.nextRiseSetTransit(circumpolar_north_transit_at_ve_m1hr, 223 | vernal_equinox_2012, 224 | ) 225 | self.assertGreater(t.date(), vernal_equinox_2012.date()) 226 | self.assertGreater(t, vernal_equinox_2012) 227 | self.assertEqual([r, s], [None, None]) 228 | 229 | def test_never_visible_source(self): 230 | for t in vernal_equinox_2012, vernal_equinox_2012_p12h: 231 | r, s, t = self.site.nextRiseSetTransit(never_visible_source, 232 | t, 233 | ) 234 | self.assertEqual([r, s, t], [None, None, None]) 235 | 236 | def test_equatorial_source_yesterdays_transit_still_up(self): 237 | r, s, t = self.site.riseSetTransit(equatorial_transiting_at_ve_m6hr, 238 | vernal_equinox_2012.date() - datetime.timedelta(1), 239 | timeobj=True, utc=True 240 | ) 241 | self.assertLess(r.date(), vernal_equinox_2012.date()) 242 | self.assertLess(t.date(), vernal_equinox_2012.date()) 243 | self.assertLess(vernal_equinox_2012, s) 244 | 245 | r, s, t = self.site.nextRiseSetTransit(equatorial_transiting_at_ve_m6hr, 246 | vernal_equinox_2012, 247 | ) 248 | self.assertLess(t.date(), vernal_equinox_2012.date()) 249 | self.assertLess(vernal_equinox_2012, s) 250 | 251 | def test_equatorial_source_todays_transit_still_up(self): 252 | r, s, t = self.site.nextRiseSetTransit(equatorial_transiting_at_ve_m1hr, 253 | vernal_equinox_2012, 254 | ) 255 | self.assertEqual(t.date(), vernal_equinox_2012.date()) 256 | self.assertLess(vernal_equinox_2012, s) 257 | 258 | def test_equatorial_source_todays_transit_not_yet_risen(self): 259 | r, s, t = self.site.riseSetTransit(equatorial_transiting_at_ve_p12hr, 260 | vernal_equinox_2012.date(), 261 | timeobj=True, utc=True 262 | ) 263 | 264 | self.assertEqual(t.date(), vernal_equinox_2012.date()) 265 | self.assertLess(vernal_equinox_2012, r) 266 | 267 | r, s, t = self.site.nextRiseSetTransit(equatorial_transiting_at_ve_p12hr, 268 | vernal_equinox_2012) 269 | 270 | self.assertEqual(t.date(), vernal_equinox_2012.date()) 271 | self.assertLess(vernal_equinox_2012, r) 272 | 273 | 274 | class TestOnSky(unittest.TestCase): 275 | def setUp(self): 276 | self.site = greenwich() 277 | 278 | def test_equatorial_source_yesterdays_transit_still_up(self): 279 | on_sky = self.site.onSky(equatorial_transiting_at_ve_m6hr, 280 | vernal_equinox_2012, 281 | ) 282 | self.assertTrue(on_sky) 283 | 284 | def test_equatorial_source_after_setting(self): 285 | on_sky = self.site.onSky(equatorial_transiting_at_ve_m5hr, 286 | vernal_equinox_2012_p12h, 287 | ) 288 | self.assertFalse(on_sky) 289 | 290 | def test_equatorial_source_todays_transit_on_sky(self): 291 | on_sky = self.site.onSky(equatorial_transiting_at_ve, 292 | vernal_equinox_2012, 293 | ) 294 | self.assertTrue(on_sky) 295 | 296 | 297 | def test_equatorial_source_todays_transit_not_up(self): 298 | on_sky = self.site.onSky(equatorial_transiting_at_ve_p13hr, 299 | vernal_equinox_2012, 300 | ) 301 | self.assertFalse(on_sky) 302 | -------------------------------------------------------------------------------- /tests/test_pub.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | from __future__ import division,with_statement 3 | 4 | import sys,os,difflib 5 | from astropysics import publication 6 | 7 | def test_tex_file(fn=None,htmldiff=None): 8 | if fn is None: 9 | testdir = os.path.split(os.path.realpath(__file__))[0] 10 | fn = testdir + os.sep + 'test_pub.tex' 11 | with open(fn) as f: 12 | orig = f.read().split('\n') 13 | tfstr = publication.TeXFile(fn)().split('\n') 14 | 15 | diffres = list(difflib.unified_diff(orig,tfstr)) 16 | if htmldiff: 17 | hd = difflib.HtmlDiff() 18 | htmlres = hd.make_file(orig,tfstr) 19 | with open(htmldiff,'w') as f: 20 | f.write(htmlres) 21 | else: 22 | for l in diffres: 23 | print l 24 | assert len(diffres)==0,'TeXFile string does not match original file '+os.path.split(fn)[1] 25 | 26 | if __name__ == '__main__': 27 | if len(sys.argv) > 1: 28 | test_tex_file(htmldiff=sys.argv[1]) 29 | else: 30 | test_tex_file() 31 | -------------------------------------------------------------------------------- /tests/test_pub.tex: -------------------------------------------------------------------------------- 1 | %\documentclass{aastex} 2 | %\documentclass[preprint]{aastex} 3 | %\documentclass[preprint2]{aastex} 4 | \documentclass{emulateapj} 5 | \usepackage{natbib} 6 | \usepackage{times} 7 | \usepackage{graphicx} 8 | \usepackage{amsmath} 9 | 10 | \newcommand{\comment}[2]{{\bf #1 : #2}} 11 | 12 | \begin{document} 13 | 14 | \title{A longwinded subtitle: towards a proper analysis of multitextual survey data to prove that every title needs one} 15 | \shorttitle{co} 16 | 17 | \keywords{Galaxies: observation} 18 | \author{Erik J. Tollerud\altaffilmark{1}, Elizabeth J. Barton\altaffilmark{1}, James S. Bullock \altaffilmark{1}} 19 | \altaffiltext{1}{Center for Cosmology, Department of Physics and Astronomy, The University of California at Irvine, Irvine, CA, 92697, USA} 20 | 21 | \begin{abstract} 22 | Newton was an abstract thinker. 23 | 24 | \end{abstract} 25 | 26 | \section{Introduction} 27 | \label{sec:intro} 28 | I shall begin!\citep{NC} 29 | 30 | 31 | \section{Conclusions} 32 | \label{sec:conc} 33 | 34 | 35 | We wish to acknowledge someone or other. 36 | 37 | %{\it Facilities:} \facility{SDSS} 38 | 39 | \bibliography{paper}{} 40 | \bibliographystyle{hapj} 41 | 42 | \end{document} 43 | 44 | % \begin{figure}[htbp!] 45 | % \plotone{figure} 46 | % \caption{Oh caption, my caption!} 47 | % \label{fig:name} 48 | % \end{figure} 49 | 50 | 51 | % \begin{deluxetable*}{cccc} 52 | % \tablecolumns{4} 53 | % \tablecaption{This notion is tabled.} 54 | % \tablehead{ 55 | % \colhead{Name} & 56 | % \colhead{Good Data} & 57 | % \colhead{Bad Data} & 58 | % \colhead{Ugly Data} 59 | % } 60 | % \startdata 61 | % NGC Awesome & $10 \pm 0.2$ & $10 \pm 8$ & $10 \pm 123.56$ \\ 62 | % NGC 31415 & 9 & 2 & 6 63 | % \enddata 64 | % \label{tab:tabs} 65 | % \end{deluxetable*} 66 | 67 | --------------------------------------------------------------------------------