Skip to content

File formats

To save or load patterns in any format, make sure you are using FileIO.

Saving patterns

This package can load/save patterns in the GDS-II format for use with e-beam lithography systems. In the future it may be useful to implement machine-specific pattern formats to force fracturing or dosing in an explicit manner.

# FileIO.saveMethod.

save(::Union{AbstractString,IO}, cell0::Cell{T}, cell::Cell...)
save(f::File{format"GDS"}, cell0::Cell, cell::Cell...;
    name="GDSIILIB", userunit=1μm, modify=now(), acc=now(),
    verbose=false)

This bottom method is implicitly called when you use the convenient syntax of the top method: save("/path/to/my.gds", cells_i_want_to_save...)

Keyword arguments include:

  • name: used for the internal library name of the GDS-II file and probably inconsequential for modern workflows.
  • userunit: sets what 1.0 corresponds to when viewing this file in graphical GDS editors with inferior unit support.
  • modify: date of last modification.
  • acc: date of last accession. It would be unusual to have this differ from now().
  • verbose: monitor the output of traverse! and order! to see if something funny is happening while saving.

source

Using the Cairo graphics library, it is possible to save patterns into SVG, PDF, and EPS vector graphics formats, or into the PNG raster graphic format. This enables patterns to be displayed in web browsers, publications, presentations, and so on. You can save a cell to a graphics file by, e.g. save("/path/to/file.svg", mycell). Note that cell references and arrays are not saved, so you should flatten cells if desired before saving them.

Possible keyword arguments include:

  • width: Specifies the width parameter of the SVG tag. Defaults to the width of the cell bounding box (stripped of units).
  • height: Specifies the height parameter of the SVG tag. Defaults to the height of the cell bounding box (stripped of units).
  • layercolors: Should be a dictionary with Int keys for layers and color strings as values. By color strings we mean "#ff0000", "red", "rgb(255,0,0)", etc.
  • bboxes: Specifies whether to draw bounding boxes around the bounds of cell arrays or cell references (true/false).

Loading patterns

# FileIO.loadMethod.

load(f::File{format"GDS"}; verbose::Bool=false, nounits::Bool=false)

A dictionary of top-level cells (Cell objects) found in the GDS-II file is returned. The dictionary keys are the cell names. The other cells in the GDS-II file are retained by CellReference or CellArray objects held by the top-level cells. Currently, cell references and arrays are not implemented.

The FileIO package recognizes files based on "magic bytes" at the start of the file. To permit any version of GDS-II file to be read, we consider the magic bytes to be the GDS HEADER tag (0x0002), preceded by the number of bytes in total (0x0006) for the entire HEADER record. The last well-documented version of GDS-II is v6.0.0, encoded as 0x0258 == 600. LayoutEditor appears to save a version 7 as 0x0007, which as far as I can tell is unofficial, and probably just permits more layers than 64, or extra characters in cell names, etc.

If the database scale is 1μm, 1nm, or 1pm, then the corresponding unit is used for the resulting imported cells. Otherwise, an "anonymous unit" is used that will display as u"2.4μm" if the database scale is 2.4μm, say.

Warnings are thrown if the GDS-II file does not begin with a BGNLIB record following the HEADER record, but loading will proceed.

Encountering an ENDLIB record will discard the remainder of the GDS-II file without warning. If no ENDLIB record is present, a warning will be thrown.

The content of some records are currently discarded (mainly the more obscure GDS-II record types, but also BGNLIB and LIBNAME).

If nounits is true, Cell{Float64} objects will be returned, where 1.0 corresponds to one micron.

source