Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add default fractions to graphical_component_analysis #103

Merged

Conversation

bruno-pannunzio
Copy link
Contributor

Description

This PR proposes the addition of default values for fractions in the graphical_component_analysis function in the components module. This was further discussed in #83, where the reasons for the proposed changes are stated.

Release note

Summarize the changes in the code block below to be included in the
release notes:

Checklist

  • The pull request title, summary, and description are concise.
  • Related issues are linked in the description.
  • New dependencies are explained.
  • The source code and documentation can be distributed under the MIT license.
  • The source code adheres to code standards.
  • New classes, functions, and features are thoroughly tested.
  • New, user-facing classes, functions, and features are documented.
  • New features are covered in tutorials.
  • No files other than source code, documentation, and project settings are added to the repository.

@bruno-pannunzio bruno-pannunzio added the enhancement New feature or request label Aug 21, 2024
@bruno-pannunzio bruno-pannunzio self-assigned this Aug 21, 2024
Copy link
Member

@cgohlke cgohlke left a comment

Choose a reason for hiding this comment

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

The description of the fractions parameter need to be updated:

    fractions: array_like or int, optional
        Number of equidistant fractions, or 1D array of fraction values.
        Fraction values must be in range [0.0, 1.0].
        If an integer, ``numpy.linspace(0.0, 1.0, fractions)`` fraction values
        are used.
        If None (default), the number of fractions is determined from the
        longest distance between any pair of components and the radius of
        the cursor (see Notes below).

Comment on lines 186 to 196
If no `fractions` are provided, the number of fractions (N) used is
determined by the longest distance between any pair of components (D)
and by the radius of the cursor (R):

.. math::
N = \frac{2*D}{R} + 1

The fractions can be retrieved by:

``fractions = numpy.linspace(0.0, 1.0, len(counts[0]))``

Copy link
Member

Choose a reason for hiding this comment

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

    If no `fractions` are provided, the number of fractions (:math:`N`) used
    is determined from the longest distance between any pair of components
    (:math:`D`) and the radius of the cursor (:math:`R`):

    .. math::

        N = \frac{2 \cdot D}{R} + 1

    The fractions can be retrieved by:

    .. code-block:: python

        fractions = numpy.linspace(0.0, 1.0, len(counts[0]))

)
longest_distance = max(longest_distance, length)
fractions = numpy.linspace(
0.0, 1.0, int(longest_distance / (radius / 2) + 1)
Copy link
Member

Choose a reason for hiding this comment

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

int(round(...))?

…ns` default calculation and description. Round number of default fractions calculation.
@bruno-pannunzio bruno-pannunzio merged commit 46d7fa1 into phasorpy:main Aug 22, 2024
14 checks passed
@bruno-pannunzio bruno-pannunzio deleted the fractions-graphical-component branch August 22, 2024 18:35
schutyb pushed a commit to schutyb/phasorpy that referenced this pull request Aug 30, 2024
schutyb pushed a commit to schutyb/phasorpy that referenced this pull request Aug 30, 2024
schutyb pushed a commit to schutyb/phasorpy that referenced this pull request Aug 30, 2024
schutyb pushed a commit to schutyb/phasorpy that referenced this pull request Aug 30, 2024
schutyb pushed a commit to schutyb/phasorpy that referenced this pull request Aug 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants