fits2tmp 0.1.8__tar.gz → 0.1.9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {fits2tmp-0.1.8 → fits2tmp-0.1.9}/PKG-INFO +1 -1
- {fits2tmp-0.1.8 → fits2tmp-0.1.9}/pyproject.toml +1 -1
- {fits2tmp-0.1.8 → fits2tmp-0.1.9}/src/fits2tmp/fits2tmp.py +30 -27
- {fits2tmp-0.1.8 → fits2tmp-0.1.9}/LICENSE +0 -0
- {fits2tmp-0.1.8 → fits2tmp-0.1.9}/README.md +0 -0
- {fits2tmp-0.1.8 → fits2tmp-0.1.9}/src/fits2tmp/__init__.py +0 -0
- {fits2tmp-0.1.8 → fits2tmp-0.1.9}/src/fits2tmp/sdc2_100.fits +0 -0
- {fits2tmp-0.1.8 → fits2tmp-0.1.9}/src/fits2tmp/sofiatestrewrite1002_cat.txt +0 -0
- {fits2tmp-0.1.8 → fits2tmp-0.1.9}/src/fits2tmp/sofiatestrewrite1002_cat.xml +0 -0
- {fits2tmp-0.1.8 → fits2tmp-0.1.9}/src/fits2tmp/sofiatestrewrite100_cat.txt +0 -0
- {fits2tmp-0.1.8 → fits2tmp-0.1.9}/src/fits2tmp/sofiatestrewrite100_cat.xml +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: fits2tmp
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.9
|
|
4
4
|
Summary: A way of loading FITS files into temporary filesystems to make them available in memory.
|
|
5
5
|
Home-page: https://gitlab.developers.cam.ac.uk/phy/ra/vla22-phd/fits2tmp
|
|
6
6
|
License: BSD-3-Clause
|
|
@@ -79,9 +79,7 @@ def fits2tmpfiles(inputpath, destination, chunks):
|
|
|
79
79
|
|
|
80
80
|
return filepath
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
def disk2tmpfiles(filetype, inputpath, destination, arraytype, arraysize, chunks=None):
|
|
84
|
-
fpath = []
|
|
82
|
+
def disk2fakefits(filetype, inputpath, destination, arraysize, chunks=None):
|
|
85
83
|
match filetype:
|
|
86
84
|
case "fits":
|
|
87
85
|
f = fits.open(inputpath)
|
|
@@ -89,28 +87,6 @@ def disk2tmpfiles(filetype, inputpath, destination, arraytype, arraysize, chunks
|
|
|
89
87
|
destination = tempfile.TemporaryDirectory(dir=destination, delete=False)
|
|
90
88
|
n_header = dict2header(header_dict(f[0].header))
|
|
91
89
|
wcs_obj = wcs.WCS(n_header)
|
|
92
|
-
print(d.shape)
|
|
93
|
-
for i in range(d.blocks.shape[0]):
|
|
94
|
-
x = i * chunks[0]
|
|
95
|
-
x_delt = x + chunks[0] - 1
|
|
96
|
-
for j in range(d.blocks.shape[1]):
|
|
97
|
-
data = d.blocks[i][j]
|
|
98
|
-
y = j * chunks[1]
|
|
99
|
-
y_delt = y + chunks[1] - 1
|
|
100
|
-
if len(d.blocks.shape) == 2:
|
|
101
|
-
dest = str(i) + str(j)
|
|
102
|
-
wcs_coords = wcs_obj.slice((slice(x,x_delt), slice(y,y_delt)))
|
|
103
|
-
elif len(d.blocks.shape) > 2:
|
|
104
|
-
for k in range(d.blocks.shape[2]):
|
|
105
|
-
data = d.blocks[i][j][k]
|
|
106
|
-
z = k * chunks[2]
|
|
107
|
-
z_delt = z + chunks[2] - 1
|
|
108
|
-
dest = str(i) + str(j) + str(k)
|
|
109
|
-
t =wcs_obj[x:x_delt, y:y_delt, z:z_delt]
|
|
110
|
-
n_header.update(t.to_header())
|
|
111
|
-
hdu = fits.PrimaryHDU(data=data, header=n_header)
|
|
112
|
-
hdu.writeto(destination.name + dest + "fits")
|
|
113
|
-
fpath.append(destination.name + dest + "fits")
|
|
114
90
|
case "zarr":
|
|
115
91
|
bar
|
|
116
92
|
case "hdf5":
|
|
@@ -119,8 +95,35 @@ def disk2tmpfiles(filetype, inputpath, destination, arraytype, arraysize, chunks
|
|
|
119
95
|
weeble
|
|
120
96
|
case _:
|
|
121
97
|
raise ValueError("The specified file type is not supported by fits2tmp.")
|
|
122
|
-
return
|
|
123
|
-
|
|
98
|
+
return d, destination, n_header, wcs_obj
|
|
99
|
+
|
|
100
|
+
def fakefits2tmpfiles(filetype, inputpath, destination, arraysize, chunks=None):
|
|
101
|
+
darr, tempdest, n_header, wcs_obj = disk2fakefits(filetype, inputpath, destination, arraysize, chunks)
|
|
102
|
+
print(darr.shape)
|
|
103
|
+
dd = darr.to_delayed()
|
|
104
|
+
fpaths = []
|
|
105
|
+
for i in range(dd.shape[0]):
|
|
106
|
+
x = i * chunks[0]
|
|
107
|
+
x_delt = x + chunks[0] - 1
|
|
108
|
+
for j in range(dd.shape[1]):
|
|
109
|
+
y = j * chunks[1]
|
|
110
|
+
y_delt = y + chunks[1] - 1
|
|
111
|
+
if len(dd.shape) == 2:
|
|
112
|
+
dest = str(i) + str(j)
|
|
113
|
+
data = dd[i][j]
|
|
114
|
+
wcs_coords = wcs_obj.slice((slice(x,x_delt), slice(y,y_delt)))
|
|
115
|
+
elif len(dd.shape) > 2:
|
|
116
|
+
for k in range(dd.shape[2]):
|
|
117
|
+
data = dd[i][j][k]
|
|
118
|
+
z = k * chunks[2]
|
|
119
|
+
z_delt = z + chunks[2] - 1
|
|
120
|
+
dest = str(i) + str(j) + str(k)
|
|
121
|
+
t =wcs_obj[x:x_delt, y:y_delt, z:z_delt]
|
|
122
|
+
n_header.update(t.to_header())
|
|
123
|
+
hdu = fits.PrimaryHDU(data=data.compute(), header=n_header)
|
|
124
|
+
hdu.writeto(tempdest.name + dest + "fits")
|
|
125
|
+
fpaths.append(tempdest.name + dest + "fits")
|
|
126
|
+
return fpaths
|
|
124
127
|
#def array2disk(array, metadata, outputtype, destination):
|
|
125
128
|
|
|
126
129
|
#def tmpfitsfile2disk(fitsfile, outputtype, destination):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|