Skip to content

Commit

Permalink
DarkRecipe #40
Browse files Browse the repository at this point in the history
  • Loading branch information
Pica committed Jan 19, 2016
1 parent 5ab38ef commit 497a876
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
5 changes: 4 additions & 1 deletion megaradrp/recipes/calibration/dark.py
Expand Up @@ -45,7 +45,10 @@ def run(self, rinput):

hdu, data = self.hdu_creation(rinput.obresult, {'biasmap':mbias})

hdu[0].data = hdu[0].data/3600 #3600 is the exposure time. Should be taken from the header
try:
hdu[0].data = hdu[0].data/hdu[0].header['EXPTIME']
except:
pass

result = self.create_result(darkframe=hdu)
return result
10 changes: 5 additions & 5 deletions megaradrp/recipes/calibration/tests/test_dark.py
Expand Up @@ -4,8 +4,8 @@
import pytest
import shutil

from megaradrp.tests.simulation import simulate_dark
from megaradrp.tests.simulation import ReadParams, MegaraDetectorSat
from megaradrp.tests.simulation import simulate_dark, simulate_dark_fits
from megaradrp.tests.simulation import ReadParams, MegaraDetectorSat, MegaraImageFactory
from numina.core import DataFrame, ObservationResult

from megaradrp.recipes.calibration.tests.test_bpm_common import generate_bias
Expand Down Expand Up @@ -38,11 +38,11 @@ def test_dark():

number = 10

fs = [simulate_dark(detector, exposure=3600) for i in range(number)]
factory = MegaraImageFactory()
fs = [simulate_dark_fits(factory, detector, exposure=3600) for i in range(number)]

for aux in range(len(fs)):
fits.writeto('%s/dark_%s.fits' % (temporary_path, aux), fs[aux],
clobber=True)
fs[aux].writeto('%s/dark_%s.fits' % (temporary_path, aux),clobber=True)

master_bias = generate_bias(detector, number, temporary_path)
master_bias_data = master_bias.biasframe.frame[0].data
Expand Down

0 comments on commit 497a876

Please sign in to comment.