-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Description
I'm trying to find the width information on filaments, other methods were ok, but no matter what, find_widths() gives error.
# there is a skeleton length reading package
from fil_finder import FilFinder2D
import astropy.units as u
fil = FilFinder2D(processed, distance=250 * u.pc, mask=skeleton)
fil.medskel(verbose=False)
fil.analyze_skeletons(branch_thresh=0* u.pix, skel_thresh=0 * u.pix, prune_criteria='length')
f = fil.filaments[0]
plt.imshow(f.skeleton(pad_size=10))
fil.exec_rht()
fil.find_widths(max_dist=0.2 * u.pc)
AttributeError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_34180/1915991156.py in <module>
5 #f.plot_radial_profile(xunit=u.pc)
6 fil.exec_rht()
----> 7 fil.find_widths(max_dist=0.2 * u.pc)
C:\ProgramData\Anaconda3\envs\cv\lib\site-packages\fil_finder\filfinder2D.py in find_widths(self, max_dist, pad_to_distance, fit_model, fitter, try_nonparam, use_longest_path, add_width_to_length, deconvolve_width, fwhm_function, chisq_max, verbose, save_png, save_name, xunit, **kwargs)
973 print("Filament: %s / %s" % (n + 1, self.number_of_filaments))
974
--> 975 fil.width_analysis(self.image, all_skeleton_array=self.skeleton,
976 max_dist=max_dist,
977 pad_to_distance=pad_to_distance,
C:\ProgramData\Anaconda3\envs\cv\lib\site-packages\fil_finder\filament.py in width_analysis(self, image, all_skeleton_array, max_dist, pad_to_distance, fit_model, fitter, try_nonparam, use_longest_path, add_width_to_length, deconvolve_width, beamwidth, fwhm_function, chisq_max, **kwargs)
762
763 # Convert quantities to pixel units.
--> 764 max_dist = self._converter.to_pixel(max_dist).value
765 pad_to_distance = self._converter.to_pixel(pad_to_distance).value
766
C:\ProgramData\Anaconda3\envs\cv\lib\site-packages\fil_finder\base_conversions.py in to_pixel(self, value)
206 return value.to(u.pix, equivalencies=self.angular_equiv)
207 elif value.unit.is_equivalent(u.pc):
--> 208 return value.to(u.pix, equivalencies=self.physical_equiv)
209 else:
210 raise u.UnitConversionError("value has units of {}. It must have "
C:\ProgramData\Anaconda3\envs\cv\lib\site-packages\fil_finder\base_conversions.py in physical_equiv(self)
186 def physical_equiv(self):
187 if not hasattr(self, "_distance"):
--> 188 raise AttributeError("No distance has not been given.")
189
190 return [(u.pix, self.distance.unit,
AttributeError: No distance has not been given.
Metadata
Metadata
Assignees
Labels
No labels