Other functions¶
- contourpy.convert_filled(filled, fill_type_from, fill_type_to)[source]¶
Convert filled contours from one
FillTypeto another.- Parameters:
filled (sequence of arrays) – Filled contour polygons to convert, such as those returned by
ContourGenerator.filled().fill_type_from (FillType or str) –
FillTypeto convert from as enum or string equivalent.fill_type_to (FillType or str) –
FillTypeto convert to as enum or string equivalent.
- Returns:
Converted filled contour polygons.
When converting non-chunked fill types (
FillType.OuterCodeorFillType.OuterOffset) to chunked ones, all polygons are placed in the first chunk. When converting in the other direction, all chunk information is discarded. Converting a fill type that is not aware of the relationship between outer boundaries and contained holes (FillType.ChunkCombinedCodeorFillType.ChunkCombinedOffset) to one that is will raise aValueError.Added in version 1.2.0.
- contourpy.convert_lines(lines, line_type_from, line_type_to)[source]¶
Convert contour lines from one
LineTypeto another.- Parameters:
lines (sequence of arrays) – Contour lines to convert, such as those returned by
ContourGenerator.lines().line_type_from (LineType or str) –
LineTypeto convert from as enum or string equivalent.line_type_to (LineType or str) –
LineTypeto convert to as enum or string equivalent.
- Returns:
Converted contour lines.
When converting non-chunked line types (
LineType.SeparateorLineType.SeparateCode) to chunked ones (LineType.ChunkCombinedCode,LineType.ChunkCombinedOffsetorLineType.ChunkCombinedNan), all lines are placed in the first chunk. When converting in the other direction, all chunk information is discarded.Added in version 1.2.0.
- contourpy.convert_multi_filled(multi_filled, fill_type_from, fill_type_to)[source]¶
Convert multiple sets of filled contours from one
FillTypeto another.- Parameters:
multi_filled (nested sequence of arrays) – Filled contour polygons to convert, such as those returned by
ContourGenerator.multi_filled().fill_type_from (FillType or str) –
FillTypeto convert from as enum or string equivalent.fill_type_to (FillType or str) –
FillTypeto convert to as enum or string equivalent.
- Returns:
Converted sets filled contour polygons.
When converting non-chunked fill types (
FillType.OuterCodeorFillType.OuterOffset) to chunked ones, all polygons are placed in the first chunk. When converting in the other direction, all chunk information is discarded. Converting a fill type that is not aware of the relationship between outer boundaries and contained holes (FillType.ChunkCombinedCodeorFillType.ChunkCombinedOffset) to one that is will raise aValueError.Added in version 1.3.0.
- contourpy.convert_multi_lines(multi_lines, line_type_from, line_type_to)[source]¶
Convert multiple sets of contour lines from one
LineTypeto another.- Parameters:
multi_lines (nested sequence of arrays) – Contour lines to convert, such as those returned by
ContourGenerator.multi_lines().line_type_from (LineType or str) –
LineTypeto convert from as enum or string equivalent.line_type_to (LineType or str) –
LineTypeto convert to as enum or string equivalent.
- Returns:
Converted set of contour lines.
When converting non-chunked line types (
LineType.SeparateorLineType.SeparateCode) to chunked ones (LineType.ChunkCombinedCode,LineType.ChunkCombinedOffsetorLineType.ChunkCombinedNan), all lines are placed in the first chunk. When converting in the other direction, all chunk information is discarded.Added in version 1.3.0.
- contourpy.dechunk_filled(filled, fill_type)[source]¶
Return the specified filled contours with chunked data moved into the first chunk.
Filled contours that are not chunked (
FillType.OuterCodeandFillType.OuterOffset) and those that are but only contain a single chunk are returned unmodified. Individual polygons are unchanged, they are not geometrically combined.- Parameters:
filled (sequence of arrays) – Filled contour data, such as returned by
ContourGenerator.filled().fill_type (FillType or str) – Type of
filled()as enum or string equivalent.
- Returns:
Filled contours in a single chunk.
Added in version 1.2.0.
- contourpy.dechunk_lines(lines, line_type)[source]¶
Return the specified contour lines with chunked data moved into the first chunk.
Contour lines that are not chunked (
LineType.SeparateandLineType.SeparateCode) and those that are but only contain a single chunk are returned unmodified. Individual lines are unchanged, they are not geometrically combined.- Parameters:
lines (sequence of arrays) – Contour line data, such as returned by
ContourGenerator.lines().line_type (LineType or str) – Type of
lines()as enum or string equivalent.
- Returns:
Contour lines in a single chunk.
Added in version 1.2.0.
- contourpy.dechunk_multi_filled(multi_filled, fill_type)[source]¶
Return multiple sets of filled contours with chunked data moved into the first chunks.
Filled contours that are not chunked (
FillType.OuterCodeandFillType.OuterOffset) and those that are but only contain a single chunk are returned unmodified. Individual polygons are unchanged, they are not geometrically combined.- Parameters:
multi_filled (nested sequence of arrays) – Filled contour data, such as returned by
ContourGenerator.multi_filled().fill_type (FillType or str) – Type of
filled()as enum or string equivalent.
- Returns:
Multiple sets of filled contours in a single chunk.
Added in version 1.3.0.
- contourpy.dechunk_multi_lines(multi_lines, line_type)[source]¶
Return multiple sets of contour lines with all chunked data moved into the first chunks.
Contour lines that are not chunked (
LineType.SeparateandLineType.SeparateCode) and those that are but only contain a single chunk are returned unmodified. Individual lines are unchanged, they are not geometrically combined.- Parameters:
multi_lines (nested sequence of arrays) – Contour line data, such as returned by
ContourGenerator.multi_lines().line_type (LineType or str) – Type of
lines()as enum or string equivalent.
- Returns:
Multiple sets of contour lines in a single chunk.
Added in version 1.3.0.
- contourpy.max_threads() int¶
Return the maximum number of threads, obtained from
std::thread::hardware_concurrency().This is the number of threads used by a multithreaded ContourGenerator if the kwarg
threads=0is passed tocontour_generator().