-
Notifications
You must be signed in to change notification settings - Fork 9
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
improved repr #26
improved repr #26
Conversation
I think this is really close to creating reprs that are basically executable Python code (except for the containers)! This kind of repr would go a long way in guiding new users down the right path for creating their own objects without even needing to consult the docs. This near-executable output might look like this for your example: Image(
id="Image:0",
pixels=Pixels(
id="Pixels:0:0",
dimension_order="XYCZT",
size_c=2,
size_t=2,
size_x=6,
size_y=4,
size_z=2,
type="uint8",
bin_data=<8 Bin_Data>,
channels=<2 Channels>,
physical_size_x=10000.0,
physical_size_y=10000.0,
planes=<8 Planes>,
),
acquisition_date=datetime.fromisoformat("2010-11-10T14:42:38"),
annotation_ref=<4 Annotation_Ref>,
instrument_ref=InstrumentRef(id="Instrument:SpimSampleMicroscope1"),
name="Spim Sample Tile 1 Angle 1",
objective_settings=ObjectiveSettings(
id="Objective:1",
correction_collar=6.0,
medium="Oil",
),
stage_label=StageLabel(
name="(1,1) of 1x2",
x=1.0,
y=1.0,
),
) |
yep, love that... will work towards it. |
updated... some examples: Image(
id='Image:0',
name='Spim Sample Tile 1 Angle 1',
pixels=Pixels(
id='Pixels:0:0',
dimension_order='XYCZT',
size_c=2,
size_t=2,
size_x=6,
size_y=4,
size_z=2,
type='uint8',
bin_data=[<8 Bin_Data>],
channels=[<2 Channels>],
physical_size_x=10000.0,
physical_size_y=10000.0,
planes=[<8 Planes>]
),
acquisition_date=datetime.fromisoformat('2010-11-10T14:42:38'),
annotation_ref=[<4 Annotation_Ref>],
instrument_ref=InstrumentRef(
id='Instrument:SpimSampleMicroscope1'
),
objective_settings=ObjectiveSettings(
id='Objective:1',
correction_collar=6.0,
medium='Oil'
),
stage_label=StageLabel(
name='(1,1) of 1x2',
x=1.0,
y=1.0
)
)
OME(
images=[<4 Images>],
instruments=[<1 Instruments>],
structured_annotations=[<7 Structured_Annotations>]
)
Instrument(
id='Instrument:SpimSampleMicroscope1',
detectors=[<1 Detectors>],
light_source_group=[<2 Light_Source_Group>],
microscope=Microscope(
manufacturer='OME-Sample',
model='Spim-Sample',
serial_number='SPIM-1',
type='Other'
),
objectives=[<3 Objectives>]
)
Laser(
id='LightSource:1',
manufacturer='OME-Sample',
model='Laser Mk1',
serial_number='LASER-1',
laser_medium='GaAs',
type='Semiconductor',
wavelength=448.0
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! The extra square brackets around the containers looks weird but I understand it communicates that they're lists.
Codecov Report
@@ Coverage Diff @@
## master #26 +/- ##
==========================================
- Coverage 95.20% 95.18% -0.02%
==========================================
Files 1 1
Lines 396 436 +40
==========================================
+ Hits 377 415 +38
- Misses 19 21 +2
Continue to review full report at Codecov.
|
closes #4
This is a start on improved reprs, as per #4 (leave out properties that are set to the default, summarize containers rather than recursively include their contents) plenty to discuss here...
here's an
Image
repr as it stands:previously...
😂