mhvk/geminiutil — pull request #2 by wkerzendorf (2013-04-25 01:47:47+00:00)
Title: Working in splitting the classes to functions

** DO NOT MERGE **

Hi Marten - I just saw that you split the classes into function which I think is great. I didn't see that before and so did the same ;-) No harm done because I did it a little different. I think the function should work on the individual detectors and takes as arguments things like `readout_noise`, `gain`, without reading them from the header. This can be done in a script and we can choose what numbers are picked (e.g. reading it from the headers or taking it from the database).

So as I said I split the functions out and now have four functions that are executed in succession:

```python

current_amp = subtract_overscan_single_amp(current_amp, isleftamp, bias_slice=self.bias_slice,data_slice=self.data_slice, clip_sigma=self.overscan_clip_sigma)
current_amp = correct_gain(current_amp, current_detector.gain)

output_hdu_list.append(current_amp)

current_uncertainty = create_uncertainties(current_amp, current_detector.read_noise)
current_uncertainty.name = 'uncertainty_%d' % i
output_hdu_list.append(current_uncertainty)
current_mask = create_mask(current_amp)
current_mask.name = 'mask_%d' % i
output_hdu_list.append(current_mask)
```

I took your idea of naming the extensions and now have 'DATA_X', 'UNCERTAINTY_X', 'MASK_X' where X is the chip number.

Now this is obviously annoying to work with I thought -- but we have `astropy.NDData` and that works great (I subclassed NDData and it's called GMOSCCDImage. Here a little taste:

```python
tmp2 = gmos.GMOSCCDImage.from_fits_object(tmp)

In [5]: tmp2
Out[5]:
{1: ,
2: ,
3: }

In [6]: imshow(tmp2[1])
Out[6]:
```
![gmos_ccd_image_test](https://f.cloud.github.com/assets/506116/423180/98501536-ad49-11e2-9934-f862c855837b.png)

The little white dots are masked regions where the data < 0

So how do we proceed. I think your documentation looks much nicer, but would like to have functions that work on each separate detector so I can give it the bias, readout database from the database. This makes it still useable for database-less scripting.

Do you want to chat tomorrow? What time is good for you?

Cheers
W