fits2tmp 0.1.7__tar.gz → 0.1.8__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.7 → fits2tmp-0.1.8}/PKG-INFO +2 -2
- {fits2tmp-0.1.7 → fits2tmp-0.1.8}/pyproject.toml +2 -2
- {fits2tmp-0.1.7 → fits2tmp-0.1.8}/src/fits2tmp/fits2tmp.py +32 -5
- {fits2tmp-0.1.7 → fits2tmp-0.1.8}/LICENSE +0 -0
- {fits2tmp-0.1.7 → fits2tmp-0.1.8}/README.md +0 -0
- {fits2tmp-0.1.7 → fits2tmp-0.1.8}/src/fits2tmp/__init__.py +0 -0
- {fits2tmp-0.1.7 → fits2tmp-0.1.8}/src/fits2tmp/sdc2_100.fits +0 -0
- {fits2tmp-0.1.7 → fits2tmp-0.1.8}/src/fits2tmp/sofiatestrewrite1002_cat.txt +0 -0
- {fits2tmp-0.1.7 → fits2tmp-0.1.8}/src/fits2tmp/sofiatestrewrite1002_cat.xml +0 -0
- {fits2tmp-0.1.7 → fits2tmp-0.1.8}/src/fits2tmp/sofiatestrewrite100_cat.txt +0 -0
- {fits2tmp-0.1.7 → fits2tmp-0.1.8}/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.8
|
|
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
|
|
@@ -12,7 +12,7 @@ Classifier: Programming Language :: Python :: 3
|
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.10
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.11
|
|
14
14
|
Requires-Dist: astropy (>=6.1.4,<7.0.0)
|
|
15
|
-
Requires-Dist: dask[
|
|
15
|
+
Requires-Dist: dask[distributed] (>=2025.1.0,<2026.0.0)
|
|
16
16
|
Requires-Dist: h5py (>=3.12.1,<4.0.0)
|
|
17
17
|
Requires-Dist: numpy (>=2.1.2,<3.0.0)
|
|
18
18
|
Requires-Dist: pytest (>=8.3.3,<9.0.0)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "fits2tmp"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.8"
|
|
4
4
|
description = "A way of loading FITS files into temporary filesystems to make them available in memory."
|
|
5
5
|
license = "BSD-3-Clause"
|
|
6
6
|
authors = ["Verity Allan <vla22@cam.ac.uk>"]
|
|
@@ -9,7 +9,7 @@ repository = "https://gitlab.developers.cam.ac.uk/phy/ra/vla22-phd/fits2tmp"
|
|
|
9
9
|
|
|
10
10
|
[tool.poetry.dependencies]
|
|
11
11
|
python = "^3.10"
|
|
12
|
-
dask = {extras = ["
|
|
12
|
+
dask = {extras = ["distributed"], version = "^2025.1.0"}
|
|
13
13
|
astropy = "^6.1.4"
|
|
14
14
|
h5py = "^3.12.1"
|
|
15
15
|
numpy = "^2.1.2"
|
|
@@ -4,6 +4,7 @@ import json
|
|
|
4
4
|
from astropy.io import fits
|
|
5
5
|
from astropy import wcs
|
|
6
6
|
import dask.array as da
|
|
7
|
+
from dask import delayed
|
|
7
8
|
from dask.distributed import Lock
|
|
8
9
|
import numpy as np
|
|
9
10
|
import os
|
|
@@ -78,11 +79,38 @@ def fits2tmpfiles(inputpath, destination, chunks):
|
|
|
78
79
|
|
|
79
80
|
return filepath
|
|
80
81
|
|
|
81
|
-
|
|
82
|
-
def
|
|
82
|
+
@delayed
|
|
83
|
+
def disk2tmpfiles(filetype, inputpath, destination, arraytype, arraysize, chunks=None):
|
|
84
|
+
fpath = []
|
|
83
85
|
match filetype:
|
|
84
86
|
case "fits":
|
|
85
|
-
|
|
87
|
+
f = fits.open(inputpath)
|
|
88
|
+
d = da.from_array(f[0].data, chunks=chunks)
|
|
89
|
+
destination = tempfile.TemporaryDirectory(dir=destination, delete=False)
|
|
90
|
+
n_header = dict2header(header_dict(f[0].header))
|
|
91
|
+
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")
|
|
86
114
|
case "zarr":
|
|
87
115
|
bar
|
|
88
116
|
case "hdf5":
|
|
@@ -91,8 +119,7 @@ def disk2darray(filetype, filepath, arraytype, arraysize, chunks=None):
|
|
|
91
119
|
weeble
|
|
92
120
|
case _:
|
|
93
121
|
raise ValueError("The specified file type is not supported by fits2tmp.")
|
|
94
|
-
return
|
|
95
|
-
|
|
122
|
+
return fpath
|
|
96
123
|
|
|
97
124
|
#def array2disk(array, metadata, outputtype, destination):
|
|
98
125
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|