Skip to content

Conversation

@pqvr
Copy link
Contributor

@pqvr pqvr commented Jun 9, 2025

Description

  • Renames nlz to ntz to indicate that the function determines the number of trailing zeros (not leading zeros).
  • Deprecates nlz to alias to ntz
  • Updates in docs, etc. where appropriate.

Please verify that you have completed the following steps

  • I have self-reviewed my code.
  • I have included test cases validating introduced feature/fix.
  • I have updated documentation.

@pqvr pqvr requested a review from mstechly June 9, 2025 11:25
@cla-bot cla-bot bot added the cla-signed label Jun 9, 2025
@pqvr pqvr changed the title Rename nlz to ntz chore: rename nlz to ntz Jun 9, 2025
@pqvr pqvr merged commit 0bd387a into main Jun 9, 2025
8 checks passed
@pqvr pqvr deleted the rename-nlz-to-ntz branch June 9, 2025 18:39
Brendan-Reid1991 pushed a commit that referenced this pull request Jun 10, 2025
* chore: rename nlz to ntz

* chore: add deprecated class alias.

* fix: test and linter
Brendan-Reid1991 added a commit that referenced this pull request Jun 12, 2025
* refactor: made pandas and plotly optional installs

* Added checks to ensure tests do not fail unexpectedly

* ran isort

* Added .venv to .gitignore

* Addition of pandas stubs changed behaviour of scipy stubs; quick fix

* renamed visualization->interactive

* updated extras flag

* renamed vis->viz

* chore: rename nlz to ntz (#225)

* chore: rename nlz to ntz

* chore: add deprecated class alias.

* fix: test and linter

* added plotly-stubs; may revert

* Removed type: ignore

* removed type: ignore; updated error message

* fixing plotly-stubs install

* Removed plotly-stubs entirely.

* added pytest.importorskip to module

* Added noqa to pass flake8

* Ran isort

* isort versioning mismatch

* Streamlined some aspects of the TreeMap class; removed unnecessary checks

* Removing unused imports

* fix: Fix typing in analysis module

---------

Co-authored-by: pqvr <work.vrpq@gmail.com>
Co-authored-by: Konrad Jałowiecki <dexter2206@gmail.com>
Brendan-Reid1991 pushed a commit that referenced this pull request Jun 12, 2025
* chore: rename nlz to ntz

* chore: add deprecated class alias.

* fix: test and linter
Brendan-Reid1991 added a commit that referenced this pull request Jun 12, 2025
* refactor: made pandas and plotly optional installs

* Added checks to ensure tests do not fail unexpectedly

* ran isort

* Added .venv to .gitignore

* Addition of pandas stubs changed behaviour of scipy stubs; quick fix

* renamed visualization->interactive

* updated extras flag

* renamed vis->viz

* chore: rename nlz to ntz (#225)

* chore: rename nlz to ntz

* chore: add deprecated class alias.

* fix: test and linter

* added plotly-stubs; may revert

* Removed type: ignore

* removed type: ignore; updated error message

* fixing plotly-stubs install

* Removed plotly-stubs entirely.

* added pytest.importorskip to module

* Added noqa to pass flake8

* Ran isort

* isort versioning mismatch

* Streamlined some aspects of the TreeMap class; removed unnecessary checks

* Removing unused imports

* fix: Fix typing in analysis module

---------

Co-authored-by: pqvr <work.vrpq@gmail.com>
Co-authored-by: Konrad Jałowiecki <dexter2206@gmail.com>
Brendan-Reid1991 added a commit that referenced this pull request Jun 23, 2025
…lass (#205)

* chore: Added a comment about allow_transitive_resources to tutorial #1

* chore: added allow_transitive_resources=False; added quotes to Note about interactive tools

* chore: updated tutorial 3

* chore: Added sentences about transitive compilation of resources

* refactor: Created `CompilationFlags` enum

* refactor: Replaced asserts with Exceptions; added fix for repetitions + transitive resources

* refactor: Added CompilationFlags to init

* chore: Updated docstrings

* chore: updating tests for CompilationFlags

* chore: Modified tests to catch edge case errors (previously assertions)

* refactor: Changed assertions into Exceptions

* bugfix: Changed None -> CompilationsFlags(0)

* chore: Updated compilation to discuss transitivity and compilation flags

* chore: Updated tutorials with Compilation Flags

* refactor: creating analysis submodule.

* feat: Began work on sympy manipulator

* feat: added instruction types enum; adding functionality to SM

* refactor: split base class + sympyManipulator into separate modules

* chore: removed generic types

* refactor: Moved InstructionsType enum

* feat: Added `focus` method. Generic types added

* refactor: Renamed SympyManipulation -> SympyManipulator

* fix: removed testing code

* refactor: renamed analysis.py -> optimization.py

* refactor: created analysis module

* feat: created rewriters module

* feat: added expressionwriter abc

* feat: subclassed from expressionwriter

* chore: improving typing

* feat: Added basic tests for rewriters

* chore: improved typing, added docstrings

* feat: improved typing; added docstrings

* chore: ran isort

* chore: fixed typing issues

* chore: added module level docstrings

* chore: removed unused import

* chore: erroneous line introduced

* chore: added module level docstring

* chore: improved typing in update_expression

* chore: added module level docstring; removed return section of docstring and improved descriptions

* chore: Type -> type

* chore: made expression_rewriter.py public

* refactor: renamed variables -> free_symbols

* refactor: improved docstrings

* chore: correcting imports

* refactor: renamed test_variables, and improved it such that it will work for all backends

* chore: added copyright message

* refactor: renamed free_symbols_in -> free_symbols

* chore: updated docstrings

* chore: isort fix

* docs: improve the API docs (#209)

* docs: Added the list of possible values for `ResourceType` and `PortDirection` on docstring

* docs: Added missing `Raises` sections in existing docstrings

* docs: Improved styling of function segments in docs for easy navigation

* docs: Added clickable reference links to parts of documentations in doc strings

* fix: Fixed the formatting and lint issues

* fix(docs): Fixed docs reference issues on`_compile.py`, `_evaluate.py` & `_routine.py`

* fix: Exposed `SymbolicBackend` through `bartiq.symbolics`

* fix: Exposed `Port` at top level (`bartiq.Port`)

* docs: Adding doc-string for `Port` class

* fix(docs): Added missing Args, and references in modified docs

* fix(docs): Added External references

* fix(docs): Fixed issues of long `Return` descriptions

* fix(docs): Reverting `symbolics` concept markdown content

* fix(docs): Improved styling of overload functions displayed in docs & removed type hints for `postorder_transform`

* fix(docs): Fixed a formatting issue in the module doc-string

* fix(docs): Removed `SymbolicBackend`  from exposing to top-level, and added submodule rendering and extra styling for documentation

* fix(docs): Removed unnecessary doc-strings in each `postorder_transform` overload function

* fix(docs): Extended `module` & `method` annotations in docs

* chore: Added a comment about allow_transitive_resources to tutorial #1

* chore: added allow_transitive_resources=False; added quotes to Note about interactive tools

* chore: updated tutorial 3

* chore: Added sentences about transitive compilation of resources

* refactor: Created `CompilationFlags` enum

* refactor: Replaced asserts with Exceptions; added fix for repetitions + transitive resources

* chore: Updated docstrings

* chore: updating tests for CompilationFlags

* chore: Modified tests to catch edge case errors (previously assertions)

* chore: Updated tutorials with Compilation Flags

* refactor: creating analysis submodule.

* docs: improve the API docs (#209)

* docs: Added the list of possible values for `ResourceType` and `PortDirection` on docstring

* docs: Added missing `Raises` sections in existing docstrings

* docs: Improved styling of function segments in docs for easy navigation

* docs: Added clickable reference links to parts of documentations in doc strings

* fix: Fixed the formatting and lint issues

* fix(docs): Fixed docs reference issues on`_compile.py`, `_evaluate.py` & `_routine.py`

* fix: Exposed `SymbolicBackend` through `bartiq.symbolics`

* fix: Exposed `Port` at top level (`bartiq.Port`)

* docs: Adding doc-string for `Port` class

* fix(docs): Added missing Args, and references in modified docs

* fix(docs): Added External references

* fix(docs): Fixed issues of long `Return` descriptions

* fix(docs): Reverting `symbolics` concept markdown content

* fix(docs): Improved styling of overload functions displayed in docs & removed type hints for `postorder_transform`

* fix(docs): Fixed a formatting issue in the module doc-string

* fix(docs): Removed `SymbolicBackend`  from exposing to top-level, and added submodule rendering and extra styling for documentation

* fix(docs): Removed unnecessary doc-strings in each `postorder_transform` overload function

* fix(docs): Extended `module` & `method` annotations in docs

* chore: resolving conflicts

* chore: free_symbols_in -> free_symbols

* chore: free_symbols_in -> free_symbols

* Resolving conflicts

* began typing fixes

* Removed expression getter/setter. Updated typing

* Removed commented out code

* feat: added treemap visualisation class (#216)

* Added GSE prototype

* Trialling a decorator function

* Added warning if no update applied; added methods to isolate functions and their arguments

* Minor fix

* Removed userwarning due to bug

* Added catch for top level expression

* Added better support for parsing assumptions and redefining symbols

* Potential bugfix; Symbols now updated correctly

* Improved logic parsing

* bug fix

* Improved detection of nonzero Symbols

* Added warning if an expression does not change

* defaulting suppress_warnings to true; still experimental

* Updated check_expression_update to catch edge cases

* bug fix: when parsing known symbols with reference values!=0

* Undoing code removal

* Minor change for readaility

* more bug fixes

* More bug fixes

* Hopefully the last bug fix

* tbd

* tbd

* Updated imports after merge

* Minor improvements

* Added ability to evaluate gnarly

* Attempting to fix evaluation bug

* bug fix

* bug  found on substitute

* Removed unused import

* Added fix to allow substitute to refer to symbols rather than symbol names

* Removed unnecessary print statement

* Bandaid fix for minor bug

* Small fix

* fix: proper detection for zero arguments

* Upgraded grammar and text in alias-sampling

* Only minor changes to the third tutorial

* Typo fix.

* Added visualisations module; needs depth parameter.

* scratch notebook

* Pausing work; creating issue in bartiq.

* feat: visualisation improvement cleanup

* feat: visualisation improvement cleanup

* feat: create a method that can handle dataframe with redundant names

* test: test the new method

* chore: linting

* chore: include pandas and plotly in dependencies

* Update src/bartiq/visualisations.py

Co-authored-by: Dr Brendan Reid <53276074+Brendan-Reid1991@users.noreply.github.com>

* chore: file removal and renaming from review

* feat: added is_numeric method and visualization input validation check logic

* test: added compiled routine is_numeric tests and input validation for visualization

* chore: remove scale_to

* chore: delete changes to sympy backend

* chore: private function instead of classmethod

* chore: reset advanced example

* chore: validation checking invalid resource to plot

* chore: avoid duplication of strings when calling px.treemap

* test: output data frame is as expected

* test: test plot output type

* chore: adjust docstring and test function signatures

* chore: linting

* chore: linting

* chore: address review comments

* chore: address review comment

---------

Co-authored-by: brendan reid <brendan.reid1991@gmail.com>
Co-authored-by: Brendan Reid <breid@psiquantum.com>
Co-authored-by: Dr Brendan Reid <53276074+Brendan-Reid1991@users.noreply.github.com>

* chore: rename nlz to ntz (#225)

* chore: rename nlz to ntz

* chore: add deprecated class alias.

* fix: test and linter

* Removed reference to ._expr

* improved typing

* Modifying Basic -> Expr as generic type.

* Modified fixture

* improved typing

* Moved expand test to be sympy specific

* changed fixture scope from 'class' to 'function'

* renamed as_individual_terms - > individual_terms

* Renamed property; ran isort

* renamed as_individual_terms -> individual_terms

* typo fix

* Removed fixtures from tests and restructured them

* chore: update poetry.lock file for dependabot (#227)

* chore: update poetry.lock file for dependabot

* chore: update lock file

* chore: remove h11 as transient dependency

* chore: update poetry lock

* refactor: made pandas and plotly optional installs (#226)

* refactor: made pandas and plotly optional installs

* Added checks to ensure tests do not fail unexpectedly

* ran isort

* Added .venv to .gitignore

* Addition of pandas stubs changed behaviour of scipy stubs; quick fix

* renamed visualization->interactive

* updated extras flag

* renamed vis->viz

* chore: rename nlz to ntz (#225)

* chore: rename nlz to ntz

* chore: add deprecated class alias.

* fix: test and linter

* added plotly-stubs; may revert

* Removed type: ignore

* removed type: ignore; updated error message

* fixing plotly-stubs install

* Removed plotly-stubs entirely.

* added pytest.importorskip to module

* Added noqa to pass flake8

* Ran isort

* isort versioning mismatch

* Streamlined some aspects of the TreeMap class; removed unnecessary checks

* Removing unused imports

* fix: Fix typing in analysis module

---------

Co-authored-by: pqvr <work.vrpq@gmail.com>
Co-authored-by: Konrad Jałowiecki <dexter2206@gmail.com>

* updated substitute function to account for symbols with assumptions on them

* attempting to consolidate the typing

* Added sequence of commands as a test

* removing unused import

* Updating typing

* Implementing Konrads changes

* remove trailing whitespace

* added return statement

* minor changes to typing

* removing sequence of commands test

* fixing linting; temporary fix

---------

Co-authored-by: Avin Divakara <67309607+AVDiv@users.noreply.github.com>
Co-authored-by: antalszava <antalszava@gmail.com>
Co-authored-by: pqvr <work.vrpq@gmail.com>
Co-authored-by: Konrad Jałowiecki <dexter2206@gmail.com>
Brendan-Reid1991 added a commit that referenced this pull request Jun 30, 2025
* chore: Added a comment about allow_transitive_resources to tutorial #1

* chore: added allow_transitive_resources=False; added quotes to Note about interactive tools

* chore: updated tutorial 3

* chore: Added sentences about transitive compilation of resources

* refactor: Created `CompilationFlags` enum

* refactor: Replaced asserts with Exceptions; added fix for repetitions + transitive resources

* refactor: Added CompilationFlags to init

* chore: Updated docstrings

* chore: updating tests for CompilationFlags

* chore: Modified tests to catch edge case errors (previously assertions)

* refactor: Changed assertions into Exceptions

* bugfix: Changed None -> CompilationsFlags(0)

* chore: Updated compilation to discuss transitivity and compilation flags

* chore: Updated tutorials with Compilation Flags

* refactor: creating analysis submodule.

* feat: Began work on sympy manipulator

* feat: added instruction types enum; adding functionality to SM

* refactor: split base class + sympyManipulator into separate modules

* chore: removed generic types

* refactor: Moved InstructionsType enum

* feat: Added `focus` method. Generic types added

* refactor: Renamed SympyManipulation -> SympyManipulator

* fix: removed testing code

* refactor: renamed analysis.py -> optimization.py

* refactor: created analysis module

* feat: created rewriters module

* feat: added expressionwriter abc

* feat: subclassed from expressionwriter

* chore: improving typing

* feat: Added basic tests for rewriters

* chore: improved typing, added docstrings

* feat: improved typing; added docstrings

* chore: ran isort

* chore: fixed typing issues

* chore: added module level docstrings

* chore: removed unused import

* chore: erroneous line introduced

* chore: added module level docstring

* chore: improved typing in update_expression

* chore: added module level docstring; removed return section of docstring and improved descriptions

* chore: Type -> type

* chore: made expression_rewriter.py public

* refactor: renamed variables -> free_symbols

* refactor: improved docstrings

* chore: correcting imports

* refactor: renamed test_variables, and improved it such that it will work for all backends

* chore: added copyright message

* refactor: renamed free_symbols_in -> free_symbols

* chore: updated docstrings

* chore: isort fix

* docs: improve the API docs (#209)

* docs: Added the list of possible values for `ResourceType` and `PortDirection` on docstring

* docs: Added missing `Raises` sections in existing docstrings

* docs: Improved styling of function segments in docs for easy navigation

* docs: Added clickable reference links to parts of documentations in doc strings

* fix: Fixed the formatting and lint issues

* fix(docs): Fixed docs reference issues on`_compile.py`, `_evaluate.py` & `_routine.py`

* fix: Exposed `SymbolicBackend` through `bartiq.symbolics`

* fix: Exposed `Port` at top level (`bartiq.Port`)

* docs: Adding doc-string for `Port` class

* fix(docs): Added missing Args, and references in modified docs

* fix(docs): Added External references

* fix(docs): Fixed issues of long `Return` descriptions

* fix(docs): Reverting `symbolics` concept markdown content

* fix(docs): Improved styling of overload functions displayed in docs & removed type hints for `postorder_transform`

* fix(docs): Fixed a formatting issue in the module doc-string

* fix(docs): Removed `SymbolicBackend`  from exposing to top-level, and added submodule rendering and extra styling for documentation

* fix(docs): Removed unnecessary doc-strings in each `postorder_transform` overload function

* fix(docs): Extended `module` & `method` annotations in docs

* feat: began development on assumptions

* chore: Added a comment about allow_transitive_resources to tutorial #1

* chore: added allow_transitive_resources=False; added quotes to Note about interactive tools

* chore: updated tutorial 3

* chore: Added sentences about transitive compilation of resources

* refactor: Created `CompilationFlags` enum

* refactor: Replaced asserts with Exceptions; added fix for repetitions + transitive resources

* chore: Updated docstrings

* chore: updating tests for CompilationFlags

* chore: Modified tests to catch edge case errors (previously assertions)

* chore: Updated tutorials with Compilation Flags

* refactor: creating analysis submodule.

* docs: improve the API docs (#209)

* docs: Added the list of possible values for `ResourceType` and `PortDirection` on docstring

* docs: Added missing `Raises` sections in existing docstrings

* docs: Improved styling of function segments in docs for easy navigation

* docs: Added clickable reference links to parts of documentations in doc strings

* fix: Fixed the formatting and lint issues

* fix(docs): Fixed docs reference issues on`_compile.py`, `_evaluate.py` & `_routine.py`

* fix: Exposed `SymbolicBackend` through `bartiq.symbolics`

* fix: Exposed `Port` at top level (`bartiq.Port`)

* docs: Adding doc-string for `Port` class

* fix(docs): Added missing Args, and references in modified docs

* fix(docs): Added External references

* fix(docs): Fixed issues of long `Return` descriptions

* fix(docs): Reverting `symbolics` concept markdown content

* fix(docs): Improved styling of overload functions displayed in docs & removed type hints for `postorder_transform`

* fix(docs): Fixed a formatting issue in the module doc-string

* fix(docs): Removed `SymbolicBackend`  from exposing to top-level, and added submodule rendering and extra styling for documentation

* fix(docs): Removed unnecessary doc-strings in each `postorder_transform` overload function

* fix(docs): Extended `module` & `method` annotations in docs

* chore: resolving conflicts

* chore: free_symbols_in -> free_symbols

* chore: free_symbols_in -> free_symbols

* Resolving conflicts

* Improving assumptions handling

* began typing fixes

* Removed expression getter/setter. Updated typing

* Removed commented out code

* feat: added treemap visualisation class (#216)

* Added GSE prototype

* Trialling a decorator function

* Added warning if no update applied; added methods to isolate functions and their arguments

* Minor fix

* Removed userwarning due to bug

* Added catch for top level expression

* Added better support for parsing assumptions and redefining symbols

* Potential bugfix; Symbols now updated correctly

* Improved logic parsing

* bug fix

* Improved detection of nonzero Symbols

* Added warning if an expression does not change

* defaulting suppress_warnings to true; still experimental

* Updated check_expression_update to catch edge cases

* bug fix: when parsing known symbols with reference values!=0

* Undoing code removal

* Minor change for readaility

* more bug fixes

* More bug fixes

* Hopefully the last bug fix

* tbd

* tbd

* Updated imports after merge

* Minor improvements

* Added ability to evaluate gnarly

* Attempting to fix evaluation bug

* bug fix

* bug  found on substitute

* Removed unused import

* Added fix to allow substitute to refer to symbols rather than symbol names

* Removed unnecessary print statement

* Bandaid fix for minor bug

* Small fix

* fix: proper detection for zero arguments

* Upgraded grammar and text in alias-sampling

* Only minor changes to the third tutorial

* Typo fix.

* Added visualisations module; needs depth parameter.

* scratch notebook

* Pausing work; creating issue in bartiq.

* feat: visualisation improvement cleanup

* feat: visualisation improvement cleanup

* feat: create a method that can handle dataframe with redundant names

* test: test the new method

* chore: linting

* chore: include pandas and plotly in dependencies

* Update src/bartiq/visualisations.py

Co-authored-by: Dr Brendan Reid <53276074+Brendan-Reid1991@users.noreply.github.com>

* chore: file removal and renaming from review

* feat: added is_numeric method and visualization input validation check logic

* test: added compiled routine is_numeric tests and input validation for visualization

* chore: remove scale_to

* chore: delete changes to sympy backend

* chore: private function instead of classmethod

* chore: reset advanced example

* chore: validation checking invalid resource to plot

* chore: avoid duplication of strings when calling px.treemap

* test: output data frame is as expected

* test: test plot output type

* chore: adjust docstring and test function signatures

* chore: linting

* chore: linting

* chore: address review comments

* chore: address review comment

---------

Co-authored-by: brendan reid <brendan.reid1991@gmail.com>
Co-authored-by: Brendan Reid <breid@psiquantum.com>
Co-authored-by: Dr Brendan Reid <53276074+Brendan-Reid1991@users.noreply.github.com>

* chore: rename nlz to ntz (#225)

* chore: rename nlz to ntz

* chore: add deprecated class alias.

* fix: test and linter

* Removed reference to ._expr

* improved typing

* Modifying Basic -> Expr as generic type.

* Modified fixture

* improved typing

* Moved expand test to be sympy specific

* changed fixture scope from 'class' to 'function'

* renamed as_individual_terms - > individual_terms

* Renamed property; ran isort

* renamed as_individual_terms -> individual_terms

* typo fix

* Removed fixtures from tests and restructured them

* chore: update poetry.lock file for dependabot (#227)

* chore: update poetry.lock file for dependabot

* chore: update lock file

* chore: remove h11 as transient dependency

* chore: update poetry lock

* refactor: made pandas and plotly optional installs (#226)

* refactor: made pandas and plotly optional installs

* Added checks to ensure tests do not fail unexpectedly

* ran isort

* Added .venv to .gitignore

* Addition of pandas stubs changed behaviour of scipy stubs; quick fix

* renamed visualization->interactive

* updated extras flag

* renamed vis->viz

* chore: rename nlz to ntz (#225)

* chore: rename nlz to ntz

* chore: add deprecated class alias.

* fix: test and linter

* added plotly-stubs; may revert

* Removed type: ignore

* removed type: ignore; updated error message

* fixing plotly-stubs install

* Removed plotly-stubs entirely.

* added pytest.importorskip to module

* Added noqa to pass flake8

* Ran isort

* isort versioning mismatch

* Streamlined some aspects of the TreeMap class; removed unnecessary checks

* Removing unused imports

* fix: Fix typing in analysis module

---------

Co-authored-by: pqvr <work.vrpq@gmail.com>
Co-authored-by: Konrad Jałowiecki <dexter2206@gmail.com>

* updated substitute function to account for symbols with assumptions on them

* attempting to consolidate the typing

* Added sequence of commands as a test

* removing unused import

* Updating typing

* Implementing Konrads changes

* remove trailing whitespace

* added return statement

* reimplementing lost changes

* Implementing SympyAssumption

* made it so child classes of ExpressionRewriters do not need the decorator

* moved evaluation check into Assumptions _post_init_

* started assumptions tracking

* quick fix for custom max problem

* improved docstrings and added comments

* added reapply_all_assumptions

* formatting

* improving properties dict

* isort

* formatting

* began tests

* updated properties dict

* added tests

* formatting

* added comment on _add_assumption

* deleted test file

* fixing mypy issues

* fixing mypy issues

* fixing import for py3.10

* isort

* minor typo fix

* added hash to assumptions

* added decorator to override custom max

* minor refactor after removing custom max

* began improving tests

* added classmethod to sympy_backend

* added classmethod to sympy_backend

* added tests for .with_sympy_max

* rename Relationals -> Comparators

* rename relationship->comparator

* minor typo fix

* re-adding assumptions after mistaken deletion

* changed from using float to literal_eval

* added more tests for assumptions

* minor fixes

* improved typehinting

* improved tracking of assumptions

* improved tracking of assumptions

* streamlined dataclass interactions

* deleting test file

* bug fixes

* change from all caps to snake case

* moving some assumptions tests into basic tests

* fixing docstring inconsistencies

* quick fixes from michals review

* Removed classmethod; moved logic to `parse_to_sympy`

* modified interpreter to override certain functions

* modified rewriter backend def

* removed test until we settle on impl

* bug fixes, test fixes

* deleted unwanted file

* mypy fix

* added function_overrides to sympyinterpreter

* updated sympybackend with new properties

* updated rewriter after changes to sympy backend

* modified backend after changes to interpreter

* removing unnecessary kwargs

* improved docstrings

* added tests for sympy_backend when using sympy max

* rename assume->assumption

* fix typing error

* test renaming

* renaming assumption->assume

* typo

* another typo

* renamed kwarg to assumption

---------

Co-authored-by: Avin Divakara <67309607+AVDiv@users.noreply.github.com>
Co-authored-by: antalszava <antalszava@gmail.com>
Co-authored-by: pqvr <work.vrpq@gmail.com>
Co-authored-by: Konrad Jałowiecki <dexter2206@gmail.com>
Brendan-Reid1991 added a commit that referenced this pull request Jul 2, 2025
…ory tracking (#237)

* chore: Added a comment about allow_transitive_resources to tutorial #1

* chore: added allow_transitive_resources=False; added quotes to Note about interactive tools

* chore: updated tutorial 3

* chore: Added sentences about transitive compilation of resources

* refactor: Created `CompilationFlags` enum

* refactor: Replaced asserts with Exceptions; added fix for repetitions + transitive resources

* refactor: Added CompilationFlags to init

* chore: Updated docstrings

* chore: updating tests for CompilationFlags

* chore: Modified tests to catch edge case errors (previously assertions)

* refactor: Changed assertions into Exceptions

* bugfix: Changed None -> CompilationsFlags(0)

* chore: Updated compilation to discuss transitivity and compilation flags

* chore: Updated tutorials with Compilation Flags

* refactor: creating analysis submodule.

* feat: Began work on sympy manipulator

* feat: added instruction types enum; adding functionality to SM

* refactor: split base class + sympyManipulator into separate modules

* chore: removed generic types

* refactor: Moved InstructionsType enum

* feat: Added `focus` method. Generic types added

* refactor: Renamed SympyManipulation -> SympyManipulator

* fix: removed testing code

* refactor: renamed analysis.py -> optimization.py

* refactor: created analysis module

* feat: created rewriters module

* feat: added expressionwriter abc

* feat: subclassed from expressionwriter

* chore: improving typing

* feat: Added basic tests for rewriters

* chore: improved typing, added docstrings

* feat: improved typing; added docstrings

* chore: ran isort

* chore: fixed typing issues

* chore: added module level docstrings

* chore: removed unused import

* chore: erroneous line introduced

* chore: added module level docstring

* chore: improved typing in update_expression

* chore: added module level docstring; removed return section of docstring and improved descriptions

* chore: Type -> type

* chore: made expression_rewriter.py public

* refactor: renamed variables -> free_symbols

* refactor: improved docstrings

* chore: correcting imports

* refactor: renamed test_variables, and improved it such that it will work for all backends

* chore: added copyright message

* refactor: renamed free_symbols_in -> free_symbols

* chore: updated docstrings

* chore: isort fix

* docs: improve the API docs (#209)

* docs: Added the list of possible values for `ResourceType` and `PortDirection` on docstring

* docs: Added missing `Raises` sections in existing docstrings

* docs: Improved styling of function segments in docs for easy navigation

* docs: Added clickable reference links to parts of documentations in doc strings

* fix: Fixed the formatting and lint issues

* fix(docs): Fixed docs reference issues on`_compile.py`, `_evaluate.py` & `_routine.py`

* fix: Exposed `SymbolicBackend` through `bartiq.symbolics`

* fix: Exposed `Port` at top level (`bartiq.Port`)

* docs: Adding doc-string for `Port` class

* fix(docs): Added missing Args, and references in modified docs

* fix(docs): Added External references

* fix(docs): Fixed issues of long `Return` descriptions

* fix(docs): Reverting `symbolics` concept markdown content

* fix(docs): Improved styling of overload functions displayed in docs & removed type hints for `postorder_transform`

* fix(docs): Fixed a formatting issue in the module doc-string

* fix(docs): Removed `SymbolicBackend`  from exposing to top-level, and added submodule rendering and extra styling for documentation

* fix(docs): Removed unnecessary doc-strings in each `postorder_transform` overload function

* fix(docs): Extended `module` & `method` annotations in docs

* feat: began development on assumptions

* chore: Added a comment about allow_transitive_resources to tutorial #1

* chore: added allow_transitive_resources=False; added quotes to Note about interactive tools

* chore: updated tutorial 3

* chore: Added sentences about transitive compilation of resources

* refactor: Created `CompilationFlags` enum

* refactor: Replaced asserts with Exceptions; added fix for repetitions + transitive resources

* chore: Updated docstrings

* chore: updating tests for CompilationFlags

* chore: Modified tests to catch edge case errors (previously assertions)

* chore: Updated tutorials with Compilation Flags

* refactor: creating analysis submodule.

* docs: improve the API docs (#209)

* docs: Added the list of possible values for `ResourceType` and `PortDirection` on docstring

* docs: Added missing `Raises` sections in existing docstrings

* docs: Improved styling of function segments in docs for easy navigation

* docs: Added clickable reference links to parts of documentations in doc strings

* fix: Fixed the formatting and lint issues

* fix(docs): Fixed docs reference issues on`_compile.py`, `_evaluate.py` & `_routine.py`

* fix: Exposed `SymbolicBackend` through `bartiq.symbolics`

* fix: Exposed `Port` at top level (`bartiq.Port`)

* docs: Adding doc-string for `Port` class

* fix(docs): Added missing Args, and references in modified docs

* fix(docs): Added External references

* fix(docs): Fixed issues of long `Return` descriptions

* fix(docs): Reverting `symbolics` concept markdown content

* fix(docs): Improved styling of overload functions displayed in docs & removed type hints for `postorder_transform`

* fix(docs): Fixed a formatting issue in the module doc-string

* fix(docs): Removed `SymbolicBackend`  from exposing to top-level, and added submodule rendering and extra styling for documentation

* fix(docs): Removed unnecessary doc-strings in each `postorder_transform` overload function

* fix(docs): Extended `module` & `method` annotations in docs

* chore: resolving conflicts

* chore: free_symbols_in -> free_symbols

* chore: free_symbols_in -> free_symbols

* Resolving conflicts

* Improving assumptions handling

* began typing fixes

* Removed expression getter/setter. Updated typing

* Removed commented out code

* feat: added treemap visualisation class (#216)

* Added GSE prototype

* Trialling a decorator function

* Added warning if no update applied; added methods to isolate functions and their arguments

* Minor fix

* Removed userwarning due to bug

* Added catch for top level expression

* Added better support for parsing assumptions and redefining symbols

* Potential bugfix; Symbols now updated correctly

* Improved logic parsing

* bug fix

* Improved detection of nonzero Symbols

* Added warning if an expression does not change

* defaulting suppress_warnings to true; still experimental

* Updated check_expression_update to catch edge cases

* bug fix: when parsing known symbols with reference values!=0

* Undoing code removal

* Minor change for readaility

* more bug fixes

* More bug fixes

* Hopefully the last bug fix

* tbd

* tbd

* Updated imports after merge

* Minor improvements

* Added ability to evaluate gnarly

* Attempting to fix evaluation bug

* bug fix

* bug  found on substitute

* Removed unused import

* Added fix to allow substitute to refer to symbols rather than symbol names

* Removed unnecessary print statement

* Bandaid fix for minor bug

* Small fix

* fix: proper detection for zero arguments

* Upgraded grammar and text in alias-sampling

* Only minor changes to the third tutorial

* Typo fix.

* Added visualisations module; needs depth parameter.

* scratch notebook

* Pausing work; creating issue in bartiq.

* feat: visualisation improvement cleanup

* feat: visualisation improvement cleanup

* feat: create a method that can handle dataframe with redundant names

* test: test the new method

* chore: linting

* chore: include pandas and plotly in dependencies

* Update src/bartiq/visualisations.py

Co-authored-by: Dr Brendan Reid <53276074+Brendan-Reid1991@users.noreply.github.com>

* chore: file removal and renaming from review

* feat: added is_numeric method and visualization input validation check logic

* test: added compiled routine is_numeric tests and input validation for visualization

* chore: remove scale_to

* chore: delete changes to sympy backend

* chore: private function instead of classmethod

* chore: reset advanced example

* chore: validation checking invalid resource to plot

* chore: avoid duplication of strings when calling px.treemap

* test: output data frame is as expected

* test: test plot output type

* chore: adjust docstring and test function signatures

* chore: linting

* chore: linting

* chore: address review comments

* chore: address review comment

---------

Co-authored-by: brendan reid <brendan.reid1991@gmail.com>
Co-authored-by: Brendan Reid <breid@psiquantum.com>
Co-authored-by: Dr Brendan Reid <53276074+Brendan-Reid1991@users.noreply.github.com>

* chore: rename nlz to ntz (#225)

* chore: rename nlz to ntz

* chore: add deprecated class alias.

* fix: test and linter

* Removed reference to ._expr

* improved typing

* Modifying Basic -> Expr as generic type.

* Modified fixture

* improved typing

* Moved expand test to be sympy specific

* changed fixture scope from 'class' to 'function'

* renamed as_individual_terms - > individual_terms

* Renamed property; ran isort

* renamed as_individual_terms -> individual_terms

* typo fix

* Removed fixtures from tests and restructured them

* chore: update poetry.lock file for dependabot (#227)

* chore: update poetry.lock file for dependabot

* chore: update lock file

* chore: remove h11 as transient dependency

* chore: update poetry lock

* refactor: made pandas and plotly optional installs (#226)

* refactor: made pandas and plotly optional installs

* Added checks to ensure tests do not fail unexpectedly

* ran isort

* Added .venv to .gitignore

* Addition of pandas stubs changed behaviour of scipy stubs; quick fix

* renamed visualization->interactive

* updated extras flag

* renamed vis->viz

* chore: rename nlz to ntz (#225)

* chore: rename nlz to ntz

* chore: add deprecated class alias.

* fix: test and linter

* added plotly-stubs; may revert

* Removed type: ignore

* removed type: ignore; updated error message

* fixing plotly-stubs install

* Removed plotly-stubs entirely.

* added pytest.importorskip to module

* Added noqa to pass flake8

* Ran isort

* isort versioning mismatch

* Streamlined some aspects of the TreeMap class; removed unnecessary checks

* Removing unused imports

* fix: Fix typing in analysis module

---------

Co-authored-by: pqvr <work.vrpq@gmail.com>
Co-authored-by: Konrad Jałowiecki <dexter2206@gmail.com>

* updated substitute function to account for symbols with assumptions on them

* attempting to consolidate the typing

* Added sequence of commands as a test

* removing unused import

* Updating typing

* Implementing Konrads changes

* remove trailing whitespace

* added return statement

* reimplementing lost changes

* Implementing SympyAssumption

* made it so child classes of ExpressionRewriters do not need the decorator

* moved evaluation check into Assumptions _post_init_

* started assumptions tracking

* quick fix for custom max problem

* improved docstrings and added comments

* added reapply_all_assumptions

* formatting

* improving properties dict

* isort

* formatting

* began tests

* updated properties dict

* added tests

* formatting

* added comment on _add_assumption

* deleted test file

* fixing mypy issues

* fixing mypy issues

* fixing import for py3.10

* isort

* minor typo fix

* Added substitution methods

* implemented sympy substitutions,including wildcards

* modified substitute to allow arbitrary substitutions"

* improvements to wildcard subs

* fixed final bug in wildcard subs

* added hash to assumptions

* minor refactor

* added decorator to override custom max

* minor refactor after removing custom max

* began improving tests

* added classmethod to sympy_backend

* added classmethod to sympy_backend

* added tests for .with_sympy_max

* rename Relationals -> Comparators

* rename relationship->comparator

* minor typo fix

* re-adding assumptions after mistaken deletion

* changed from using float to literal_eval

* added more tests for assumptions

* minor fixes

* mypy fixes

* docstring updates;mypy fixes;wildcard improvements

* mypy fixes

* improved typehinting

* improved tracking of assumptions

* improved tracking of assumptions

* updating evaluate from main

* minor fixes

* gave _substitute default behaviour

* streamlined dataclass interactions

* deleting test file

* added_named_tuple

* bug fixes

* change from all caps to snake case

* minor refactor

* started testing substitutions

* moving some assumptions tests into basic tests

* updated focus + substitution logic

* added tests

* fixing docstring inconsistencies

* quick fixes from michals review

* Removed classmethod; moved logic to `parse_to_sympy`

* modified interpreter to override certain functions

* modified rewriter backend def

* removed test until we settle on impl

* bug fixes, test fixes

* deleted unwanted file

* mypy fix

* minor change

* refactor

* added function_overrides to sympyinterpreter

* updated sympybackend with new properties

* updated rewriter after changes to sympy backend

* modified backend after changes to interpreter

* removing unnecessary kwargs

* improved docstrings

* added tests for sympy_backend when using sympy max

* rename assume->assumption

* fix typing error

* test renaming

* refactored into dataclasses

* removing tests from downstream branch

* added instruction set

* renaming assumption->assume

* typo

* another typo

* renamed kwarg to assumption

* fixing typing & usability

* updated tests to pass

* fixing imports

* deleted erroneous line

* added tests for history tracking

* deleted duplicate fn

* removed revert_to in favour of undo_previous; renamed show_history; improved docstrings

* fixed implementation error in reapply_all_assumptions

* fixed implementation error in focus

* added original; hardcoded sympy backend to prevent reinstantiation

* modified history methods; updated tests

* reverting change to sympy_backend

---------

Co-authored-by: Avin Divakara <67309607+AVDiv@users.noreply.github.com>
Co-authored-by: antalszava <antalszava@gmail.com>
Co-authored-by: pqvr <work.vrpq@gmail.com>
Co-authored-by: Konrad Jałowiecki <dexter2206@gmail.com>
Brendan-Reid1991 added a commit that referenced this pull request Jul 10, 2025
* chore: Updated tutorials with Compilation Flags

* refactor: creating analysis submodule.

* feat: Began work on sympy manipulator

* feat: added instruction types enum; adding functionality to SM

* refactor: split base class + sympyManipulator into separate modules

* chore: removed generic types

* refactor: Moved InstructionsType enum

* feat: Added `focus` method. Generic types added

* refactor: Renamed SympyManipulation -> SympyManipulator

* fix: removed testing code

* refactor: renamed analysis.py -> optimization.py

* refactor: created analysis module

* feat: created rewriters module

* feat: added expressionwriter abc

* feat: subclassed from expressionwriter

* chore: improving typing

* feat: Added basic tests for rewriters

* chore: improved typing, added docstrings

* feat: improved typing; added docstrings

* chore: ran isort

* chore: fixed typing issues

* chore: added module level docstrings

* chore: removed unused import

* chore: erroneous line introduced

* chore: added module level docstring

* chore: improved typing in update_expression

* chore: added module level docstring; removed return section of docstring and improved descriptions

* chore: Type -> type

* chore: made expression_rewriter.py public

* refactor: renamed variables -> free_symbols

* refactor: improved docstrings

* chore: correcting imports

* refactor: renamed test_variables, and improved it such that it will work for all backends

* chore: added copyright message

* refactor: renamed free_symbols_in -> free_symbols

* chore: updated docstrings

* chore: isort fix

* docs: improve the API docs (#209)

* docs: Added the list of possible values for `ResourceType` and `PortDirection` on docstring

* docs: Added missing `Raises` sections in existing docstrings

* docs: Improved styling of function segments in docs for easy navigation

* docs: Added clickable reference links to parts of documentations in doc strings

* fix: Fixed the formatting and lint issues

* fix(docs): Fixed docs reference issues on`_compile.py`, `_evaluate.py` & `_routine.py`

* fix: Exposed `SymbolicBackend` through `bartiq.symbolics`

* fix: Exposed `Port` at top level (`bartiq.Port`)

* docs: Adding doc-string for `Port` class

* fix(docs): Added missing Args, and references in modified docs

* fix(docs): Added External references

* fix(docs): Fixed issues of long `Return` descriptions

* fix(docs): Reverting `symbolics` concept markdown content

* fix(docs): Improved styling of overload functions displayed in docs & removed type hints for `postorder_transform`

* fix(docs): Fixed a formatting issue in the module doc-string

* fix(docs): Removed `SymbolicBackend`  from exposing to top-level, and added submodule rendering and extra styling for documentation

* fix(docs): Removed unnecessary doc-strings in each `postorder_transform` overload function

* fix(docs): Extended `module` & `method` annotations in docs

* feat: began development on assumptions

* chore: Added a comment about allow_transitive_resources to tutorial #1

* chore: added allow_transitive_resources=False; added quotes to Note about interactive tools

* chore: updated tutorial 3

* chore: Added sentences about transitive compilation of resources

* refactor: Created `CompilationFlags` enum

* refactor: Replaced asserts with Exceptions; added fix for repetitions + transitive resources

* chore: Updated docstrings

* chore: updating tests for CompilationFlags

* chore: Modified tests to catch edge case errors (previously assertions)

* chore: Updated tutorials with Compilation Flags

* refactor: creating analysis submodule.

* docs: improve the API docs (#209)

* docs: Added the list of possible values for `ResourceType` and `PortDirection` on docstring

* docs: Added missing `Raises` sections in existing docstrings

* docs: Improved styling of function segments in docs for easy navigation

* docs: Added clickable reference links to parts of documentations in doc strings

* fix: Fixed the formatting and lint issues

* fix(docs): Fixed docs reference issues on`_compile.py`, `_evaluate.py` & `_routine.py`

* fix: Exposed `SymbolicBackend` through `bartiq.symbolics`

* fix: Exposed `Port` at top level (`bartiq.Port`)

* docs: Adding doc-string for `Port` class

* fix(docs): Added missing Args, and references in modified docs

* fix(docs): Added External references

* fix(docs): Fixed issues of long `Return` descriptions

* fix(docs): Reverting `symbolics` concept markdown content

* fix(docs): Improved styling of overload functions displayed in docs & removed type hints for `postorder_transform`

* fix(docs): Fixed a formatting issue in the module doc-string

* fix(docs): Removed `SymbolicBackend`  from exposing to top-level, and added submodule rendering and extra styling for documentation

* fix(docs): Removed unnecessary doc-strings in each `postorder_transform` overload function

* fix(docs): Extended `module` & `method` annotations in docs

* chore: resolving conflicts

* chore: free_symbols_in -> free_symbols

* chore: free_symbols_in -> free_symbols

* Resolving conflicts

* Improving assumptions handling

* began typing fixes

* Removed expression getter/setter. Updated typing

* Removed commented out code

* feat: added treemap visualisation class (#216)

* Added GSE prototype

* Trialling a decorator function

* Added warning if no update applied; added methods to isolate functions and their arguments

* Minor fix

* Removed userwarning due to bug

* Added catch for top level expression

* Added better support for parsing assumptions and redefining symbols

* Potential bugfix; Symbols now updated correctly

* Improved logic parsing

* bug fix

* Improved detection of nonzero Symbols

* Added warning if an expression does not change

* defaulting suppress_warnings to true; still experimental

* Updated check_expression_update to catch edge cases

* bug fix: when parsing known symbols with reference values!=0

* Undoing code removal

* Minor change for readaility

* more bug fixes

* More bug fixes

* Hopefully the last bug fix

* tbd

* tbd

* Updated imports after merge

* Minor improvements

* Added ability to evaluate gnarly

* Attempting to fix evaluation bug

* bug fix

* bug  found on substitute

* Removed unused import

* Added fix to allow substitute to refer to symbols rather than symbol names

* Removed unnecessary print statement

* Bandaid fix for minor bug

* Small fix

* fix: proper detection for zero arguments

* Upgraded grammar and text in alias-sampling

* Only minor changes to the third tutorial

* Typo fix.

* Added visualisations module; needs depth parameter.

* scratch notebook

* Pausing work; creating issue in bartiq.

* feat: visualisation improvement cleanup

* feat: visualisation improvement cleanup

* feat: create a method that can handle dataframe with redundant names

* test: test the new method

* chore: linting

* chore: include pandas and plotly in dependencies

* Update src/bartiq/visualisations.py

Co-authored-by: Dr Brendan Reid <53276074+Brendan-Reid1991@users.noreply.github.com>

* chore: file removal and renaming from review

* feat: added is_numeric method and visualization input validation check logic

* test: added compiled routine is_numeric tests and input validation for visualization

* chore: remove scale_to

* chore: delete changes to sympy backend

* chore: private function instead of classmethod

* chore: reset advanced example

* chore: validation checking invalid resource to plot

* chore: avoid duplication of strings when calling px.treemap

* test: output data frame is as expected

* test: test plot output type

* chore: adjust docstring and test function signatures

* chore: linting

* chore: linting

* chore: address review comments

* chore: address review comment

---------

Co-authored-by: brendan reid <brendan.reid1991@gmail.com>
Co-authored-by: Brendan Reid <breid@psiquantum.com>
Co-authored-by: Dr Brendan Reid <53276074+Brendan-Reid1991@users.noreply.github.com>

* chore: rename nlz to ntz (#225)

* chore: rename nlz to ntz

* chore: add deprecated class alias.

* fix: test and linter

* Removed reference to ._expr

* improved typing

* Modifying Basic -> Expr as generic type.

* Modified fixture

* improved typing

* Moved expand test to be sympy specific

* changed fixture scope from 'class' to 'function'

* renamed as_individual_terms - > individual_terms

* Renamed property; ran isort

* renamed as_individual_terms -> individual_terms

* typo fix

* Removed fixtures from tests and restructured them

* chore: update poetry.lock file for dependabot (#227)

* chore: update poetry.lock file for dependabot

* chore: update lock file

* chore: remove h11 as transient dependency

* chore: update poetry lock

* refactor: made pandas and plotly optional installs (#226)

* refactor: made pandas and plotly optional installs

* Added checks to ensure tests do not fail unexpectedly

* ran isort

* Added .venv to .gitignore

* Addition of pandas stubs changed behaviour of scipy stubs; quick fix

* renamed visualization->interactive

* updated extras flag

* renamed vis->viz

* chore: rename nlz to ntz (#225)

* chore: rename nlz to ntz

* chore: add deprecated class alias.

* fix: test and linter

* added plotly-stubs; may revert

* Removed type: ignore

* removed type: ignore; updated error message

* fixing plotly-stubs install

* Removed plotly-stubs entirely.

* added pytest.importorskip to module

* Added noqa to pass flake8

* Ran isort

* isort versioning mismatch

* Streamlined some aspects of the TreeMap class; removed unnecessary checks

* Removing unused imports

* fix: Fix typing in analysis module

---------

Co-authored-by: pqvr <work.vrpq@gmail.com>
Co-authored-by: Konrad Jałowiecki <dexter2206@gmail.com>

* updated substitute function to account for symbols with assumptions on them

* attempting to consolidate the typing

* Added sequence of commands as a test

* removing unused import

* Updating typing

* Implementing Konrads changes

* remove trailing whitespace

* added return statement

* reimplementing lost changes

* Implementing SympyAssumption

* made it so child classes of ExpressionRewriters do not need the decorator

* moved evaluation check into Assumptions _post_init_

* started assumptions tracking

* quick fix for custom max problem

* improved docstrings and added comments

* added reapply_all_assumptions

* formatting

* improving properties dict

* isort

* formatting

* began tests

* updated properties dict

* added tests

* formatting

* added comment on _add_assumption

* deleted test file

* fixing mypy issues

* fixing mypy issues

* fixing import for py3.10

* isort

* minor typo fix

* Added substitution methods

* implemented sympy substitutions,including wildcards

* modified substitute to allow arbitrary substitutions"

* improvements to wildcard subs

* fixed final bug in wildcard subs

* added hash to assumptions

* minor refactor

* added decorator to override custom max

* minor refactor after removing custom max

* began improving tests

* added classmethod to sympy_backend

* added classmethod to sympy_backend

* added tests for .with_sympy_max

* rename Relationals -> Comparators

* rename relationship->comparator

* minor typo fix

* re-adding assumptions after mistaken deletion

* changed from using float to literal_eval

* added more tests for assumptions

* minor fixes

* mypy fixes

* docstring updates;mypy fixes;wildcard improvements

* mypy fixes

* improved typehinting

* improved tracking of assumptions

* improved tracking of assumptions

* updating evaluate from main

* minor fixes

* gave _substitute default behaviour

* streamlined dataclass interactions

* deleting test file

* added_named_tuple

* bug fixes

* change from all caps to snake case

* minor refactor

* started testing substitutions

* moving some assumptions tests into basic tests

* updated focus + substitution logic

* added tests

* fixing docstring inconsistencies

* quick fixes from michals review

* Removed classmethod; moved logic to `parse_to_sympy`

* modified interpreter to override certain functions

* modified rewriter backend def

* removed test until we settle on impl

* bug fixes, test fixes

* deleted unwanted file

* mypy fix

* minor change

* refactor

* added function_overrides to sympyinterpreter

* updated sympybackend with new properties

* updated rewriter after changes to sympy backend

* modified backend after changes to interpreter

* removing unnecessary kwargs

* improved docstrings

* added tests for sympy_backend when using sympy max

* rename assume->assumption

* fix typing error

* test renaming

* typing fixes

* refactored into dataclasses

* removing tests from downstream branch

* added instruction set

* renaming assumption->assume

* typo

* another typo

* renamed kwarg to assumption

* fixing typing & usability

* updated tests to pass

* fixing imports

* deleted erroneous line

* added tests for history tracking

* fixing mypy issues

* refactored instructions

* refactored assumptions as child of dummy class

* modified tests after refactor

* made rewriters public

* made rewriters public

* deleting files

* exposed rewriter factory

* modified how substitutions are added

* minor refactor on substitutions; added factory  method

* improved logic on linked parameters

* updated tests after refactor

* added new ignore code to flake8

* remove unnecessary guards

* improving docstrings

* improving tests

* tighting typing

* added tests for linked parameters in focus

* added per-file ignore code for lambdas

* made wild chars stored in tuples rather than list

* removed None type from original_expression

* removed noqa

* simplified logic after Konrads comments

* minor typing typo (typ-o)

* fixing typos in docstring

* updating docstrings

* minor factor on substitutions

* updating tests

* fixing attr error

* fixing tests

* removed testig code

* updated assumption properties derivation; improved docstrings

* updated tests

* missing word in docstring

---------

Co-authored-by: Avin Divakara <67309607+AVDiv@users.noreply.github.com>
Co-authored-by: antalszava <antalszava@gmail.com>
Co-authored-by: pqvr <work.vrpq@gmail.com>
Co-authored-by: Konrad Jałowiecki <dexter2206@gmail.com>
Brendan-Reid1991 added a commit that referenced this pull request Jul 14, 2025
…ines (#239)

* chore: added module level docstrings

* chore: removed unused import

* chore: erroneous line introduced

* chore: added module level docstring

* chore: improved typing in update_expression

* chore: added module level docstring; removed return section of docstring and improved descriptions

* chore: Type -> type

* chore: made expression_rewriter.py public

* refactor: renamed variables -> free_symbols

* refactor: improved docstrings

* chore: correcting imports

* refactor: renamed test_variables, and improved it such that it will work for all backends

* chore: added copyright message

* refactor: renamed free_symbols_in -> free_symbols

* chore: updated docstrings

* chore: isort fix

* docs: improve the API docs (#209)

* docs: Added the list of possible values for `ResourceType` and `PortDirection` on docstring

* docs: Added missing `Raises` sections in existing docstrings

* docs: Improved styling of function segments in docs for easy navigation

* docs: Added clickable reference links to parts of documentations in doc strings

* fix: Fixed the formatting and lint issues

* fix(docs): Fixed docs reference issues on`_compile.py`, `_evaluate.py` & `_routine.py`

* fix: Exposed `SymbolicBackend` through `bartiq.symbolics`

* fix: Exposed `Port` at top level (`bartiq.Port`)

* docs: Adding doc-string for `Port` class

* fix(docs): Added missing Args, and references in modified docs

* fix(docs): Added External references

* fix(docs): Fixed issues of long `Return` descriptions

* fix(docs): Reverting `symbolics` concept markdown content

* fix(docs): Improved styling of overload functions displayed in docs & removed type hints for `postorder_transform`

* fix(docs): Fixed a formatting issue in the module doc-string

* fix(docs): Removed `SymbolicBackend`  from exposing to top-level, and added submodule rendering and extra styling for documentation

* fix(docs): Removed unnecessary doc-strings in each `postorder_transform` overload function

* fix(docs): Extended `module` & `method` annotations in docs

* feat: began development on assumptions

* chore: Added a comment about allow_transitive_resources to tutorial #1

* chore: added allow_transitive_resources=False; added quotes to Note about interactive tools

* chore: updated tutorial 3

* chore: Added sentences about transitive compilation of resources

* refactor: Created `CompilationFlags` enum

* refactor: Replaced asserts with Exceptions; added fix for repetitions + transitive resources

* chore: Updated docstrings

* chore: updating tests for CompilationFlags

* chore: Modified tests to catch edge case errors (previously assertions)

* chore: Updated tutorials with Compilation Flags

* refactor: creating analysis submodule.

* docs: improve the API docs (#209)

* docs: Added the list of possible values for `ResourceType` and `PortDirection` on docstring

* docs: Added missing `Raises` sections in existing docstrings

* docs: Improved styling of function segments in docs for easy navigation

* docs: Added clickable reference links to parts of documentations in doc strings

* fix: Fixed the formatting and lint issues

* fix(docs): Fixed docs reference issues on`_compile.py`, `_evaluate.py` & `_routine.py`

* fix: Exposed `SymbolicBackend` through `bartiq.symbolics`

* fix: Exposed `Port` at top level (`bartiq.Port`)

* docs: Adding doc-string for `Port` class

* fix(docs): Added missing Args, and references in modified docs

* fix(docs): Added External references

* fix(docs): Fixed issues of long `Return` descriptions

* fix(docs): Reverting `symbolics` concept markdown content

* fix(docs): Improved styling of overload functions displayed in docs & removed type hints for `postorder_transform`

* fix(docs): Fixed a formatting issue in the module doc-string

* fix(docs): Removed `SymbolicBackend`  from exposing to top-level, and added submodule rendering and extra styling for documentation

* fix(docs): Removed unnecessary doc-strings in each `postorder_transform` overload function

* fix(docs): Extended `module` & `method` annotations in docs

* chore: resolving conflicts

* chore: free_symbols_in -> free_symbols

* chore: free_symbols_in -> free_symbols

* Resolving conflicts

* Improving assumptions handling

* began typing fixes

* Removed expression getter/setter. Updated typing

* Removed commented out code

* feat: added treemap visualisation class (#216)

* Added GSE prototype

* Trialling a decorator function

* Added warning if no update applied; added methods to isolate functions and their arguments

* Minor fix

* Removed userwarning due to bug

* Added catch for top level expression

* Added better support for parsing assumptions and redefining symbols

* Potential bugfix; Symbols now updated correctly

* Improved logic parsing

* bug fix

* Improved detection of nonzero Symbols

* Added warning if an expression does not change

* defaulting suppress_warnings to true; still experimental

* Updated check_expression_update to catch edge cases

* bug fix: when parsing known symbols with reference values!=0

* Undoing code removal

* Minor change for readaility

* more bug fixes

* More bug fixes

* Hopefully the last bug fix

* tbd

* tbd

* Updated imports after merge

* Minor improvements

* Added ability to evaluate gnarly

* Attempting to fix evaluation bug

* bug fix

* bug  found on substitute

* Removed unused import

* Added fix to allow substitute to refer to symbols rather than symbol names

* Removed unnecessary print statement

* Bandaid fix for minor bug

* Small fix

* fix: proper detection for zero arguments

* Upgraded grammar and text in alias-sampling

* Only minor changes to the third tutorial

* Typo fix.

* Added visualisations module; needs depth parameter.

* scratch notebook

* Pausing work; creating issue in bartiq.

* feat: visualisation improvement cleanup

* feat: visualisation improvement cleanup

* feat: create a method that can handle dataframe with redundant names

* test: test the new method

* chore: linting

* chore: include pandas and plotly in dependencies

* Update src/bartiq/visualisations.py

Co-authored-by: Dr Brendan Reid <53276074+Brendan-Reid1991@users.noreply.github.com>

* chore: file removal and renaming from review

* feat: added is_numeric method and visualization input validation check logic

* test: added compiled routine is_numeric tests and input validation for visualization

* chore: remove scale_to

* chore: delete changes to sympy backend

* chore: private function instead of classmethod

* chore: reset advanced example

* chore: validation checking invalid resource to plot

* chore: avoid duplication of strings when calling px.treemap

* test: output data frame is as expected

* test: test plot output type

* chore: adjust docstring and test function signatures

* chore: linting

* chore: linting

* chore: address review comments

* chore: address review comment

---------

Co-authored-by: brendan reid <brendan.reid1991@gmail.com>
Co-authored-by: Brendan Reid <breid@psiquantum.com>
Co-authored-by: Dr Brendan Reid <53276074+Brendan-Reid1991@users.noreply.github.com>

* chore: rename nlz to ntz (#225)

* chore: rename nlz to ntz

* chore: add deprecated class alias.

* fix: test and linter

* Removed reference to ._expr

* improved typing

* Modifying Basic -> Expr as generic type.

* Modified fixture

* improved typing

* Moved expand test to be sympy specific

* changed fixture scope from 'class' to 'function'

* renamed as_individual_terms - > individual_terms

* Renamed property; ran isort

* renamed as_individual_terms -> individual_terms

* typo fix

* Removed fixtures from tests and restructured them

* chore: update poetry.lock file for dependabot (#227)

* chore: update poetry.lock file for dependabot

* chore: update lock file

* chore: remove h11 as transient dependency

* chore: update poetry lock

* refactor: made pandas and plotly optional installs (#226)

* refactor: made pandas and plotly optional installs

* Added checks to ensure tests do not fail unexpectedly

* ran isort

* Added .venv to .gitignore

* Addition of pandas stubs changed behaviour of scipy stubs; quick fix

* renamed visualization->interactive

* updated extras flag

* renamed vis->viz

* chore: rename nlz to ntz (#225)

* chore: rename nlz to ntz

* chore: add deprecated class alias.

* fix: test and linter

* added plotly-stubs; may revert

* Removed type: ignore

* removed type: ignore; updated error message

* fixing plotly-stubs install

* Removed plotly-stubs entirely.

* added pytest.importorskip to module

* Added noqa to pass flake8

* Ran isort

* isort versioning mismatch

* Streamlined some aspects of the TreeMap class; removed unnecessary checks

* Removing unused imports

* fix: Fix typing in analysis module

---------

Co-authored-by: pqvr <work.vrpq@gmail.com>
Co-authored-by: Konrad Jałowiecki <dexter2206@gmail.com>

* updated substitute function to account for symbols with assumptions on them

* attempting to consolidate the typing

* Added sequence of commands as a test

* removing unused import

* Updating typing

* Implementing Konrads changes

* remove trailing whitespace

* added return statement

* reimplementing lost changes

* Implementing SympyAssumption

* made it so child classes of ExpressionRewriters do not need the decorator

* moved evaluation check into Assumptions _post_init_

* started assumptions tracking

* quick fix for custom max problem

* improved docstrings and added comments

* added reapply_all_assumptions

* formatting

* improving properties dict

* isort

* formatting

* began tests

* updated properties dict

* added tests

* formatting

* added comment on _add_assumption

* deleted test file

* fixing mypy issues

* fixing mypy issues

* fixing import for py3.10

* isort

* minor typo fix

* Added substitution methods

* implemented sympy substitutions,including wildcards

* modified substitute to allow arbitrary substitutions"

* improvements to wildcard subs

* fixed final bug in wildcard subs

* added hash to assumptions

* minor refactor

* added decorator to override custom max

* minor refactor after removing custom max

* began improving tests

* added classmethod to sympy_backend

* added classmethod to sympy_backend

* added tests for .with_sympy_max

* rename Relationals -> Comparators

* rename relationship->comparator

* minor typo fix

* re-adding assumptions after mistaken deletion

* changed from using float to literal_eval

* added more tests for assumptions

* minor fixes

* mypy fixes

* docstring updates;mypy fixes;wildcard improvements

* mypy fixes

* improved typehinting

* improved tracking of assumptions

* improved tracking of assumptions

* updating evaluate from main

* minor fixes

* gave _substitute default behaviour

* streamlined dataclass interactions

* deleting test file

* added_named_tuple

* bug fixes

* change from all caps to snake case

* minor refactor

* started testing substitutions

* moving some assumptions tests into basic tests

* updated focus + substitution logic

* added tests

* fixing docstring inconsistencies

* quick fixes from michals review

* Removed classmethod; moved logic to `parse_to_sympy`

* modified interpreter to override certain functions

* modified rewriter backend def

* removed test until we settle on impl

* bug fixes, test fixes

* deleted unwanted file

* mypy fix

* minor change

* refactor

* added function_overrides to sympyinterpreter

* updated sympybackend with new properties

* updated rewriter after changes to sympy backend

* modified backend after changes to interpreter

* removing unnecessary kwargs

* improved docstrings

* added tests for sympy_backend when using sympy max

* rename assume->assumption

* fix typing error

* test renaming

* typing fixes

* refactored into dataclasses

* removing tests from downstream branch

* added instruction set

* renaming assumption->assume

* typo

* another typo

* renamed kwarg to assumption

* fixing typing & usability

* updated tests to pass

* fixing imports

* deleted erroneous line

* added tests for history tracking

* fixing mypy issues

* refactored instructions

* refactored assumptions as child of dummy class

* modified tests after refactor

* made rewriters public

* made rewriters public

* deleting files

* exposed rewriter factory

* modified how substitutions are added

* minor refactor on substitutions; added factory  method

* improved logic on linked parameters

* updated tests after refactor

* added new ignore code to flake8

* remove unnecessary guards

* improving docstrings

* improving tests

* tighting typing

* added tests for linked parameters in focus

* added per-file ignore code for lambdas

* made wild chars stored in tuples rather than list

* removed None type from original_expression

* removed noqa

* simplified logic after Konrads comments

* minor typing typo (typ-o)

* fixing typos in docstring

* removed rewriter suffix from filename

* added rewriter instance for routines

* tightend up symbol retrieval logic

* improved docstrings

* fixing imports

* fixing imports

* clarified docstring

* removed guard on sympy type

* removed guard

* renamed routine.py > resources.py

* tidied docstring

* added tests

* added guard

* removed Generic parent class from ResourceRewriter

* fixing mypy

* updating docstrings

* minor factor on substitutions

* updating tests

* fixing attr error

* fixing tests

* once more

* previous commit was made in err

* removed testig code

* michals comments

* updated assumption properties derivation; improved docstrings

* updated tests

* updated apply_to_whole_routine and tests

---------

Co-authored-by: Avin Divakara <67309607+AVDiv@users.noreply.github.com>
Co-authored-by: antalszava <antalszava@gmail.com>
Co-authored-by: pqvr <work.vrpq@gmail.com>
Co-authored-by: Konrad Jałowiecki <dexter2206@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants