Skip to content

should fix_output_overlap return newbreaks #41

@felixcremer

Description

@felixcremer

I don't understand why the fix_output_overlap function returns the input data.
From a look at the code it doesn't look like the function is redefining lrbreaks.
Should this function rather return newbreaks?

function fix_output_overlap(outspecs,lrbreaks)
  @show lrbreaks
  for outspec in outspecs
    mylr = mysub(outspec.lw,lrbreaks)
    newbreaks = map(mylr,outspec.lw.windows.members) do breaks,window
      if get_overlap(window) isa Repeating
        r = collect(DiskArrays.chunktype_from_chunksizes(breaks))
        for i in 1:length(r)-1
          r1,r2 = r[i],r[i+1]
          split_orig = last(r1)
          moveleft = length(r1)>length(r2)
          isplit = split_orig
          r1_array, r2_array = window[first(r1)]:window[last(r1)],window[first(r2)]:window[last(r2)]
          while !isempty(intersect(r1_array,r2_array)) && r1 != r2
            isplit = moveleft ? (isplit - 1) : (isplit + 1)
            r1 = first(r1):isplit
            r2 = (isplit+1):last(r2)
            r1_array, r2_array = window[first(r1)]:window[last(r1)],window[first(r2)]:window[last(r2)]
          end
          r[i]=r1
          r[i+1]=r2
        end
        length.(r)
      else
        breaks
      end
    end
    @show newbreaks
    for (lr,b) in zip(mylr,newbreaks)
      lr.=b
    end
  end
  lrbreaks
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions