@@ -28,7 +28,7 @@ impl FEEBeam {
28
28
/// calculations. If the path to the beam HDF5 file is not given, then the
29
29
/// `MWA_BEAM_FILE` environment variable is used.
30
30
#[ new]
31
- #[ pyo3( text_signature = " (hdf5_file)" ) ]
31
+ #[ pyo3( signature = ( hdf5_file) ) ]
32
32
fn new ( hdf5_file : Option < PyObject > ) -> PyResult < Self > {
33
33
let strct = match hdf5_file {
34
34
Some ( f) => {
@@ -64,7 +64,7 @@ impl FEEBeam {
64
64
/// elements; if 16 are given, then these map 1:1 with dipoles, otherwise
65
65
/// the first 16 are for X dipole elements, and the next 16 are for Y.
66
66
#[ pyo3(
67
- text_signature = " (az_rad, za_rad, freq_hz, delays, amps, norm_to_zenith, latitude_rad, iau_order)"
67
+ signature = ( az_rad, za_rad, freq_hz, delays, amps, norm_to_zenith, latitude_rad= None , iau_order= None )
68
68
) ]
69
69
#[ allow( clippy:: too_many_arguments) ]
70
70
fn calc_jones < ' py > (
@@ -78,7 +78,7 @@ impl FEEBeam {
78
78
norm_to_zenith : bool ,
79
79
latitude_rad : Option < f64 > ,
80
80
iau_order : Option < bool > ,
81
- ) -> PyResult < & ' py PyArray1 < c64 > > {
81
+ ) -> PyResult < Bound < ' py , PyArray1 < c64 > > > {
82
82
let jones = self . beam . calc_jones_pair (
83
83
az_rad,
84
84
za_rad,
@@ -93,7 +93,7 @@ impl FEEBeam {
93
93
iau_order. unwrap_or ( false ) ,
94
94
) ?;
95
95
let jones_py: Vec < c64 > = jones. iter ( ) . map ( |c| c64:: new ( c. re , c. im ) ) . collect ( ) ;
96
- let np_array = PyArray1 :: from_vec ( py, jones_py) ;
96
+ let np_array = PyArray1 :: from_vec_bound ( py, jones_py) ;
97
97
Ok ( np_array)
98
98
}
99
99
@@ -109,7 +109,7 @@ impl FEEBeam {
109
109
/// elements; if 16 are given, then these map 1:1 with dipoles, otherwise
110
110
/// the first 16 are for X dipole elements, and the next 16 are for Y.
111
111
#[ pyo3(
112
- text_signature = " (az_rad, za_rad, freq_hz, delays, amps, norm_to_zenith, latitude_rad, iau_order)"
112
+ signature = ( az_rad, za_rad, freq_hz, delays, amps, norm_to_zenith, latitude_rad= None , iau_order= None )
113
113
) ]
114
114
#[ allow( clippy:: too_many_arguments) ]
115
115
fn calc_jones_array < ' py > (
@@ -123,7 +123,7 @@ impl FEEBeam {
123
123
norm_to_zenith : bool ,
124
124
latitude_rad : Option < f64 > ,
125
125
iau_order : Option < bool > ,
126
- ) -> PyResult < & ' py PyArray2 < c64 > > {
126
+ ) -> PyResult < Bound < ' py , PyArray2 < c64 > > > {
127
127
let jones = self . beam . calc_jones_array_pair (
128
128
& az_rad,
129
129
& za_rad,
@@ -147,12 +147,12 @@ impl FEEBeam {
147
147
// SAFETY: new_cap == old_cap * N, align_of::<C64>() == align_of::<Jones>()
148
148
let flat = unsafe { Vec :: from_raw_parts ( new_ptr, new_len, new_cap) } ;
149
149
let a2 = Array2 :: from_shape_vec ( ( old_len, 4 ) , flat) . unwrap ( ) ;
150
- Ok ( a2. into_pyarray ( py) )
150
+ Ok ( a2. into_pyarray_bound ( py) )
151
151
}
152
152
153
153
/// Get the available frequencies inside the HDF5 file.
154
- fn get_fee_beam_freqs < ' py > ( & self , py : Python < ' py > ) -> & ' py PyArray1 < u32 > {
155
- self . beam . get_freqs ( ) . to_vec ( ) . into_pyarray ( py)
154
+ fn get_fee_beam_freqs < ' py > ( & self , py : Python < ' py > ) -> Bound < ' py , PyArray1 < u32 > > {
155
+ self . beam . get_freqs ( ) . to_vec ( ) . into_pyarray_bound ( py)
156
156
}
157
157
158
158
/// Given a frequency in Hz, get the closest available frequency inside the
@@ -172,7 +172,7 @@ impl FEEBeam {
172
172
/// for an explanation).
173
173
#[ cfg( any( feature = "cuda" , feature = "hip" ) ) ]
174
174
#[ pyo3(
175
- text_signature = " (az_rad, za_rad, freqs_hz, delays_array, amps_array, norm_to_zenith, latitude_rad, iau_order)"
175
+ signature = ( az_rad, za_rad, freqs_hz, delays_array, amps_array, norm_to_zenith, latitude_rad= None , iau_order= None )
176
176
) ]
177
177
#[ allow( clippy:: too_many_arguments) ]
178
178
fn calc_jones_gpu < ' py > (
@@ -186,7 +186,7 @@ impl FEEBeam {
186
186
norm_to_zenith : bool ,
187
187
latitude_rad : Option < f64 > ,
188
188
iau_order : Option < bool > ,
189
- ) -> PyResult < & ' py PyArray4 < GpuComplex > > {
189
+ ) -> PyResult < Bound < ' py , PyArray4 < GpuComplex > > > {
190
190
// hyperbeam expects ints for the frequencies. Convert them to make sure
191
191
// everything's OK.
192
192
let freqs: Vec < u32 > = freqs_hz. iter ( ) . map ( |& f| f. round ( ) as _ ) . collect ( ) ;
@@ -212,14 +212,14 @@ impl FEEBeam {
212
212
// Use unsafe code to ensure that no useless copying is done!
213
213
// https://users.rust-lang.org/t/sound-conversion-from-vec-num-complex-complex64-4-to-ndarray-array2-num-complex-complex64-without-copying/78973/2
214
214
let old_dim = jones. dim ( ) ;
215
- let mut jones = std:: mem:: ManuallyDrop :: new ( jones. into_raw_vec ( ) ) ;
215
+ let mut jones = std:: mem:: ManuallyDrop :: new ( jones. into_raw_vec_and_offset ( ) . 0 ) ;
216
216
217
217
let new_len = jones. len ( ) * 4 ;
218
218
let new_cap = jones. capacity ( ) * 4 ;
219
219
let new_ptr = jones. as_mut_ptr ( ) as * mut GpuComplex ;
220
220
// SAFETY: new_cap == old_cap * N, align_of::<Complex>() == align_of::<Jones>()
221
221
let flat = unsafe { Vec :: from_raw_parts ( new_ptr, new_len, new_cap) } ;
222
222
let a4 = Array4 :: from_shape_vec ( ( old_dim. 0 , old_dim. 1 , old_dim. 2 , 4 ) , flat) . unwrap ( ) ;
223
- Ok ( a4. into_pyarray ( py) )
223
+ Ok ( a4. into_pyarray_bound ( py) )
224
224
}
225
225
}
0 commit comments