We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
dataclass
dict is too opaque, pls add data class support
can devs do something??
here sample
from dataclasses import dataclass from typing import List from datetime import datetime, timedelta import numpy as np # The current data structure is: # bigdict[time_idx][conc_nr][well_nr]['droplet geometry'] # Flattened into a dataclass: # -------------------------- @dataclass class ImageData: raw_image: str droplet_geometry: str droplet_status: bool conc_idx: int well_idx: int def gray_image(self) -> str: return "gray_image" @dataclass class Wells: image_data: ImageData @dataclass class Concentrations: wells: List[Wells] @dataclass class Images: concentrations: List[Concentrations] # Sample code for testing: # ------------------------ TOTAL_WELLS = 2 TOTAL_CONCS = 3 dates = np.arange( datetime(2022, 4, 1), datetime(2022, 4, 6), timedelta(days=1) ).astype(datetime) images = dict() for date in dates: concentrations = [] for conc_idx, conc in enumerate(range(TOTAL_CONCS)): wells = [] for well_idx, well in enumerate(range(TOTAL_WELLS)): image_data = ImageData( raw_image="an_image.png", droplet_geometry="round", droplet_status=True, conc_idx=conc_idx, well_idx=well_idx ) wells.append(Wells(image_data)) concentrations.append(Concentrations(wells)) images[date] = Images(concentrations=concentrations) images[datetime(2022, 4, 2, 0, 0)].concentrations[2].wells[1].image_data # Which returns: # ImageData(raw_image='an_image.png', droplet_geometry='round', droplet_status=True, conc_idx=2, well_idx=1)
The text was updated successfully, but these errors were encountered:
Thank you very much for your extensive suggestions. Since I'm still learning the language, this is very helpfull.
I will try to implement classes and dataclasses as soon as I find time for it. Thanks :)
Sorry, something went wrong.
No branches or pull requests
dict is too opaque, pls add data class support
can devs do something??
here sample
The text was updated successfully, but these errors were encountered: