Problem running 'Worked Example of Halo Analysis'
Hi all, I've been trying to run this notebook ( https://yt-project.org/doc/cookbook/halo_analysis_example.html). But I'm getting the following error when I get to hc.create(), where all the analysis is done. I'm not exactly sure what the problem is here. Any idea would be much appreciated. ValueError Traceback (most recent call last) <ipython-input-4-331e023f819c> in <module> * 1* hc.add_callback("save_profiles", storage="virial_profiles", output_dir="profiles") * 2* ----> 3 hc.create() * 4* * 5* halos_ds = yt.load(os.path.join(tmpdir, 'halo_catalog/halo_catalog.0.h5')) /home/xx/yt/analysis_modules/halo_analysis/halo_catalog.py in create(self, save_halos, save_catalog, njobs, dynamic) * 335* * 336* """ --> 337 self._run(save_halos, save_catalog, njobs=njobs, dynamic= dynamic) * 338* * 339* def load(self, save_halos=True, save_catalog=False, njobs=-1, dynamic=False): /home/xx/yt/utilities/parallel_tools/parallel_analysis_interface.py in barrierize(*args, **kwargs) * 299* def barrierize(*args, **kwargs): * 300* if not parallel_capable: --> 301 return func(*args, **kwargs) * 302* mylog.debug("Entering barrier before %s", func.__name__) * 303* comm = _get_comm(args) /home/xx/yt/analysis_modules/halo_analysis/halo_catalog.py in _run(self, save_halos, save_catalog, njobs, dynamic) * 439* for action_type, action in self.actions: * 440* if action_type == "callback": --> 441 action(new_halo) * 442* elif action_type == "filter": * 443* halo_filter = action(new_halo) /home/xx/yt/analysis_modules/halo_analysis/halo_callbacks.py in __call__(self, halo) * 58* * 59* def __call__(self, halo): ---> 60 self.function(halo, *self.args, **self.kwargs) * 61* return True * 62* /home/xx/yt/analysis_modules/halo_analysis/halo_callbacks.py in profile(halo, bin_fields, profile_fields, n_bins, extrema, logs, units, weight_field, accumulation, fractional, storage, output_dir) * 229* my_profile = create_profile(halo.data_object, bin_fields, profile_fields, n_bins=n_bins, * 230* extrema=extrema, logs=logs, units= units, weight_field=weight_field, --> 231 accumulation=accumulation, fractional=fractional) * 232* * 233* prof_store = dict([(field, my_profile[field]) \ /home/xx/yt/data_objects/profiles.py in create_profile(data_source, bin_fields, fields, n_bins, extrema, logs, units, weight_field, accumulation, fractional, deposition, override_bins) * 1205* setattr(obj, "fractional", fractional) * 1206* if fields is not None: -> 1207 obj.add_fields([field for field in fields]) * 1208* for field in fields: * 1209* if fractional: /home/xx/yt/data_objects/profiles.py in add_fields(self, fields) * 127* citer = self.data_source.chunks([], "io") * 128* for chunk in parallel_objects(citer): --> 129 self._bin_chunk(chunk, fields, temp_storage) * 130* self._finalize_storage(fields, temp_storage) * 131* /home/xx/yt/data_objects/profiles.py in _bin_chunk(self, chunk, fields, storage) * 496* fdata, wdata, (bf_x,) = rv * 497* bf_x.convert_to_units(self.field_info[self.x_field]. output_units) --> 498 bin_ind = np.digitize(bf_x, self.x_bins) - 1 * 499* new_bin_profile1d(bin_ind, wdata, fdata, * 500* storage.weight_values, storage.values, /data/xx/soft/anaconda3/lib/python3.7/site-packages/numpy/lib/function_base.py in digitize(x, bins, right) * 4799* mono = _monotonicity(bins) * 4800* if mono == 0: -> 4801 raise ValueError("bins must be monotonically increasing or decreasing") * 4802* * 4803* # this is backwards because the arguments below are swapped ValueError: bins must be monotonically increasing or decreasing Many thanks, Hanjue
Hi Hanjue, My suspicion is that the halo being profiled is too small and the profiler is having trouble finding an appropriate minimum and maximum radius. Are you using the public data to run this or are you using your own data? If it's the former, then possibly something in the code needs to be updated. I'm happy to debug this with you. In addition, you might try running the version of this code that is now in the external yt_astro_analysis package. It may have some updates that aren't here. The code is all the same; you would just need to change the imports. There is more information here: https://yt-astro-analysis.readthedocs.io/ <https://yt-astro-analysis.readthedocs.io/en/latest/> Britton On Wed, Jan 22, 2020 at 1:13 PM Hanjue Zhu <hanjuezhu@uchicago.edu> wrote:
Hi all,
I've been trying to run this notebook ( https://yt-project.org/doc/cookbook/halo_analysis_example.html). But I'm getting the following error when I get to hc.create(), where all the analysis is done. I'm not exactly sure what the problem is here. Any idea would be much appreciated.
ValueError Traceback (most recent call last)
<ipython-input-4-331e023f819c> in <module>
* 1* hc.add_callback("save_profiles", storage="virial_profiles", output_dir="profiles")
* 2*
----> 3 hc.create()
* 4*
* 5* halos_ds = yt.load(os.path.join(tmpdir, 'halo_catalog/halo_catalog.0.h5'))
/home/xx/yt/analysis_modules/halo_analysis/halo_catalog.py in create(self, save_halos, save_catalog, njobs, dynamic)
* 335*
* 336* """
--> 337 self._run(save_halos, save_catalog, njobs=njobs, dynamic= dynamic)
* 338*
* 339* def load(self, save_halos=True, save_catalog=False, njobs=-1 , dynamic=False):
/home/xx/yt/utilities/parallel_tools/parallel_analysis_interface.py in barrierize(*args, **kwargs)
* 299* def barrierize(*args, **kwargs):
* 300* if not parallel_capable:
--> 301 return func(*args, **kwargs)
* 302* mylog.debug("Entering barrier before %s", func.__name__)
* 303* comm = _get_comm(args)
/home/xx/yt/analysis_modules/halo_analysis/halo_catalog.py in _run(self, save_halos, save_catalog, njobs, dynamic)
* 439* for action_type, action in self.actions:
* 440* if action_type == "callback":
--> 441 action(new_halo)
* 442* elif action_type == "filter":
* 443* halo_filter = action(new_halo)
/home/xx/yt/analysis_modules/halo_analysis/halo_callbacks.py in __call__(self, halo)
* 58*
* 59* def __call__(self, halo):
---> 60 self.function(halo, *self.args, **self.kwargs)
* 61* return True
* 62*
/home/xx/yt/analysis_modules/halo_analysis/halo_callbacks.py in profile(halo, bin_fields, profile_fields, n_bins, extrema, logs, units, weight_field, accumulation, fractional, storage, output_dir)
* 229* my_profile = create_profile(halo.data_object, bin_fields, profile_fields, n_bins=n_bins,
* 230* extrema=extrema, logs=logs, units=units, weight_field=weight_field,
--> 231 accumulation=accumulation, fractional=fractional)
* 232*
* 233* prof_store = dict([(field, my_profile[field]) \
/home/xx/yt/data_objects/profiles.py in create_profile(data_source, bin_fields, fields, n_bins, extrema, logs, units, weight_field, accumulation, fractional, deposition, override_bins)
* 1205* setattr(obj, "fractional", fractional)
* 1206* if fields is not None:
-> 1207 obj.add_fields([field for field in fields])
* 1208* for field in fields:
* 1209* if fractional:
/home/xx/yt/data_objects/profiles.py in add_fields(self, fields)
* 127* citer = self.data_source.chunks([], "io")
* 128* for chunk in parallel_objects(citer):
--> 129 self._bin_chunk(chunk, fields, temp_storage)
* 130* self._finalize_storage(fields, temp_storage)
* 131*
/home/xx/yt/data_objects/profiles.py in _bin_chunk(self, chunk, fields, storage)
* 496* fdata, wdata, (bf_x,) = rv
* 497* bf_x.convert_to_units(self.field_info[self.x_field]. output_units)
--> 498 bin_ind = np.digitize(bf_x, self.x_bins) - 1
* 499* new_bin_profile1d(bin_ind, wdata, fdata,
* 500* storage.weight_values, storage.values,
/data/xx/soft/anaconda3/lib/python3.7/site-packages/numpy/lib/function_base.py in digitize(x, bins, right)
* 4799* mono = _monotonicity(bins)
* 4800* if mono == 0:
-> 4801 raise ValueError("bins must be monotonically increasing or decreasing")
* 4802*
* 4803* # this is backwards because the arguments below are swapped
ValueError: bins must be monotonically increasing or decreasing
Many thanks, Hanjue _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
participants (2)
-
Britton Smith -
Hanjue Zhu