def plant_capture_procedure() -> cgp.ProcedureSequence:
"""Client-side procedure for plant growth monitoring."""
root = cgp.GetRootDirectory()
session = root.new_session("Sunflower")
# Get reference from first session for alignment
first_session = root.get_first_session("Sunflower")
# Capture aligned reference photo
aligned_photo = cgp.CaptureAlignedImage(
label="Capture Aligned Reference",
reference_image=first_session.new_file("reference").load(
or_else=cgp.NullProcedure(return_type=cgp.PImage)
),
)
# Capture surrounding photos for 3D reconstruction
surrounding_photos = cgp.CaptureImageSequence(
label="Capture Surrounding Photos",
)
return cgp.ProcedureSequence(
label="Sunflower Capture",
procedures=[
session.new_file("reference").save(aligned_photo),
session.new_directory("surrounding").save_bundle(surrounding_photos),
],
)
def __notification__(user_id, target, persistence) -> datetime:
"""Return next notification at optimal daylight hours."""
store = cgsh.organize.AssignmentStore(
persistence=persistence,
expire_after=timedelta(hours=0.5),
last_capture=target.Sunflower[-1].date,
)
# Create slots for daylight hours
slots = cg.List([])
slots.date = cgsh.forecast.times_of_day(
hours=[10, 12, 14, 16, 18, 20, 22],
)
selected = store.assign_next(user_id, slots)
return selected.date