More Marshmallow argument updates

This commit is contained in:
Richard Bowman 2022-08-09 13:16:10 +01:00
parent e22f36b308
commit 9dbb083ee7
18 changed files with 102 additions and 87 deletions

View file

@ -349,8 +349,10 @@ class AutofocusExtension(BaseExtension):
args={
"dz": fields.List(
fields.Int(),
metadata={"description": "An ascending list of relative z positions"},
example=[int(x) for x in np.linspace(-300, 300, 7)],
metadata={
"description": "An ascending list of relative z positions",
"example": [int(x) for x in np.linspace(-300, 300, 7)],
}
)
}
)
@ -433,8 +435,10 @@ class AutofocusExtension(BaseExtension):
args={
"dz": fields.Int(
load_default=2000,
example=2000,
metadata={"description": "Total Z range to search over (in stage steps)"},
metadata={
"description": "Total Z range to search over (in stage steps)",
"example": 2000,
},
)
}
)
@ -529,13 +533,17 @@ class AutofocusExtension(BaseExtension):
args={
"dz": fields.Int(
load_default=500,
example=500,
metadata={"description": "Total Z range to move down, then up (in stage steps)"},
metadata={
"description": "Total Z range to move down, then up (in stage steps)",
"example": 500,
},
),
"delay": fields.Int(
load_default=5,
example=5,
metadata={"description": "How long to measure sharpness for after the move"},
metadata={
"description": "How long to measure sharpness for after the move",
"example": 5,
},
),
}
)
@ -557,13 +565,17 @@ class AutofocusExtension(BaseExtension):
args={
"dz": fields.Int(
load_default=2000,
example=2000,
metadata={"description": "Total Z range to search over (in stage steps)"},
metadata={
"description": "Total Z range to search over (in stage steps)",
"example": 2000,
},
),
"target_z": fields.Int(
load_default=0,
example=-100,
metadata={"description": "Target finishing position, relative to the focus."},
metadata={
"description": "Target finishing position, relative to the focus.",
"example": -100,
},
),
"initial_move_up": fields.Bool(
load_default=True,
@ -571,8 +583,10 @@ class AutofocusExtension(BaseExtension):
),
"backlash": fields.Int(
load_default=25,
minimum=0,
metadata={"description": "Distance to undershoot, before correction move."},
metadata={
"description": "Distance to undershoot, before correction move.",
"minimum": 0,
},
),
}
)

View file

@ -242,7 +242,7 @@ class GetLocationsView(PropertyView):
class PreferredLocationView(PropertyView):
schema = fields.String(required=True, example="Default")
schema = fields.String(required=True, metadata={"example": "Default"})
def get(self):
self.extension.check_location()

View file

@ -279,7 +279,7 @@ class CSMExtension(BaseExtension):
class Calibrate1DView(ActionView):
args = {"direction": fields.List(fields.Float(), required=True, example=[1, 0, 0])}
args = {"direction": fields.List(fields.Float(), required=True, metadata={"example": [1, 0, 0]})}
def post(self, args):
"""Calibrate one axis of the microscope stage against the camera."""
@ -298,10 +298,10 @@ class CalibrateXYView(ActionView):
class MoveInImageCoordinatesView(ActionView):
args = {
"x": fields.Float(
metadata={"description": "The number of pixels to move in X"}, required=True, example=100
metadata={"description": "The number of pixels to move in X", "example": 100,}, required=True,
),
"y": fields.Float(
metadata={"description": "The number of pixels to move in Y"}, required=True, example=100
metadata={"description": "The number of pixels to move in Y", "example": 100,}, required=True,
),
}
@ -316,10 +316,10 @@ class MoveInImageCoordinatesView(ActionView):
class ClosedLoopMoveInImageCoordinatesView(ActionView):
args = {
"x": fields.Float(
metadata={"description": "The number of pixels to move in X"}, required=True, example=100
metadata={"description": "The number of pixels to move in X", "example": 100,}, required=True,
),
"y": fields.Float(
metadata={"description": "The number of pixels to move in Y"}, required=True, example=100
metadata={"description": "The number of pixels to move in Y", "example": 100,}, required=True,
),
}
@ -336,15 +336,14 @@ class ClosedLoopMoveInImageCoordinatesView(ActionView):
class TestClosedLoopSpiralScanView(ActionView):
args = {
"x_step": fields.Float(
metadata={"description": "The number of pixels to move in X"}, required=True, example=100
metadata={"description": "The number of pixels to move in X", "example": 100,}, required=True,
),
"y_step": fields.Float(
metadata={"description": "The number of pixels to move in Y"}, required=True, example=100
metadata={"description": "The number of pixels to move in Y", "example": 100,}, required=True,
),
"N": fields.Int(
metadata={"description": "The number of rings in the spiral scan"},
metadata={"description": "The number of rings in the spiral scan", "example": 100,},
required=True,
example=3,
),
}

View file

@ -169,39 +169,49 @@ class DeleteLSTView(ActionView):
microscope.save_settings()
percentile_field = fields.Float(
load_default=99.9,
metadata={
"example": 99.9,
"description": (
"A float between 0 and 100 setting the centile to use "
"to measure the white point of the image. A value "
"of 99.9 allows 0.1% of the pixels to be erroneously "
"bright - this helps stability in low light."
),
},
)
class AutoExposureFromRawView(ActionView):
args = {
"target_white_level": fields.Int(
load_default=700,
example=700,
description=(
"The pixel value (10-bit format) that we aim for when adjusting shutter/gain."
),
metadata={
"example": 700,
"description": (
"The pixel value (10-bit format) that we aim for when adjusting shutter/gain."
),
},
),
"max_iterations": fields.Int(
load_default=20,
description=(
"The number of adjustments to the camera's settings to make before giving up."
),
load_default=20,metadata={
"description": (
"The number of adjustments to the camera's settings to make before giving up."
),
},
),
"tolerance": fields.Float(
load_default=0.05,
example=0.05,
description=(
"We stop adjusting when we get within this fraction of the target "
"value. It is a number between 0 and 1, usually 0.01--0.1."
),
),
"percentile": fields.Float(
load_default=99.9,
example=99.9,
description=(
"A float between 0 and 100 setting the centile to use "
"to measure the white point of the image. A value "
"of 99.9 allows 0.1% of the pixels to be erroneously "
"bright - this helps stability in low light."
),
metadata={
"example": 0.05,
"description": (
"We stop adjusting when we get within this fraction of the target "
"value. It is a number between 0 and 1, usually 0.01--0.1."
),
},
),
"percentile": percentile_field,
}
def post(self, args):
@ -211,16 +221,7 @@ class AutoExposureFromRawView(ActionView):
class AutoWhiteBalanceFromRawView(ActionView):
args = {
"percentile": fields.Float(
load_default=99.9,
example=99.9,
description=(
"A float between 0 and 100 setting the centile to use "
"to measure the white point of the image. A value "
"of 99.9 allows 0.1% of the pixels to be erroneously "
"bright - this helps stability in low light."
),
)
"percentile": percentile_field,
}
def post(self, args):
@ -231,8 +232,10 @@ class AutoWhiteBalanceFromRawView(ActionView):
class GetRawChannelPercentilesView(ActionView):
args = {
"percentile": fields.Float(
example=99.9,
metadata={"description": "A float between 0 and 100 setting the centile to calculate"},
metadata={
"description": "A float between 0 and 100 setting the centile to calculate",
"example": 99.9,
},
)
}
schema = fields.List(fields.Integer)

View file

@ -578,17 +578,17 @@ class ScanExtension(BaseExtension):
class TileScanArgs(FullCaptureArgs):
namemode = fields.String(load_default="coordinates", example="coordinates")
namemode = fields.String(load_default="coordinates", metadata={"example": "coordinates"})
grid = fields.List(
fields.Integer(validate=marshmallow.validate.Range(min=1)),
load_default=[3, 3, 3],
example=[3, 3, 3],
metadata={"example": [3, 3, 3]},
)
style = fields.String(load_default="raster")
autofocus_dz = fields.Integer(load_default=50)
fast_autofocus = fields.Boolean(load_default=False)
stride_size = fields.List(
fields.Integer, load_default=[2000, 1500, 100], example=[2000, 1500, 100]
fields.Integer, load_default=[2000, 1500, 100], metadata={"example":[2000, 1500, 100]}
)
detect_empty_fields_and_skip_autofocus = fields.Boolean(load_default=False)