Open matthewturk opened 6 years ago
To motivate this discussion, the following script will include NaNs in the flat projection array:
import yt
import numpy as np
ds = yt.load('IsolatedGalaxy/galaxy0030/galaxy0030')
disk = ds.disk('c', [0, 0, 1], (1000, 'pc'), (100, 'pc'))
proj = ds.proj('density', axis='z', weight_field='density', data_source=disk,
method='integrate')
dens_proj = proj['density']
Matt's proposal would make it so that dens_proj
in the above script is the same as dens_proj[np.isfinite(dens_proj)]
.
We'd also need to make sure that the FRB machinery still inserts NaNs into images where there is no data so it will be properly masked by matplotlib.
At present, the mesh for the quad tree projection is initialized independently of whether or not a given point in the mesh will contribute to the final projection (
add_chunk_to_tree
). This can happen, for instance, when creating projections from regions that cut across individual quads or index objects. The quad tree is turned into flattened arrays insideget_all
.What could be done here is to filter out those values that are not used before turning things into flattened arrays. We could do this by one of the following:
_initialize_chunk
so that we don't get unused values. (Not sure how to do this.)The third is my favorite.