powderday icon indicating copy to clipboard operation
powderday copied to clipboard

`oref` != 0 leads to an array broadcasting error

Open christopherlovell opened this issue 3 years ago • 0 comments

Using an over refine factor greater than zero leads to a broadcasting error.

Traceback (most recent call last):
  File "/home/c.lovell/codes/powderday_chris/pd_front_end.py", line 74, in <module>
    m, xcent, ycent, zcent, dx, dy, dz, reg, ds, boost = m_gen(fname, field_add)
  File "/home/c.lovell/codes/powderday_chris/powderday/sph_tributary.py", line 35, in sph_m_gen
    refined,dustdens,fc1,fw1,reg,ds = yt_octree_generate(fname,field_add)
  File "/home/c.lovell/codes/powderday_chris/powderday/grid_construction.py", line 158, in yt_octree_generate
    dust_smoothed_manual = manual_oct(reg, refined)
  File "/home/c.lovell/codes/powderday_chris/powderday/dust_grid_gen.py", line 30, in manual_oct
    dust_smoothed[wFalse]  = dust_to_gas_ratio * density_smoothed
ValueError: shape mismatch: value array of shape (9619,) could not be broadcast to indexing result of shape (76952,)

I think there is possibly something going on around line 128 in powderday/grid_construction.py, where oref is used to define refined:

refinements = 2**(3*cfg.par.oref)
refined2 = []
for r in refined:
    if r == 1:
        refined2.append(True)
    if r == 0:
        refined2.append(np.zeros(refinements).astype('bool'))
refined = np.hstack(refined2)

christopherlovell avatar Aug 04 '21 11:08 christopherlovell