SpacePy - Space Science Library for Python


SpacePy is a package for Python, targeted at the space sciences, that aims to make basic data analysis, modeling and visualization easier. It builds on the capabilities of the well-known NumPy and MatPlotLib packages. Publication quality output direct from analyses is emphasized among other goals:

  • Quickly obtain data
  • Read (and write) data from (and to) data formats like NASA CDF and HDF5
  • Create publications quality plots
  • Perform complicated analysis easily
  • Run common empirical models
  • Change coordinates and time systems effortlessly
  • Harness the power of Python

The SpacePy project seeks to promote accurate and open research standards by providing an open environment for code development. In the space physics community there has long been a significant reliance on proprietary languages that restrict free transfer of data and reproducibility of results. By providing a comprehensive, open-source library of widely-used analysis and visualization tools in a free, modern and intuitive language, we hope that this reliance will be diminished.

To help foster an open and welcoming environment, we have adopted a code of conduct that we encourage members of the SpacePy community to read and follow.

Getting SpacePy

Our latest release version is available through PyPI and can be installed using

pip install spacepy --user

This will also automatically install most dependencies. To permit binary installations without a compiler, this will not install ffnet on Windows. Users needing the LANLstar module can install ffnet separately (requires Fortran compiler); this can be done before or after the SpacePy install.

The latest "bleeding-edge" source code is available from our github repository at and can be installed using the standard

python install --user

Further installation documentation can be found here Mac-specific information can be found here Full documentation is at

SpacePy supports both Python 2.7 and 3.x.


SpacePy has a number of well-maintained dependencies, most of which are automatically installed by pip. These include:

  • numpy (>=1.10, !=1.15.0)
  • scipy (>=0.11)
  • matplotlib (>=1.5)
  • h5py

Soft dependencies (that are required only for a very limited part of SpacePy's functionality) are:

  • ffnet

For complete installation, excepting pre-built Windows binaries, SpacePy also requires C and Fortran compilers. We test with GCC compilers but try to maintain support for all major compilers.


If you wish to use CDF files, download and install the NASA CDF library. The default installation directory is recommended to help SpacePy find the library. Get the package from


When publishing research which used SpacePy, please provide appropriate credit to the SpacePy team via citation or acknowledgement.

To cite SpacePy in publications, use (BibTeX code):

author = {{Morley}, S.~K. and {Koller}, J. and {Welling}, D.~T. and {Larsen}, B.~A. and {Henderson}, M.~G. and {Niehof}, J.~T.},
title = "{Spacepy - A Python-based library of tools for the space sciences}",
booktitle = "{Proceedings of the 9th Python in science conference (SciPy 2010)}",
year = 2011,
address = {Austin, TX}

Certain modules may provide additional citations in the __citation__ attribute. Contact a module's author before publication or public presentation of analysis performed by that module. This allows the author to validate the analysis and receive appropriate credit for his or her work.

For acknowledging SpacePy, please provide the URL to our github repository.

Download Details:
Author: spacepy
The Demo/Documentation: View The Demo/Documentation
Download Link: Download The Source Code
Official Website: 

#python #spacepy #datascience 

What is GEEK

Buddha Community

SpacePy - Space Science Library for Python
Teresa  Jerde

Teresa Jerde


Space Science with Python — A very bright Opposition


This is the 19th part of my Python tutorial series “Space Science with Python”. All codes that are shown here are uploaded on GitHub. Enjoy!


Today, we will cover another brightness related topic: the computation and determination of the apparent magnitude of asteroids. We cover some more conceptual topics in the next article and then we will start with an asteroid related science project, coming with tutorial #20! If you need some information about the magnitude scale in astronomy, I would recommend to go first with my previous article:

Space Science with Python — Bright Dots in the Dark Sky

Part 16 of the tutorial series describes another important basic concept in Space Science: the brightness of objects.

The complex nature of reflections

Did you take a look in the mirror this morning? Probably. But this space science article is not about your perception of yourself; it is about the laws of physics behind it. Plane mirrors and their reflective properties can easily be explained: Entrance Angle of the light = Exit Angle of the light. Done.But in space we do not have mirrors or simple geometries that allow us to compute the brightness of e.g., comets, meteors or asteroids. Most equations in this regard are empirically determined and are only valid within a certain solution space. In this article, we will continue with the topic that started some sessions ago: Asteroids.

#python #space #science #data-science #space-science-with-python

Space Science with Python - Uncertain Movements of an Asteroid

Tunguska 1908

It’s the 30th June 1908. A huge explosion devastated in a short period of time hundreds of square-kilometres in the Russian region of Tunguska. Millions of trees were bend and burnt down in this Siberian region. For the researchers and people who live there, this so-called Tunguska Event was a mystery of unknown cause.

This coloured photo was taken 21 years after the Tunguska Event. The logs point away from a theoretical shock wave direction (right to left). Image from Wikipedia; Credit: Vokrug Sveta

_What happened? _Well, there are several explanations:

  • A gas explosion. A large amount of methane or other gases ignited and caused this event.Another geophysical explanation: A volcanic-like eruption was mistaken for an explosion and devastated everything around the eruption centreAn asteroid or comet entered the Earth’s atmosphere and exploded on its way to the surface. Similar as the Meteor of Chelyabinsk in the year 2013 that had a diameter of only 20 m

Dash cam footage of the Chelyabinsk meteor in Russia. An explosion, several km above the surface caused a shock wave that destroyed doors, gates and windows. Hundreds of people have been injured, but luckily no one died.

The last option is currently the most accepted theory. One assumes that the diameter of this asteroid was between 30 and 70 metres. It shows that even small celestial objects can have a catastrophic environmental impact on our home planet .
To remind us of cosmic hazards the Asteroid Day was introduced a few years ago. The date: 30th June — The day of the Tunguska Event.

#python #data-science #space-science-with-python #science #space

Space Science with Python — Density Estimators in the Sky

Last time

Last week was Asteroid Day! A day that was introduced to remind us that cosmic threats are real … not only for the Dinosaurs, but also in recent decades like the Tunguska event in 1908 or the Meteor of Chelyabinsk in the year 2013.

Observation surveys, follow up measurements, simulations, and so on are required to catalogue and understand our very cosmic vicinity. Currently, there are no larger objects on a direct collision course with our blue planet. However, observational errors propagate through to data and do not allow us to determine the position of an object with 100 % accuracy. The error-bars depend on the number of observations, observational conditions, total observation time, the distance to the object, its movement and brightness and other factors. It is a multi-dimensional error that can only be faced with more and more and even more data.Luckily, 2020 JX1 is a “good” asteroid and the error-bars during the recent fly-by were quite small (considering cosmic scales).But X, Y and Z coordinates do not help us at all … we need to set ecliptic, equatorial or azimuthal coordinates for our telescopes. Further, we have a solution space of Cartesian coordinates. _How can we translate this solution space to a proper ecliptic coordinate system function? _Let’s find out!

Space Science with Python — Space maps

Part 5 of the tutorial series shows how to calculate and understand coordinate systems that are used for all upcoming…

Multidimensional Kernel Density Estimators

scikit-learnis a great resource for data science and machine learning algorithms. The library covers classifications, dimension reduction, as well as feature engineering and also clustering methods. The sophisticated documentation provides examples for miscellaneous use cases: One example covers the application of Kernel Density Estimators (KDEs) in spherical coordinates. Instead of the Euclidean metric, this example uses the so-called Haversine metric that is applied on the longitude and latitude values in radians:

A KDE for ecliptic longitude and latitude coordinates appears suitable: Let’s go.For this tutorial, we use the already introduced libraries numpypandastqdm and maptlotlib. We then load the data that were created last time (the file is also part of the GitHub repository).

#data-science #science #space #space-science-with-python #python

Space Science with Python - Bright Dots in the Dark Sky


This is the 16th part of my Python tutorial series “Space Science with Python”. All codes that are shown here are uploaded on GitHub. Enjoy!

Take a look

Where do you live? In the city? In a rural town? In some remote place in the mountains?And did you take a look at the night sky? There are vast differences of the night sky’s appearance depending on where you live. Thanks to our modern lifestyle, the so-called light pollution erased the night’s tapestry: The Stars.Take a look outside this night. You see differently sized and coloured stars. You can try to classify the brightness of stars by comparing them with their neighbouring star. Which one is brighter, or fainter?

A 2000 year old definition …

The old Greek did probably the same. And since stellar constellations were important for agriculture, nautical navigation or even astrology, they also started to classify the brightness of the stars. The idea: the brightest stars are Magnitude 1 stars and the faintest that are barely visible to the naked eye belong to the Magnitude 6. Further, a difference of 1 magnitude (short: mag or ᵐ) corresponds to a factor of 2 for the difference in brightness.

… And a modern re-definition

Modern astronomy is not limited to the unaided eye and the definition above cannot be applied mathematically since it highly depends on the subjective perception. The human senses or perceptions are mostly logarithmically and follow the Weber–Fechner law. A star with a magnitude 1 appears to be twice as bright as a star with a magnitude of 2. However, the corresponding actual flux density (power per area: W/m²) does not scale linearly.The modern magnitude definition of an object (obj) is shown below and is always compared to a reference (ref) source. _m _represents the magnitude and has no dimensionality. _I _is the corresponding flux density.

Brightness computations can be very complex and depend on the scientific questions. The calculations may consider the solid angle, wavelength or different filters.The following figure shows the standard UBV photometric system that shows only a fraction of all commonly used filters. The shown filter functions define a filter transmission depending on the light’s wavelength:
U: The ultra-violet filter has its peak at 364 nm
B: The blue filter has its peak at 442 nm
V: The yellow filter, or Visual filter has its peak at 540 nm and can be seen as a rough approximation of the human perception.

Objects have different density fluxes depending on the filter. Simple filter relations like the value of B minus V indicate the colour of an object. A negative B-Vvalue corresponds to a bluish and a positive value to a reddish colour. Based on these colour indices scientists can derive essential properties of stars or asteroids.

#science #space-science-with-python #space #data-science #python

Shardul Bhatt

Shardul Bhatt


Why use Python for Software Development

No programming language is pretty much as diverse as Python. It enables building cutting edge applications effortlessly. Developers are as yet investigating the full capability of end-to-end Python development services in various areas. 

By areas, we mean FinTech, HealthTech, InsureTech, Cybersecurity, and that's just the beginning. These are New Economy areas, and Python has the ability to serve every one of them. The vast majority of them require massive computational abilities. Python's code is dynamic and powerful - equipped for taking care of the heavy traffic and substantial algorithmic capacities. 

Programming advancement is multidimensional today. Endeavor programming requires an intelligent application with AI and ML capacities. Shopper based applications require information examination to convey a superior client experience. Netflix, Trello, and Amazon are genuine instances of such applications. Python assists with building them effortlessly. 

5 Reasons to Utilize Python for Programming Web Apps 

Python can do such numerous things that developers can't discover enough reasons to admire it. Python application development isn't restricted to web and enterprise applications. It is exceptionally adaptable and superb for a wide range of uses.

Robust frameworks 

Python is known for its tools and frameworks. There's a structure for everything. Django is helpful for building web applications, venture applications, logical applications, and mathematical processing. Flask is another web improvement framework with no conditions. 

Web2Py, CherryPy, and Falcon offer incredible capabilities to customize Python development services. A large portion of them are open-source frameworks that allow quick turn of events. 

Simple to read and compose 

Python has an improved sentence structure - one that is like the English language. New engineers for Python can undoubtedly understand where they stand in the development process. The simplicity of composing allows quick application building. 

The motivation behind building Python, as said by its maker Guido Van Rossum, was to empower even beginner engineers to comprehend the programming language. The simple coding likewise permits developers to roll out speedy improvements without getting confused by pointless subtleties. 

Utilized by the best 

Alright - Python isn't simply one more programming language. It should have something, which is the reason the business giants use it. Furthermore, that too for different purposes. Developers at Google use Python to assemble framework organization systems, parallel information pusher, code audit, testing and QA, and substantially more. Netflix utilizes Python web development services for its recommendation algorithm and media player. 

Massive community support 

Python has a steadily developing community that offers enormous help. From amateurs to specialists, there's everybody. There are a lot of instructional exercises, documentation, and guides accessible for Python web development solutions. 

Today, numerous universities start with Python, adding to the quantity of individuals in the community. Frequently, Python designers team up on various tasks and help each other with algorithmic, utilitarian, and application critical thinking. 

Progressive applications 

Python is the greatest supporter of data science, Machine Learning, and Artificial Intelligence at any enterprise software development company. Its utilization cases in cutting edge applications are the most compelling motivation for its prosperity. Python is the second most well known tool after R for data analytics.

The simplicity of getting sorted out, overseeing, and visualizing information through unique libraries makes it ideal for data based applications. TensorFlow for neural networks and OpenCV for computer vision are two of Python's most well known use cases for Machine learning applications.


Thinking about the advances in programming and innovation, Python is a YES for an assorted scope of utilizations. Game development, web application development services, GUI advancement, ML and AI improvement, Enterprise and customer applications - every one of them uses Python to its full potential. 

The disadvantages of Python web improvement arrangements are regularly disregarded by developers and organizations because of the advantages it gives. They focus on quality over speed and performance over blunders. That is the reason it's a good idea to utilize Python for building the applications of the future.

#python development services #python development company #python app development #python development #python in web development #python software development