TESScience / SPyFFI

Spiffy Python for TESS Full Frame Images
MIT License
6 stars 7 forks source link

Cosmic Ray Injection Nonfunctional #9

Closed Neoshika closed 8 years ago

Neoshika commented 8 years ago

Turning on cosmic ray generation with

inputs['expose']['skipcosmics'] = False  

breaks SPyFFI with the following error message

File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/Users/jvaughn/Desktop/spiffyFiles/SPyFFI/scripts/demonstration.py", line 147, in <module>
    o.create()
  File "/Users/jvaughn/Desktop/spiffyFiles/SPyFFI/Observation.py", line 77, in create
    c.expose(**self.inputs['expose'])
  File "/Users/jvaughn/Desktop/spiffyFiles/SPyFFI/CCD.py", line 920, in expose
    cosmics = self.addCosmics(write=writecosmics, version=cosmicsversion, diffusion=cosmicsdiffusion, correctcosmics=correctcosmics)
  File "/Users/jvaughn/Desktop/spiffyFiles/SPyFFI/CCD.py", line 637, in addCosmics
    gradient=gradient, version=version, diffusion=diffusion, rate=rate)
TypeError: cosmicImage() got an unexpected keyword argument 'version'
Neoshika commented 8 years ago

Fixes (each tested separately, both work): A. Add "version = 'fancy'" to the inputs of the cosmicImage from Cosmics.py (line 7) B. Stop trying to give a cosmics version in addCosmics from CCD.py (lines 636-7)

xcthulhu commented 8 years ago

inputs['expose']['skipcosmics'] = False

@Neoshika I would like to write a test to reproduce this bug in the tests/ directory, but I'm confused what you mean by inputs.

Is this the dictionary that's passed to SPyFFI.Observation?

A test would greatly help me. I am trying to get rid of the need to set the SPYFFIPATH environment variable that's being read SPyFFI.cosmical_realistic._cosmical: https://github.com/TESScience/SPyFFI/blob/master/cosmical_realistic/cosmical.c#L626

(this is currently breaking setup.py installation)

A. Add "version = 'fancy'" to the inputs of the cosmicImage from Cosmics.py (line 7) B. Stop trying to give a cosmics version in addCosmics from CCD.py (lines 636-7)

If I make a pull request with the specified changes, can you review it to make sure I'm making the changes correctly?

Neoshika commented 8 years ago

By inputs I mean the highest level dictionary of dictionaries used as an input for all pieces of the code. The "inputs['expose']['skipcosmics'] = False" is an exact line from demonstration.py or any other script used to drive SPyFFI

xcthulhu commented 8 years ago

Yeah, that's a dictionary passed to SPyFFI.Observation.

Here's an example I'm using for testing/continuous integration:

https://github.com/TESScience/SPyFFI/blob/54b5574793136fb11e0c09140b5cecbf24154759/test/smallone.py#L15

FYI, it could just as easily be called options instead of inputs.