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 docstrings #40

Merged
merged 1 commit into from
Sep 8, 2020
Merged

Add docstrings #40

merged 1 commit into from
Sep 8, 2020

Conversation

tlambert03
Copy link
Owner

this pulls annotations from the schema and renders them as numpy-style docstrings. for instance:

@ome_dataclass
class Objective(ManufacturerSpec):
    """A description of the microscope's objective lens.

    Required elements include the lens numerical aperture, and the
    magnification, both of which a floating point (real) numbers. The values
    are those that are fixed for a particular objective: either because it
    has been manufactured to this specification or the value has been
    measured on this particular objective. Correction: This is the type of
    correction coating applied to this lens. Immersion: This is the types of
    immersion medium the lens is designed to work with. It is not the same as
    'Medium' in ObjectiveRef (a single type) as here Immersion can have
    compound values like 'Multi'. LensNA: The numerical aperture of the lens
    (as a float) NominalMagnification: The specified magnification e.g. x10
    CalibratedMagnification: The measured magnification e.g. x10.3
    WorkingDistance: WorkingDistance of the lens.

    Parameters
    ----------
    annotation_ref : AnnotationRef, optional
    calibrated_magnification : float, optional
        The magnification of the lens as measured by a calibration process-
        i.e. '59.987' for a 60X lens.
    correction : Correction, optional
        The correction applied to the lens
    id : ObjectiveID
    immersion : Immersion, optional
        The immersion medium the lens is designed for
    iris : bool, optional
        Records whether or not the objective was fitted with an Iris.
    lens_na : float, optional
        The numerical aperture of the lens expressed as a floating point
        (real) number. Expected range 0.02 - 1.5
    lot_number : str, optional
        The lot number of the component.
    manufacturer : str, optional
        The manufacturer of the component.
    model : str, optional
        The Model of the component.
    nominal_magnification : float, optional
        The magnification of the lens as specified by the manufacturer - i.e.
        '60' is a 60X lens. Note: The type of this has been changed from int
        to float to allow the specification of additional lenses e.g. 0.5X
        lens
    serial_number : str, optional
        The serial number of the component.
    working_distance : float, optional
        The working distance of the lens expressed as a floating point (real)
        number. Units are set by WorkingDistanceUnit.
    working_distance_unit : UnitsLength, optional
        The units of the working distance - default:microns.
    """

    annotation_ref: List[AnnotationRef] = field(default_factory=list)
    calibrated_magnification: Optional[float] = None
    correction: Optional[Correction] = None
    id: ObjectiveID = AUTO_SEQUENCE  # type: ignore
    immersion: Optional[Immersion] = None
    iris: Optional[bool] = None
    lens_na: Optional[float] = None
    nominal_magnification: Optional[float] = None
    working_distance: Optional[float] = None
    working_distance_unit: Optional[UnitsLength] = UnitsLength("µm")

@codecov-commenter
Copy link

Codecov Report

Merging #40 into master will increase coverage by 0.27%.
The diff coverage is 98.08%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #40      +/-   ##
==========================================
+ Coverage   95.20%   95.48%   +0.27%     
==========================================
  Files           1        1              
  Lines         396      509     +113     
==========================================
+ Hits          377      486     +109     
- Misses         19       23       +4     
Impacted Files Coverage Δ
src/ome_autogen.py 95.48% <98.08%> (+0.27%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 90c1e3c...94f0c39. Read the comment docs.

Copy link
Collaborator

@jmuhlich jmuhlich left a comment

Choose a reason for hiding this comment

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

🤯

@tlambert03 tlambert03 merged commit 44e2d01 into master Sep 8, 2020
@tlambert03 tlambert03 deleted the add-docs branch September 8, 2020 17:17
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.

3 participants