-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #123 from shanosborne/fix-writing-xlsx
Fix bug when writing xlsx
- Loading branch information
Showing
2 changed files
with
73 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#!/usr/bin/env python | ||
"""Tests for the pysiaf iando/ write.py and read.py functions. | ||
Authors | ||
------- | ||
Shannon Osborne | ||
""" | ||
import os | ||
|
||
import pytest | ||
|
||
from ..aperture import JwstAperture | ||
from ..siaf import ApertureCollection | ||
from ..iando.write import write_jwst_siaf | ||
|
||
|
||
def test_write_jwst_siaf_xml(tmpdir): | ||
"""Basic test to check that JWST SIAF XML file is written out""" | ||
|
||
aperture = JwstAperture() | ||
aperture.AperName = 'MIRIM_FULL_OSS' | ||
aperture.InstrName = 'MIRI' | ||
aperture.VIdlParity = 1 | ||
aperture.DetSciYAngle = 0 | ||
aperture.DetSciParity = 1 | ||
aperture_dict = { | ||
'MIRIM_FULL_OSS': aperture | ||
} | ||
aperture_collection = ApertureCollection(aperture_dict) | ||
filename = os.path.join(tmpdir, 'test_miri.xml') | ||
|
||
write_jwst_siaf(aperture_collection, filename=filename, | ||
file_format='xml', verbose=False) | ||
|
||
assert os.path.isfile(filename) | ||
|
||
# Remove temporary directory | ||
tmpdir.remove() | ||
|
||
|
||
def test_write_jwst_siaf_xlsx(tmpdir): | ||
"""Basic test to check that JWST SIAF XLSX file is written out""" | ||
|
||
aperture = JwstAperture() | ||
aperture.AperName = 'MIRIM_FULL_OSS' | ||
aperture.InstrName = 'MIRI' | ||
aperture.VIdlParity = 1 | ||
aperture.DetSciYAngle = 0 | ||
aperture.DetSciParity = 1 | ||
aperture_dict = { | ||
'MIRIM_FULL_OSS': aperture | ||
} | ||
aperture_collection = ApertureCollection(aperture_dict) | ||
filename = os.path.join(tmpdir, 'test_miri.xlsx') | ||
|
||
write_jwst_siaf(aperture_collection, filename=filename, | ||
file_format='xlsx', verbose=False) | ||
|
||
assert os.path.isfile(filename) | ||
|
||
# Remove temporary directory | ||
tmpdir.remove() |