Skip to content

Conversation

@lachlangrose
Copy link
Member

Description

📝 Thanks for contributing to map2loop!
Please describe the issue that this pull request addresses and summarize the changes you are implementing.
Include relevant motivation and context, if appropriate.
List any new dependencies that are required for this change.

Fixes #(issue)

Type of change

  • Documentation update
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Test improvement

How Has This Been Tested?

Please describe any tests that you ran to verify your changes.
Provide branch name so we can reproduce.

Checklist:

  • This branch is up-to-date with master
  • All gh-action checks are passing
  • I have performed a self-review of my own code
  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • My tests run with pytest from the map2loop folder
  • New and existing tests pass locally with my changes

Checklist continued (if PR includes changes to documentation)

  • I have built the documentation locally with make.bat
  • I have built this documentation in docker, following the docker configuration in map2loop/docs
  • I have checked my spelling and grammar

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request implements fixes and improvements for QGIS plugin integration and general code quality enhancements. The changes focus on improving configurability of column names, adding defensive programming practices, and implementing callable interfaces for key classes.

Changes:

  • Enhanced column name configurability across sorter classes to support different data schemas
  • Added __call__ methods to Sampler, Sorter, and ThicknessCalculator for callable interface pattern
  • Improved handling of empty data and edge cases in thickness calculations and sorting algorithms
  • Fixed type hints and added explicit import paths

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
tests/project/test_thickness_calculations.py Updated import to use explicit module path for Project class
map2loop/utils/utility_functions.py Enhanced type hints to accept Union types for numeric parameters and added GeometryCollection return type
map2loop/topology.py Added configurable id_field parameter for fault identification
map2loop/thickness_calculator.py Improved location_tracking handling for empty data, added LineString import, fixed indentation, added call method, and removed duplicate UNITNAME column before spatial join
map2loop/sorter.py Added unit_name_column, unitname1_column, and unitname2_column configurability, imported networkx at module level, enhanced length column handling, and added call method
map2loop/sampler.py Added call method for callable interface
map2loop/project.py Added automatic configuration of min_age_column and max_age_column for sorters
map2loop/logging.py Added new setLogging function for flexible logging configuration
Comments suppressed due to low confidence (2)

map2loop/topology.py:50

  • The new id_field parameter is missing documentation in the docstring. The Args section should be updated to include this parameter and explain its purpose.
        """
        The initialiser for the map2model wrapper

        Args:
            map_data (MapData):
                The project map data structure to reference
            verbose_level (VerboseLevel, optional):
                How much console output is sent. Defaults to VerboseLevel.ALL.
        """

map2loop/logging.py:49

  • This assignment to 'logger' is unnecessary as it is redefined before this value is used.
logger = getLogger(__name__)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

required_arguments = ['min_age_column','max_age_column']
def __init__(self,*, min_age_column:Optional[str]='minAge', max_age_column:Optional[str]='maxAge'):
required_arguments = ['min_age_column','max_age_column','unit_name_column']
def __init__(self,*, unit_name_column:Optional[str]='name',min_age_column:Optional[str]='minAge', max_age_column:Optional[str]='maxAge'):
Copy link

Copilot AI Jan 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Type hint parameter should have spaces around the equals sign for consistency with Python style guidelines. Should be 'unit_name_column: Optional[str] = 'name'' instead of 'unit_name_column:Optional[str]='name''.

Suggested change
def __init__(self,*, unit_name_column:Optional[str]='name',min_age_column:Optional[str]='minAge', max_age_column:Optional[str]='maxAge'):
def __init__(
self,
*,
unit_name_column: Optional[str] = 'name',
min_age_column: Optional[str] = 'minAge',
max_age_column: Optional[str] = 'maxAge',
):

Copilot uses AI. Check for mistakes.
self,
*,
contacts: Optional[geopandas.GeoDataFrame] = None,
unit_name_column:Optional[str]='name',
Copy link

Copilot AI Jan 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Type hint parameter should have spaces around the equals sign for consistency with Python style guidelines. Should be 'unit_name_column: Optional[str] = 'name'' instead of 'unit_name_column:Optional[str]='name''.

Copilot uses AI. Check for mistakes.
start_point: shapely.geometry.Point, azimuth_deg: float, distance: int, bbox: pandas.DataFrame
) -> shapely.geometry.LineString:
start_point: shapely.geometry.Point, azimuth_deg: Union[float,int], distance: Union[float,int], bbox: pandas.DataFrame
) -> Union[shapely.geometry.LineString,shapely.geometry.GeometryCollection]:
Copy link

Copilot AI Jan 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Type hints should have spaces after commas for consistency with Python style guidelines. Should be 'Union[shapely.geometry.LineString, shapely.geometry.GeometryCollection]' instead of 'Union[shapely.geometry.LineString,shapely.geometry.GeometryCollection]'.

Suggested change
) -> Union[shapely.geometry.LineString,shapely.geometry.GeometryCollection]:
) -> Union[shapely.geometry.LineString, shapely.geometry.GeometryCollection]:

Copilot uses AI. Check for mistakes.
*,
contacts: Optional[geopandas.GeoDataFrame] = None,
unit_name_column:Optional[str]='name',
unitname1_column:Optional[str]='UNITNAME_1',
Copy link

Copilot AI Jan 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Type hint parameter should have spaces around the equals sign for consistency with Python style guidelines. Should be 'unitname1_column: Optional[str] = 'UNITNAME_1'' instead of 'unitname1_column:Optional[str]='UNITNAME_1''.

Copilot uses AI. Check for mistakes.
required_arguments = ['min_age_column','max_age_column']
def __init__(self,*, min_age_column:Optional[str]='minAge', max_age_column:Optional[str]='maxAge'):
required_arguments = ['min_age_column','max_age_column','unit_name_column']
def __init__(self,*, unit_name_column:Optional[str]='name',min_age_column:Optional[str]='minAge', max_age_column:Optional[str]='maxAge'):
Copy link

Copilot AI Jan 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parameters should have spaces after commas and around equals signs for consistency with Python style guidelines. Should be 'unit_name_column: Optional[str] = 'name', min_age_column: Optional[str] = 'minAge', max_age_column: Optional[str] = 'maxAge''.

Suggested change
def __init__(self,*, unit_name_column:Optional[str]='name',min_age_column:Optional[str]='minAge', max_age_column:Optional[str]='maxAge'):
def __init__(self, *, unit_name_column: Optional[str] = 'name', min_age_column: Optional[str] = 'minAge', max_age_column: Optional[str] = 'maxAge'):

Copilot uses AI. Check for mistakes.
df = pandas.DataFrame(0, index=unit_names, columns=unit_names)
for younger, older in ordered_unit_observations:
df.loc[younger, older] += 1
print(df, df.max())
Copy link

Copilot AI Jan 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debug print statement should be removed before merging to production code.

Copilot uses AI. Check for mistakes.
Comment on lines 187 to 188
start_point: shapely.geometry.Point, azimuth_deg: Union[float,int], distance: Union[float,int], bbox: pandas.DataFrame
) -> Union[shapely.geometry.LineString,shapely.geometry.GeometryCollection]:
Copy link

Copilot AI Jan 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Type hints should have spaces after commas for consistency with Python style guidelines. Should be 'Union[float, int]' instead of 'Union[float,int]'.

Suggested change
start_point: shapely.geometry.Point, azimuth_deg: Union[float,int], distance: Union[float,int], bbox: pandas.DataFrame
) -> Union[shapely.geometry.LineString,shapely.geometry.GeometryCollection]:
start_point: shapely.geometry.Point, azimuth_deg: Union[float, int], distance: Union[float, int], bbox: pandas.DataFrame
) -> Union[shapely.geometry.LineString, shapely.geometry.GeometryCollection]:

Copilot uses AI. Check for mistakes.
def __init__(
self,
*,
unit_name_column:Optional[str]='name',
Copy link

Copilot AI Jan 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Type hint parameter should have spaces around the equals sign for consistency with Python style guidelines. Should be 'unit_name_column: Optional[str] = 'name'' instead of 'unit_name_column:Optional[str]='name''.

Suggested change
unit_name_column:Optional[str]='name',
unit_name_column: Optional[str] = 'name',

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants