Skip to content

Commit 885c127

Browse files
committed
Have succesfully run all the way through pipeline.py
1 parent ad87fe8 commit 885c127

File tree

4 files changed

+98
-111
lines changed

4 files changed

+98
-111
lines changed

phrosty/imagesubtraction.py

Lines changed: 1 addition & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,10 @@
1-
__all__ = [ 'gz_and_ext', 'sky_subtract', 'stampmaker' ]
1+
__all__ = [ 'sky_subtract', 'stampmaker' ]
22

33
# IMPORTS Standard:
4-
import io
54
import numpy as np
6-
import gzip
7-
import multiprocessing
8-
import shutil
95
import pathlib
106
import random
117

12-
# IMPORTS Astro:
13-
from astropy.io import fits
14-
158
# IMPORTS SFFT:
169
from sfft.utils.SExSkySubtract import SEx_SkySubtract
1710
from sfft.utils.StampGenerator import Stamp_Generator
@@ -22,42 +15,6 @@
2215
from snpit_utils.config import Config
2316

2417

25-
def gz_and_ext(in_path, out_path):
26-
"""Utility function that unzips the original file and turns
27-
it into a single-extension FITS file.
28-
29-
Parameters
30-
----------
31-
in_path: Path
32-
The input path of the file to unzip and flatten.
33-
34-
out_path: Path
35-
The desired output path of the file that is unzipped and flattened, once it is saved.
36-
37-
Returns
38-
-------
39-
out_path: Path
40-
The output path of the file that has been unzipped and flattened.
41-
42-
"""
43-
44-
raise RuntimeError( "No longer needed." )
45-
46-
bio = io.BytesIO()
47-
with gzip.open(in_path, 'rb') as f_in:
48-
shutil.copyfileobj(f_in, bio)
49-
bio.seek(0)
50-
51-
with fits.open(bio) as hdu:
52-
newhdu = fits.HDUList([fits.PrimaryHDU(data=hdu[1].data, header=hdu[0].header)])
53-
SNLogger.debug( f"Process {multiprocessing.current_process().pid} Writing extracted HDU 1 to {out_path}..." )
54-
newhdu.writeto(out_path, overwrite=True)
55-
SNLogger.debug( f"...process {multiprocessing.current_process().pid} done writing "
56-
f"extracted HDU 1 to {out_path}." )
57-
58-
return out_path
59-
60-
6118
def sky_subtract( img, temp_dir=None ):
6219
"""Subtracts background, found with Source Extractor.
6320

0 commit comments

Comments
 (0)