somexlab / fastddm

Python library for Differential Dynamic Microscopy analysis
https://fastddm.readthedocs.io/
GNU General Public License v3.0
3 stars 0 forks source link

Error when using bins list in azimuthal average #193

Closed enrico-lattuada closed 6 months ago

enrico-lattuada commented 6 months ago

Description When using a list of bins in the azimuthal average, I get the following error:

File ~/.local/lib/python3.8/site-packages/fastddm/azimuthalaverage.py:553, in azimuthal_average(img_str_func, bins, range, mask, weights, eval_err)
    550 k_modulus = np.sqrt(X**2 + Y**2)
    552 # compute the azimuthal average
--> 553 az_avg, err, k, bin_edges = azimuthal_average_array(
    554     img_str_func._data,
    555     k_modulus,
    556     bins,
    557     range,
    558     mask,
    559     weights,
    560     counts,
    561     eval_err,
    562 )
    564 return AzimuthalAverage(az_avg, err, k, img_str_func.tau, bin_edges)

File ~/.local/lib/python3.8/site-packages/fastddm/azimuthalaverage.py:400, in azimuthal_average_array(data, dist, bins, range, mask, weights, counts, eval_err)
    398 if not np.all(bins[1:] >= bins[:-1]):
    399     raise ValueError("bins must be monotonically increasing.")
--> 400 bin_edges = bins.astype(DTYPE)
    401 n_bins = len(bins)
    402 x_min = bins[0]

AttributeError: 'list' object has no attribute 'astype'

To Reproduce Steps to reproduce the behavior:

  1. Create a list of bin_edges
  2. Calculate the azimuthal average
  3. See error

Expected behavior The azimuthal average should operate with no error, using the input bin edges.