Giter Club home page Giter Club logo

planetmapper's Introduction

PlanetMapper logo

PyPI Version Conda Version Publish Workflow Status Checks Workflow Status Documentation Status Coverage Status JOSS Paper DOI

PlanetMapper is an open source Python package for visualising, navigating and mapping Solar System observations.

For full documentation and API reference, visit planetmapper.readthedocs.io.

pip install planetmapper --upgrade
conda install -c conda-forge planetmapper

Requires Python 3.10+

Citing PlanetMapper

If you use PlanetMapper in your research, please cite the following paper:

King et al., (2023). PlanetMapper: A Python package for visualising, navigating and mapping Solar System observations. Journal of Open Source Software, 8(90), 5728, https://doi.org/10.21105/joss.05728

Citation BibTeX entry
@article{king_2023_planetmapper,
  author  = {King, Oliver R. T. and Fletcher, Leigh N.},
  doi     = {10.21105/joss.05728},
  journal = {Journal of Open Source Software},
  month   = oct,
  number  = {90},
  pages   = {5728},
  title   = {{PlanetMapper: A Python package for visualising, navigating and mapping Solar System observations}},
  url     = {https://joss.theoj.org/papers/10.21105/joss.05728},
  volume  = {8},
  year    = {2023}
}

Each PlanetMapper version is also archived on Zenodo at doi.org/10.5281/zenodo.7963121.

Key features

Screenshot of the PlanetMapper graphical user interface showing an observation of Europa being navigated

body = planetmapper.Body('saturn', '2020-01-01')
body.plot_wireframe_radec()
plt.show()

Image of Saturn generated with PlanetMapper showing the orientation of Saturn and its rings

Plot of a mapped Jupiter observation, generated with PlanetMapper, showing observed and mapped versions of the Jupiter data

Contributing

If you spot a bug, or want contribute code to PlanetMapper, check out the contributing guidelines.

Help and support

If you have any questions, suggestions or feedback, please visit our support page and get in touch!

planetmapper's People

Contributors

ortk95 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

planetmapper's Issues

Save settings

  • Save settings to file
  • Add option to reset settings

Allow location on observer body to be specified

May be useful to specify location as e.g. Paranal rather than just Earth. Unlikely to make too much difference to geometry (lat/lon <-> xy etc.) but probably more important for e.g. doppler shift calculations.

Testing

Manual tests

  • Test on different operating systems
  • Test with different python versions
  • Test e.g. plotting Europa xy wireframe with overlaid circle to ensure they line up
ax = o.plot_wirefeame_xy(show=False)
circle = matplotlib.patches.Circle(
    (o.get_x0(), o.get_y0()), radius=o.get_r0(), fc='none', ec='r'
)
ax.add_patch(circle)
plt.show()

Unit tests

  • Add basic round trip tests
  • Add tests for known backplane outputs
  • Add tests for file IO etc.

Source code checks

  • Check for TODO comments in code
  • Check for raise NotImplementedError
  • Remove any old/unused files (e.g. scratchpad, profiling code, utils etc.)

Allow location on observer body to be specified

Currently, the observer is located at the centre of the observing body, and there isn't any way to specify the precise location, e.g. the lon/lat/alt location on Earth's surface corresponding to VLT. This can introduce (very small) pointing errors, and potentially slightly more significant velocity errors (especially for Doppler shift calculations e.g. #3), so may be worth fixing.

You'd probably either do this by doing another layer of coordinate conversions within the observer frame to get to the specific point, or by creating a completely new frame centred on the telescope - the new frame method is probably the 'correct' way to do it with spice. In theory the user could probably provide appropriate kernel files to provide whatever telescope frame they want, so this isn't strictly necessary to be customisable in the python code (but could be useful as a quality of life feature anyway).

Make vector methods (e.g. `targvec`) private

Generally, the coordinate systems the user will be using are probably going to be xy, radec and lonlat, so should we make some/all vector (e.g. targvec) methods private for simplicity?

Add rings

  • Load/save ring data
  • Process ring data into radec coordinates (only visible part etc.)
  • Plot rings in wireframes etc.
  • Automatically load some ring data

Intelligently load spice kernels

Currently we load the same set of spice kernels every single time a Body is initialised - this has a number of issues:

  1. Loading kernels isn't instantaneous (~0.3s)
  2. Creating a large number of bodies in the same session causes a SpiceNOMOREROOM error
  3. Re-loading the same kernels is generally inefficient and messy

Possible fixes:

  • Dynamically check if desired kernels are already loaded
  • Add some flag somewhere to indicate kernels are already loaded
    • This could potentially cause issues if the user unloads kernels, so would need to document this somewhere
  • Add separate function to load the kernels somewhere

Change default from radians to degrees

At the moment we assume all angles are in radians unless otherwise specified, i.e. get_lon_img() is in radians and get_lon_img_degrees() is in degrees. This is more consistent with the spice internals (which all use radians), but users will (probably) generally think in degrees and want to work in them.

Therefore, we should maybe swap the default from radians to degrees, i.e. get_lon_img() will be in degrees and then have a get_lon_img_radians() which can work in radians when needed. As the radians stuff is generally internal (for speed and to interface with spice), we could then cut down on the number of public methods and generally simplify the code.

Customise plotted image

  • Make vmax/vmin customisable
  • Make wavelength customisable?
  • Make gamma customisable?
  • Add option to sum image?

Deal with multiple HDUs in input FITS data

We basically want to append backplanes to whatever the input FITS file is, but at the moment we only keep the first HDU from the input file.

This could potentially work nicely with #32 by moving backplane saving logic to BodyXY then using this in Observation to append the backplanes to whatever the provided data is?

Add function to output maps

Option to save cylindrical map (as png?). Probably need options for:

  • Choosing photometric correction (i.e. make $k$ customisable)
  • Choosing wavelengths for map

Implementation

  • Add support for map backplanes
  • Add actual generation functions for map backplanes
  • Add function to create mapped version of the observation
  • Add map output controls to GUI

Optimization

Generating backplanes for large images can be very slow (potentially minutes), so need to optimize the code and/or let the user know what's going on. Profiling suggests that most of the execution time is spent calling the spice functions, so there's probably relatively little we can do to directly speed these up.

Code optimizations

  • Profile code to identify slowest parts
  • Cache results where possible (e.g. with the @cache_result decorator)
  • Test using a multiprocessing pool to do stuff in parallel (e.g. 2c1a7ee)
  • #25
  • #26
    • Add check for $r \ll d$ to make sure this is valid?

UX stuff

  • #51
  • Add explicit warning about it being slow somewhere in the UI
  • When running the GUI, maybe create separate subprocess to perform the actual backplane generation and file writing. This can then run in the background (maybe have a dialog box with a progress bar?) so the user can e.g. start work fitting the next observation immediately.

Generate state backplanes

Add backplanes for state of each surface point:

  • Distance (observer -> point)
  • Velocity
  • Doppler shift (derived from velocity)

Make plot fully customisable

  • Allow all plotted features (e.g. limb, lon/lat grid/terminator) to be toggled on and off
  • Allow appearance of features to be customised
    • Colour
    • Linestyle
    • Linewidth
  • Properties
    • Grid
    • Rings
    • lonlat POI
    • radec POI
    • Other bodies
    • Other bodies (labels)

Generate basic set of backplanes

Save set of basic backplanes to FITS file with the data. Need to do the appropriate transformations etc. pixel-by-pixel so probably only want to run this when needed at the end of the reduction process when the file is being saved. Depending on speed and possible optimizations may want to display progress bar etc.

Basic set of coordinates to add initially (want to keep code generic to allow more to be added easily):

  • lon,lat coordinates
  • ra,dec coordinates
  • i,e,g angles

Check pixel radius from disc centre before calculating targvec when generating backplane

The most costly part of backplane generation is finding the targvec for each xy coordinate. At the moment, we do this for every pixel, meaning that we run the expensive sincpt function for rays which completely miss the disc. However, we know the disc radius in pixels, so can very quickly and cheaply calculate the distance of each pixel from the disc centre to see if it's on the disc or not. If the pixel is off the disc, we can short circuit and avoid running sincpt when we know it's going to raise a NotFoundError.

This can probably be implemented in _get_targvec_img without touching any other code. To be safe, we should probably put a buffer around the disc, e.g. only short circuit for cases which are more than r=r0*1.1+1 pixels or something.

Implementation

  • Add rough initial code
  • Make sure we get the correct largest radius for the disc
  • Optimise the distance calculation code (precalculate any constants, skip sqrt by squaring both sides etc.)
  • Test appropriate buffer values to use

GUI fitting in RA/Dec plane

For observations which are smaller than the target, could be useful to move the observation around the target wireframe rather than moving the wireframe around the observation

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.