You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Bug fix :
- Property dictionnary access
- DOR reading with epc.as_dor() function
- set_attribute_from_path: take care of list parent
* New :
- Epc/Object validations have been improved.
- New function to ease upload of data arrays to etp server (to get the proxy uri or the uri of the object itself) : energyml.utils.data.datasets_io.get_proxy_uri_for_path_in_external(...)
- Regex optimisation by using precompiled ones
- New class for huge file : EpcStreamReader
- The "EnergymlWorkspace" class allows to abstract the access of numerical data like "ExternalArrays". This class can thus be extended to interact with ETP "GetDataArray" request etc...
77
77
- ETP URI support : the "Uri" class allows to parse/write an etp uri.
78
78
79
+
## EPC Stream Reader
80
+
81
+
The **EpcStreamReader** provides memory-efficient handling of large EPC files through lazy loading and smart caching. Unlike the standard `Epc` class which loads all objects into memory, the stream reader loads objects on-demand, making it ideal for handling very large EPC files with thousands of objects.
82
+
83
+
### Key Features
84
+
85
+
-**Lazy Loading**: Objects are loaded only when accessed, reducing memory footprint
86
+
-**Smart Caching**: LRU (Least Recently Used) cache with configurable size
87
+
-**Automatic EPC Version Detection**: Supports both CLASSIC and EXPANDED EPC formats
88
+
-**Add/Remove/Update Operations**: Full CRUD operations with automatic file structure maintenance
89
+
-**Context Management**: Automatic resource cleanup with `with` statements
90
+
-**Memory Monitoring**: Track cache efficiency and memory usage statistics
91
+
92
+
### Basic Usage
93
+
94
+
```python
95
+
from energyml.utils.epc_stream import EpcStreamReader
96
+
97
+
# Open EPC file with context manager (recommended)
98
+
with EpcStreamReader('large_file.epc', cache_size=50) as reader:
reader.close() # Manual cleanup if not using context manager
213
+
```
214
+
215
+
The EpcStreamReader is perfect for applications that need to work with large EPC files efficiently, such as data processing pipelines, web applications, or analysis tools where memory usage is a concern.
0 commit comments