Advertisement
SVXX

IRIS Tests

May 19th, 2014
479
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.21 KB | None | 0 0
  1. """Test cases for IRISMap.
  2. This particular test file pertains to IRISMap.
  3. @Author: Pritish C. (VaticanCameos)
  4. """
  5.  
  6. import os
  7. import glob
  8. import numpy as np
  9.  
  10. import pytest
  11.  
  12. from sunpy.map import Map
  13. from sunpy.map.sources.iris import IRISMap
  14. from sunpy.map.mapbase import GenericMap
  15. import sunpy.data.test
  16.  
  17. path = sunpy.data.test.rootdir
  18. fitspaths = glob.glob(os.path.join(path, "iris_l2_20130801_074720_4040000014_SJI_1400_t000.fits"))
  19. irislist = []
  20. for fits in fitspaths:
  21.     irislist.append(Map(fits))
  22.  
  23. # IRIS Tests
  24. def test_fitstoIRIS():
  25.     """Tests the creation of IRISMap using FITS."""
  26.     for amap in irislist:
  27.         assert (isinstance(amap, IRISMap) or
  28.                 isinstance(amap, GenericMap))
  29.  
  30. def test_is_datasource_for():
  31.     """Test the is_datasource_for method of IRISMap.
  32.    Note that header data to be provided as an argument
  33.    can be a MapMeta object."""
  34.     for amap in irislist:
  35.         if isinstance(amap, IRISMap):
  36.             assert iris.is_datasource_for(iris.data, iris.meta)
  37.  
  38. def test_observatory():
  39.     """Tests the observatory property of IRISMap."""
  40.     for amap in irislist:
  41.         if isinstance(amap, IRISMap):
  42.             assert iris.observatory == "IRIS"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement