Skip to content

db

Data handling tools for the ROMI project (plantdb).Link

This module provides a structured API for interacting with a database in the context of the ROMI project. It defines abstract classes for representing databases (DB), scans (Scan), filesets (Fileset), and individual files (File). These classes allow for consistent data organization, retrieval, and manipulation.

Key FeaturesLink

  • Hierarchical Data Model: Organizes data into a multi-level structure with Databases containing Scans, which in turn contain Filesets of Files.
  • Abstract Interfaces: Defines interfaces that must be implemented to interact with actual databases or storage systems.
  • Metadata Handling: Provides methods for associating metadata with scans and filesets.
  • File Management: Supports file creation, deletion, importing, reading, and writing.

ImplementationLink

The following classes are defined:

  • A database DB contains a list of scans Scan distinguishable by their id.
  • A Scan is made of several sets of files Fileset.
  • A Fileset is made of a list of files File.
  • A File can be any other data format.

It should be subclassed to implement an actual database interface. See plantdb.commons.fsdb.core for a concrete implementation.

DB Link

DB()

Bases: object

Class defining the database object DB.

Abstract class defining the API used to communicate with a database in the ROMI project.

Source code in plantdb/commons/db.py
61
62
63
64
65
66
def __init__(self):
    # User management
    self.user = None
    # Database state
    self.is_connected = False
    self.scans = {}

connect Link

connect(login_data=None)

Connect to the database.

Parameters:

Name Type Description Default

login_data Link

list or dict

Use this to access to a DB with credentials.

None

Raises:

Type Description
NotImplementedError
Source code in plantdb/commons/db.py
68
69
70
71
72
73
74
75
76
77
78
79
80
def connect(self, login_data=None):
    """Connect to the database.

    Parameters
    ----------
    login_data : list or dict, optional
        Use this to access to a ``DB`` with credentials.

    Raises
    ------
    NotImplementedError
    """
    raise NotImplementedError

create_scan Link

create_scan(id)

Create a new scan object in the database.

Parameters:

Name Type Description Default

id Link

str

Id of the scan to retrieve

required

Raises:

Type Description
NotImplementedError
Source code in plantdb/commons/db.py
114
115
116
117
118
119
120
121
122
123
124
125
126
def create_scan(self, id):
    """Create a new scan object in the database.

    Parameters
    ----------
    id : str
        Id of the scan to retrieve

    Raises
    ------
    NotImplementedError
    """
    raise NotImplementedError

create_timelapse Link

create_timelapse(id, metadata=None)

Create a new timelapse object in the database.

Parameters:

Name Type Description Default

id Link

str

Id of the timelapse to create.

required

metadata Link

dict

Metadata for the timelapse.

None

Raises:

Type Description
NotImplementedError
Source code in plantdb/commons/db.py
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
def create_timelapse(self, id, metadata=None):
    """Create a new timelapse object in the database.

    Parameters
    ----------
    id : str
        Id of the timelapse to create.
    metadata : dict, optional
        Metadata for the timelapse.

    Raises
    ------
    NotImplementedError
    """
    raise NotImplementedError

delete_scan Link

delete_scan(id)

Delete a scan from the DB.

Parameters:

Name Type Description Default

id Link

str

Id of the scan to delete

required

Raises:

Type Description
NotImplementedError
Source code in plantdb/commons/db.py
128
129
130
131
132
133
134
135
136
137
138
139
140
def delete_scan(self, id):
    """Delete a scan from the DB.

    Parameters
    ----------
    id : str
        Id of the scan to delete

    Raises
    ------
    NotImplementedError
    """
    raise NotImplementedError

delete_timelapse Link

delete_timelapse(id, recursive=False)

Delete a timelapse container from the DB.

Parameters:

Name Type Description Default

id Link

str

Id of the timelapse to delete.

required

recursive Link

bool

Whether to delete member scans recursively.

False

Raises:

Type Description
NotImplementedError
Source code in plantdb/commons/db.py
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
def delete_timelapse(self, id, recursive=False):
    """Delete a timelapse container from the DB.

    Parameters
    ----------
    id : str
        Id of the timelapse to delete.
    recursive : bool, optional
        Whether to delete member scans recursively.

    Raises
    ------
    NotImplementedError
    """
    raise NotImplementedError

disconnect Link

disconnect()

Disconnect from the database.

Raises:

Type Description
NotImplementedError
Source code in plantdb/commons/db.py
82
83
84
85
86
87
88
89
def disconnect(self):
    """Disconnect from the database.

    Raises
    ------
    NotImplementedError
    """
    raise NotImplementedError

get_scan Link

get_scan(id)

Get a scan saved in the database.

Parameters:

Name Type Description Default

id Link

str

Id of the scan instance to retrieve.

required

Raises:

Type Description
NotImplementedError
Source code in plantdb/commons/db.py
100
101
102
103
104
105
106
107
108
109
110
111
112
def get_scan(self, id):
    """Get a scan saved in the database.

    Parameters
    ----------
    id : str
        Id of the scan instance to retrieve.

    Raises
    ------
    NotImplementedError
    """
    raise NotImplementedError

get_scans Link

get_scans()

Get the list of scans saved in the database.

Raises:

Type Description
NotImplementedError
Source code in plantdb/commons/db.py
91
92
93
94
95
96
97
98
def get_scans(self):
    """Get the list of scans saved in the database.

    Raises
    ------
    NotImplementedError
    """
    raise NotImplementedError

get_timelapse Link

get_timelapse(id)

Get a timelapse container saved in the database.

Parameters:

Name Type Description Default

id Link

str

Id of the timelapse instance to retrieve.

required

Raises:

Type Description
NotImplementedError
Source code in plantdb/commons/db.py
151
152
153
154
155
156
157
158
159
160
161
162
163
def get_timelapse(self, id):
    """Get a timelapse container saved in the database.

    Parameters
    ----------
    id : str
        Id of the timelapse instance to retrieve.

    Raises
    ------
    NotImplementedError
    """
    raise NotImplementedError

get_timelapses Link

get_timelapses()

Get the list of timelapses saved in the database.

Raises:

Type Description
NotImplementedError
Source code in plantdb/commons/db.py
142
143
144
145
146
147
148
149
def get_timelapses(self):
    """Get the list of timelapses saved in the database.

    Raises
    ------
    NotImplementedError
    """
    raise NotImplementedError

DBBusyError Link

DBBusyError(message)

Bases: OSError

Raises an error if the database is busy.

This error is raised when the database is busy and an operation cannot be done on it.

Source code in plantdb/commons/db.py
817
818
def __init__(self, message):
    self.message = message

File Link

File(fileset, id, **kwargs)

Bases: object

Class defining a file File contained in a Fileset.

Abstract class defining the API used to represent a file in the ROMI project.

Attributes:

Name Type Description
db DB

Database instance where to find the scan, fileset and file.

scan Scan

Scan instance containing the fileset and file.

fileset Fileset

Fileset instance containing the file.

id str

Id of the file instance.

Constructor.

Parameters:

Name Type Description Default

fileset Link

Fileset

Instance containing the file.

required

id Link

str

Id of the file instance.

required

Other Parameters:

Name Type Description
ext str

The extension of the file.

Source code in plantdb/commons/db.py
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
def __init__(self, fileset, id, **kwargs):
    """Constructor.

    Parameters
    ----------
    fileset : plantdb.commons.db.Fileset
        Instance containing the file.
    id : str
        Id of the file instance.

    Other Parameters
    ----------------
    ext : str
        The extension of the file.
    """
    self.db = fileset.get_db()
    self.scan = fileset.get_scan()
    self.fileset = fileset
    self.id = id
    ext = kwargs.get('ext', '')
    self.filename = id + ext if ext != '' else None

get_db Link

get_db()

Get parent database instance.

Returns:

Type Description
DB

The parent database instance.

Source code in plantdb/commons/db.py
675
676
677
678
679
680
681
682
683
def get_db(self):
    """Get parent database instance.

    Returns
    -------
    plantdb.commons.db.DB
        The parent database instance.
    """
    return self.db

get_fileset Link

get_fileset()

Get parent fileset.

Returns:

Type Description
Fileset

The parent fileset instance.

Source code in plantdb/commons/db.py
695
696
697
698
699
700
701
702
703
def get_fileset(self):
    """Get parent fileset.

    Returns
    -------
    plantdb.commons.db.Fileset
        The parent fileset instance.
    """
    return self.fileset

get_id Link

get_id()

Get file id.

Returns:

Type Description
str

The id of the file instance.

Source code in plantdb/commons/db.py
665
666
667
668
669
670
671
672
673
def get_id(self):
    """Get file id.

    Returns
    -------
    str
        The id of the file instance.
    """
    return deepcopy(self.id)

get_metadata Link

get_metadata(key=None, default=None)

Get metadata associated with scan.

Parameters:

Name Type Description Default

key Link

str

Metadata key to retrieve (defaults to None)

None

default Link

Any

The default value to return if the key do not exist in the metadata. Default is None.

None

Raises:

Type Description
NotImplementedError
Source code in plantdb/commons/db.py
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
def get_metadata(self, key=None, default=None):
    """Get metadata associated with scan.

    Parameters
    ----------
    key : str, optional
        Metadata key to retrieve (defaults to ``None``)
    default : Any, optional
        The default value to return if the key do not exist in the metadata.
        Default is ``None``.

    Raises
    ------
    NotImplementedError
    """
    raise NotImplementedError

get_scan Link

get_scan()

Get parent scan instance.

Returns:

Type Description
Scan

The parent scan instance.

Source code in plantdb/commons/db.py
685
686
687
688
689
690
691
692
693
def get_scan(self):
    """Get parent scan instance.

    Returns
    -------
    plantdb.commons.db.Scan
        The parent scan instance.
    """
    return self.scan

import_file Link

import_file(path)

Import an existing file to the File object.

Parameters:

Name Type Description Default

path Link

str

Path of the file to import

required

Raises:

Type Description
NotImplementedError
Source code in plantdb/commons/db.py
741
742
743
744
745
746
747
748
749
750
751
752
753
def import_file(self, path):
    """Import an existing file to the ``File`` object.

    Parameters
    ----------
    path : str
        Path of the file to import

    Raises
    ------
    NotImplementedError
    """
    raise NotImplementedError

read Link

read()

Reads from a file.

Raises:

Type Description
NotImplementedError
Source code in plantdb/commons/db.py
801
802
803
804
805
806
807
808
def read(self):
    """Reads from a file.

    Raises
    ------
    NotImplementedError
    """
    raise NotImplementedError

read_raw Link

read_raw()

Reads bytes from a file.

Returns:

Type Description
bytearray

File buffer

Raises:

Type Description
NotImplementedError
Source code in plantdb/commons/db.py
771
772
773
774
775
776
777
778
779
780
781
782
783
def read_raw(self):
    """Reads bytes from a file.

    Returns
    -------
    bytearray
        File buffer

    Raises
    ------
    NotImplementedError
    """
    raise NotImplementedError

set_metadata Link

set_metadata(data, value=None)

Get metadata associated with scan.

If value is None, scan metadata is set to data. If value is not None data is a key and is set to value.

Parameters:

Name Type Description Default

data Link

str or dict

Key or value to set as metadata

required

value Link

any

Value to set (default is None)

None

Raises:

Type Description
NotImplementedError
Source code in plantdb/commons/db.py
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
def set_metadata(self, data, value=None):
    """Get metadata associated with scan.

    If value is ``None``, scan metadata is set to data.
    If value is not ``None`` data is a key and is set to value.

    Parameters
    ----------
    data : str or dict
        Key or value to set as metadata
    value : any, optional
        Value to set (default is ``None``)

    Raises
    ------
    NotImplementedError
   """
    raise NotImplementedError

write Link

write(data, ext='')

Writes to a file.

Parameters:

Name Type Description Default

data Link

str

Data to write

required

ext Link

str

File extension to use

''

Raises:

Type Description
NotImplementedError
Source code in plantdb/commons/db.py
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
def write(self, data, ext=""):
    """Writes to a file.

    Parameters
    ----------
    data : str
        Data to write
    ext : str, optional
        File extension to use

    Raises
    ------
    NotImplementedError
    """
    raise NotImplementedError

write_raw Link

write_raw(buffer, ext='')

Writes bytes to a file.

Parameters:

Name Type Description Default

buffer Link

bytearray

Data to write

required

ext Link

str

File extension to use

''

Raises:

Type Description
NotImplementedError
Source code in plantdb/commons/db.py
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
def write_raw(self, buffer, ext=""):
    """Writes bytes to a file.

    Parameters
    ----------
    buffer : bytearray
        Data to write
    ext : str, optional
        File extension to use

    Raises
    ------
    NotImplementedError
    """
    raise NotImplementedError

Fileset Link

Fileset(scan, id)

Bases: object

Class defining a set of files Fileset contained in a Scan.

Abstract class defining the API used to represent a set of files in the ROMI project.

Notes

Files can be 2D images, RGB pictures, text,...

Attributes:

Name Type Description
db DB

Database instance where to find the scan and fileset.

scan Scan

Scan instance containing the fileset.

id int

Id of the fileset instance.

Constructor.

Parameters:

Name Type Description Default

scan Link

Scan

Scan instance containing the fileset.

required

id Link

str

Id of the fileset instance.

required
Source code in plantdb/commons/db.py
494
495
496
497
498
499
500
501
502
503
504
505
506
def __init__(self, scan, id):
    """Constructor.

    Parameters
    ----------
    scan : plantdb.commons.db.Scan
        Scan instance containing the fileset.
    id : str
        Id of the fileset instance.
    """
    self.db = scan.get_db()
    self.scan = scan
    self.id = id

create_file Link

create_file(id)

Create a file.

Parameters:

Name Type Description Default

id Link

str

Id of the new file.

required

Raises:

Type Description
NotImplementedError
Source code in plantdb/commons/db.py
597
598
599
600
601
602
603
604
605
606
607
608
609
def create_file(self, id):
    """Create a file.

    Parameters
    ----------
    id : str
        Id of the new file.

    Raises
    ------
    NotImplementedError
    """
    raise NotImplementedError

delete_file Link

delete_file(file_id)

Delete a file.

Parameters:

Name Type Description Default

file_id Link

str

Id of the file to delete.

required

Raises:

Type Description
NotImplementedError
Source code in plantdb/commons/db.py
611
612
613
614
615
616
617
618
619
620
621
622
623
def delete_file(self, file_id):
    """Delete a file.

    Parameters
    ----------
    file_id : str
        Id of the file to delete.

    Raises
    ------
    NotImplementedError
    """
    raise NotImplementedError

get_db Link

get_db()

Get parent database instance.

Returns:

Type Description
DB

The parent database instance.

Source code in plantdb/commons/db.py
518
519
520
521
522
523
524
525
526
def get_db(self):
    """Get parent database instance.

    Returns
    -------
    plantdb.commons.db.DB
        The parent database instance.
    """
    return self.db

get_file Link

get_file(id)

Get file with given id.

Parameters:

Name Type Description Default

id Link

str

File instance id.

required

Raises:

Type Description
NotImplementedError
Source code in plantdb/commons/db.py
547
548
549
550
551
552
553
554
555
556
557
558
559
def get_file(self, id):
    """Get file with given id.

    Parameters
    ----------
    id : str
        File instance id.

    Raises
    ------
    NotImplementedError
    """
    raise NotImplementedError

get_files Link

get_files()

Get all files.

Raises:

Type Description
NotImplementedError
Source code in plantdb/commons/db.py
538
539
540
541
542
543
544
545
def get_files(self):
    """Get all files.

    Raises
    ------
    NotImplementedError
    """
    raise NotImplementedError

get_id Link

get_id()

Get the fileset instance id.

Returns:

Type Description
str

The id of the fileset instance.

Source code in plantdb/commons/db.py
508
509
510
511
512
513
514
515
516
def get_id(self):
    """Get the fileset instance id.

    Returns
    -------
    str
        The id of the fileset instance.
    """
    return deepcopy(self.id)

get_metadata Link

get_metadata(key=None, default=None)

Get metadata associated with scan.

Parameters:

Name Type Description Default

key Link

str

Metadata key to retrieve, default to None.

None

default Link

Any

The default value to return if the key do not exist in the metadata. Default is None.

None

Raises:

Type Description
NotImplementedError
Source code in plantdb/commons/db.py
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
def get_metadata(self, key=None, default=None):
    """Get metadata associated with scan.

    Parameters
    ----------
    key : str
        Metadata key to retrieve, default to ``None``.
    default : Any, optional
        The default value to return if the key do not exist in the metadata.
        Default is ``None``.

    Raises
    ------
    NotImplementedError
    """
    raise NotImplementedError

get_scan Link

get_scan()

Get parent scan instance.

Returns:

Type Description
Scan

The parent scan instance.

Source code in plantdb/commons/db.py
528
529
530
531
532
533
534
535
536
def get_scan(self):
    """Get parent scan instance.

    Returns
    -------
    plantdb.commons.db.Scan
        The parent scan instance.
    """
    return self.scan

set_metadata Link

set_metadata(data, value=None)

Get metadata associated with scan.

If value is None, scan metadata is set to data. If value is not None data is a key and is set to value.

Parameters:

Name Type Description Default

data Link

str or dict

Key or value to set as metadata.

required

value Link

any

Value to set, default to None.

None

Raises:

Type Description
NotImplementedError
Source code in plantdb/commons/db.py
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
def set_metadata(self, data, value=None):
    """Get metadata associated with scan.

    If value is ``None``, scan metadata is set to data.
    If value is not ``None`` data is a key and is set to value.

    Parameters
    ----------
    data : str or dict
        Key or value to set as metadata.
    value : any, optional
        Value to set, default to ``None``.

    Raises
    ------
    NotImplementedError
    """
    raise NotImplementedError

Scan Link

Scan(db, id)

Bases: object

Class defining the scan object Scan.

Abstract class defining the API used to represent a scan in the ROMI project.

Attributes:

Name Type Description
db DB

Database instance where to find the scan.

id int

Id of the scan instance.

Constructor.

Parameters:

Name Type Description Default

db Link

DB

Database instance where to find the scan.

required

id Link

str

Id of the scan instance.

required
Source code in plantdb/commons/db.py
343
344
345
346
347
348
349
350
351
352
353
354
def __init__(self, db, id):
    """Constructor.

    Parameters
    ----------
    db : plantdb.commons.db.DB
        Database instance where to find the scan.
    id : str
        Id of the scan instance.
    """
    self.db = db
    self.id = id

create_fileset Link

create_fileset(id)

Create a fileset.

Parameters:

Name Type Description Default

id Link

str

Id of the new fileset.

required

Raises:

Type Description
NotImplementedError
Source code in plantdb/commons/db.py
445
446
447
448
449
450
451
452
453
454
455
456
457
def create_fileset(self, id):
    """Create a fileset.

    Parameters
    ----------
    id : str
        Id of the new fileset.

    Raises
    ------
    NotImplementedError
    """
    raise NotImplementedError

delete_fileset Link

delete_fileset(fileset_id)

Delete a fileset from the DB.

Parameters:

Name Type Description Default

fileset_id Link

str

Id of the fileset to delete.

required

Raises:

Type Description
NotImplementedError
Source code in plantdb/commons/db.py
459
460
461
462
463
464
465
466
467
468
469
470
471
def delete_fileset(self, fileset_id):
    """Delete a fileset from the DB.

    Parameters
    ----------
    fileset_id : str
        Id of the fileset to delete.

    Raises
    ------
    NotImplementedError
    """
    raise NotImplementedError

get_db Link

get_db()

Get parent database instance.

Returns:

Type Description
DB

Database instance where to find the scan.

Source code in plantdb/commons/db.py
366
367
368
369
370
371
372
373
374
def get_db(self):
    """Get parent database instance.

    Returns
    -------
    plantdb.commons.db.DB
        Database instance where to find the scan.
    """
    return self.db

get_fileset Link

get_fileset(id)

Get a fileset with a given id.

Parameters:

Name Type Description Default

id Link

str

Id of the fileset to be retrieved.

required

Raises:

Type Description
NotImplementedError
Source code in plantdb/commons/db.py
395
396
397
398
399
400
401
402
403
404
405
406
407
def get_fileset(self, id):
    """Get a fileset with a given id.

    Parameters
    ----------
    id : str
        Id of the fileset to be retrieved.

    Raises
    ------
    NotImplementedError
    """
    raise NotImplementedError

get_filesets Link

get_filesets()

Get all sets of files.

Raises:

Type Description
NotImplementedError
Source code in plantdb/commons/db.py
386
387
388
389
390
391
392
393
def get_filesets(self):
    """Get all sets of files.

    Raises
    ------
    NotImplementedError
    """
    raise NotImplementedError

get_id Link

get_id()

Get the scan instance id.

Returns:

Type Description
str

Id of the scan instance.

Source code in plantdb/commons/db.py
356
357
358
359
360
361
362
363
364
def get_id(self):
    """Get the scan instance id.

    Returns
    -------
    str
        Id of the scan instance.
    """
    return deepcopy(self.id)

get_metadata Link

get_metadata(key=None, default=None)

Get metadata associated with scan.

Parameters:

Name Type Description Default

key Link

str

Metadata key to retrieve, default to None.

None

default Link

Any

The default value to return if the key do not exist in the metadata. Default is None.

None

Raises:

Type Description
NotImplementedError
Source code in plantdb/commons/db.py
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
def get_metadata(self, key=None, default=None):
    """Get metadata associated with scan.

    Parameters
    ----------
    key : str
        Metadata key to retrieve, default to ``None``.
    default : Any, optional
        The default value to return if the key do not exist in the metadata.
        Default is ``None``.

    Raises
    ------
    NotImplementedError
    """
    raise NotImplementedError

get_timelapse Link

get_timelapse()

Get parent timelapse instance if defined, else None.

Returns:

Type Description
TimeLapse | None

Parent timelapse instance or None.

Source code in plantdb/commons/db.py
376
377
378
379
380
381
382
383
384
def get_timelapse(self):
    """Get parent timelapse instance if defined, else None.

    Returns
    -------
    plantdb.commons.db.TimeLapse | None
        Parent timelapse instance or None.
    """
    return None

set_metadata Link

set_metadata(data, value=None)

Get metadata associated with scan.

If value is None, scan metadata is set to data. If value is not None data is a key and is set to value.

Parameters:

Name Type Description Default

data Link

str or dict

Key or value.

required

value Link

any

Value to set, default to None.

None

Raises:

Type Description
NotImplementedError
Source code in plantdb/commons/db.py
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
def set_metadata(self, data, value=None):
    """Get metadata associated with scan.

    If value is ``None``, scan metadata is set to data.
    If value is not ``None`` data is a key and is set to value.

    Parameters
    ----------
    data : str or dict
        Key or value.
    value : any, optional
        Value to set, default to ``None``.

    Raises
    ------
    NotImplementedError
    """
    raise NotImplementedError

TimeLapse Link

TimeLapse(db, id)

Bases: object

Class defining the timelapse object TimeLapse contained in a DB.

Abstract class defining the API used to represent a timelapse of scans in the ROMI project. A timelapse container groups multiple temporal scans under a shared identifier and metadata.

Attributes:

Name Type Description
db DB

Database instance where to find the timelapse container.

id str

Id of the timelapse instance.

Constructor.

Parameters:

Name Type Description Default

db Link

DB

Database instance where to find the timelapse.

required

id Link

str

Id of the timelapse instance.

required
Source code in plantdb/commons/db.py
212
213
214
215
216
217
218
219
220
221
222
223
def __init__(self, db, id):
    """Constructor.

    Parameters
    ----------
    db : plantdb.commons.db.DB
        Database instance where to find the timelapse.
    id : str
        Id of the timelapse instance.
    """
    self.db = db
    self.id = id

create_scan Link

create_scan(id, metadata=None, **kwargs)

Create a new member scan in this timelapse.

Parameters:

Name Type Description Default

id Link

str

Id of the scan to create.

required

metadata Link

dict

Metadata for the scan.

None

Raises:

Type Description
NotImplementedError
Source code in plantdb/commons/db.py
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
def create_scan(self, id, metadata=None, **kwargs):
    """Create a new member scan in this timelapse.

    Parameters
    ----------
    id : str
        Id of the scan to create.
    metadata : dict, optional
        Metadata for the scan.

    Raises
    ------
    NotImplementedError
    """
    raise NotImplementedError

delete_scan Link

delete_scan(id, **kwargs)

Delete a scan from this timelapse.

Parameters:

Name Type Description Default

id Link

str

Id of the scan to delete.

required

Raises:

Type Description
NotImplementedError
Source code in plantdb/commons/db.py
297
298
299
300
301
302
303
304
305
306
307
308
309
def delete_scan(self, id, **kwargs):
    """Delete a scan from this timelapse.

    Parameters
    ----------
    id : str
        Id of the scan to delete.

    Raises
    ------
    NotImplementedError
    """
    raise NotImplementedError

get_db Link

get_db()

Get parent database instance.

Returns:

Type Description
DB

Database instance where to find the timelapse.

Source code in plantdb/commons/db.py
235
236
237
238
239
240
241
242
243
def get_db(self):
    """Get parent database instance.

    Returns
    -------
    plantdb.commons.db.DB
        Database instance where to find the timelapse.
    """
    return self.db

get_id Link

get_id()

Get the timelapse instance id.

Returns:

Type Description
str

Id of the timelapse instance.

Source code in plantdb/commons/db.py
225
226
227
228
229
230
231
232
233
def get_id(self):
    """Get the timelapse instance id.

    Returns
    -------
    str
        Id of the timelapse instance.
    """
    return deepcopy(self.id)

get_metadata Link

get_metadata(key=None, default=None)

Get metadata associated with the timelapse.

Raises:

Type Description
NotImplementedError
Source code in plantdb/commons/db.py
311
312
313
314
315
316
317
318
def get_metadata(self, key=None, default=None):
    """Get metadata associated with the timelapse.

    Raises
    ------
    NotImplementedError
    """
    raise NotImplementedError

get_scan Link

get_scan(id, **kwargs)

Get a scan belonging to this timelapse with a given id.

Parameters:

Name Type Description Default

id Link

str

Id of the scan instance to retrieve.

required

Raises:

Type Description
NotImplementedError
Source code in plantdb/commons/db.py
254
255
256
257
258
259
260
261
262
263
264
265
266
def get_scan(self, id, **kwargs):
    """Get a scan belonging to this timelapse with a given id.

    Parameters
    ----------
    id : str
        Id of the scan instance to retrieve.

    Raises
    ------
    NotImplementedError
    """
    raise NotImplementedError

get_scans Link

get_scans(query=None, sort='timelapse.scheduled', **kwargs)

Get the list of scans belonging to this timelapse.

Raises:

Type Description
NotImplementedError
Source code in plantdb/commons/db.py
245
246
247
248
249
250
251
252
def get_scans(self, query=None, sort="timelapse.scheduled", **kwargs):
    """Get the list of scans belonging to this timelapse.

    Raises
    ------
    NotImplementedError
    """
    raise NotImplementedError

list_scan Link

list_scan(query=None, fuzzy=False, sort='timelapse.scheduled', **kwargs)

Alias for list_scans.

Source code in plantdb/commons/db.py
277
278
279
def list_scan(self, query=None, fuzzy=False, sort="timelapse.scheduled", **kwargs):
    """Alias for list_scans."""
    return self.list_scans(query=query, fuzzy=fuzzy, sort=sort, **kwargs)

list_scans Link

list_scans(query=None, fuzzy=False, sort='timelapse.scheduled', **kwargs)

List scan ids belonging to this timelapse.

Raises:

Type Description
NotImplementedError
Source code in plantdb/commons/db.py
268
269
270
271
272
273
274
275
def list_scans(self, query=None, fuzzy=False, sort="timelapse.scheduled", **kwargs):
    """List scan ids belonging to this timelapse.

    Raises
    ------
    NotImplementedError
    """
    raise NotImplementedError

set_metadata Link

set_metadata(data, value=None)

Set metadata associated with the timelapse.

Raises:

Type Description
NotImplementedError
Source code in plantdb/commons/db.py
320
321
322
323
324
325
326
327
def set_metadata(self, data, value=None):
    """Set metadata associated with the timelapse.

    Raises
    ------
    NotImplementedError
    """
    raise NotImplementedError