It looks like you're new here. If you want to get involved, click one of these buttons!
Hi Matthias,
I'm looking further into the TilingProcessor feature using the attached gds file (using version 0.28.17). It's a simple layout with a 5x5 array of 200um tiles with a random square on layer 4/0 in each one of them. When running the script below, the area of the first tile is not 40000um^2 as I would expect but a bit less as shown in the output to the console.
module MyMacro
      include RBA
      layout_view = Application.instance.main_window.current_view
      cell_view = layout_view.active_cellview
      layout = cell_view.layout
      viewed_cell = cell_view.cell
      dbu = layout.dbu
#--------- input --------------------------------------------------------------------------------------------
layer = "4/0"
tile_size = 200.0
#-------------------------------------------------------------------------------------------------------------
      puts "-"*120
      layer_number = layer.split("/")[0].to_i
      datatype_number = layer.split("/")[1].to_i
      input_layer_id = layout.layer(layer_number, datatype_number)
      class MyReceiver < TileOutputReceiver
          def put(ix, iy, tile, obj, dbu, clip)
            input_area = (obj*dbu**2).round(8)
            puts "Input area of tile #{ix+1},#{iy+1} in um^2: #{input_area.to_s}\t\t\tTile Extents in um: #{tile.left*dbu}, #{tile.bottom*dbu}, #{tile.right*dbu}, #{tile.top*dbu}"
          end # def
      end # class
      tp = TilingProcessor.new
      # register the custom receiver
      tp.output("my_receiver", MyReceiver::new)
      tp.input("input_layer", layout.begin_shapes(viewed_cell, input_layer_id))
      tp.tile_size(tile_size, tile_size)
      # The script clips the input at the tile and computes the (merged) area:
      tp.queue("_output(my_receiver, (input_layer & _tile).area)")
      tp.execute("Job description")
      puts "-"*120
end # Module
First few lines of console output:
Input area of tile 1,1 in um^2: 38311.960932            Tile Extents in um: -2.593, -5.924, 197.407, 194.076
Input area of tile 1,2 in um^2: 24662.358144            Tile Extents in um: -2.593, 194.076, 197.407, 394.076
Input area of tile 1,3 in um^2: 5551.7401           Tile Extents in um: -2.593, 394.076, 197.407, 594.076
Input area of tile 1,4 in um^2: 23350.8961          Tile Extents in um: -2.593, 594.076, 197.407, 794.076
Input area of tile 1,5 in um^2: 18559.702756            Tile Extents in um: -2.593, 794.076, 197.407, 994.076
Input area of tile 2,1 in um^2: 4635.928864         Tile Extents in um: 197.407, -5.924, 397.407, 194.076
...
The tiling array seems not to be centered around the original layout's center, but rather around the center of the bbox of the input layer 4/0.
When I force the tiling origin by adding:
tp.tile_origin(0.0, 0.0)
the result is as expected:
Input area of tile 1,1 in um^2: 40000.0                 Tile Extents in um: 0.0, 0.0, 200.0, 200.0
Input area of tile 1,2 in um^2: 23492.919076            Tile Extents in um: 0.0, 200.0, 200.0, 400.0
Input area of tile 1,3 in um^2: 5551.7401           Tile Extents in um: 0.0, 400.0, 200.0, 600.0
Input area of tile 1,4 in um^2: 23350.8961          Tile Extents in um: 0.0, 600.0, 200.0, 800.0
Input area of tile 1,5 in um^2: 18559.702756            Tile Extents in um: 0.0, 800.0, 200.0, 1000.0
Input area of tile 2,1 in um^2: 4132.689796         Tile Extents in um: 200.0, 0.0, 400.0, 200.0
...
Does that make sense?
Cheers,
Tomas
Comments
Hi @tomas2004,
Yes, that's how it is defined. When you don't specify a tile origin, the tiles will be centered on the input layer's bounding box. This minimizes the number of tiles in general.
Only if you specify the origin, the raster is fixed.
Matthias
Hello Matthias,
Thanks for verifying. Makes sense.
Cheers,
Tomas