poreflow.io.annotations¶
Annotation
¶
Bases: File
has_events
property
¶
Checks if events are stored in on disk.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if events dataset exists in annotation, False otherwise. |
has_ios
property
¶
Checks if the file contains open state current fit data.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if steps dataset exists in annotation, False otherwise. |
has_steps
property
¶
Checks if the file contains steps.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if steps dataset exists in annotation, False otherwise. |
ios_degree
property
¶
Order of the open state fits stored in the table
ios_n_coef
property
¶
Number of open state fit coefficients in the table
ios_table
property
¶
Retrieves the polynomial coefficients for the open state current fits on disk.
Retrieves the open state currents, expressed as a polynomial of degree
N, on disk. The returned table is N x M table, where M is the
number of channels. This table contains the coefficients of the polynomial of
the open state fit of the various channels of the measurement.
Returns:
| Type | Description |
|---|---|
DataFrame | None
|
pd.DataFrame: DataFrame containing open state current polynomial fits for each channel. None if no data on disk. |
New(fname, describes)
classmethod
¶
__init__(fname, mode='r+', **kwargs)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fname
|
|
required | |
mode
|
|
'r+'
|
|
**kwargs
|
|
{}
|
get_events()
¶
Reads events from disk.
Returns:
| Type | Description |
|---|---|
DataFrame | None
|
pandas.DataFrame: DataFrame containing events. |
get_ios(channel=0)
¶
Gets the polynomial fit of a channel's open state current fit
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channel
|
int
|
Which channel to retrieve the open state fit for. Defaults to 0. |
0
|
Returns:
| Type | Description |
|---|---|
Polynomial | None
|
np.polynomial.Polynomial: Polynomial describing open state current polynomial fits for a channel. |
get_steps()
¶
Reads events from disk.
Returns:
| Type | Description |
|---|---|
DataFrame | None
|
pf.StepsDataFrame: DataFrame containing events. |
remove_events(channels=None, events=None, include_steps=True)
¶
Removes events from specific channels or all events.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
include_steps
|
|
True
|
|
events
|
int | list[int] | None
|
|
None
|
channels
|
int | list[int] | None
|
|
None
|
include_ios
|
bool
|
Whether to also delete the ios fit for the specified channels. |
required |
Returns:
| Type | Description |
|---|---|
None
|
None |
Todo: Docs
remove_ios(channels=None)
¶
Removes open state current fits from specific channels or all channels.
Instead of deleting the entries, sets the polynomial coefficients to NaN to preserve the dataset structure.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
channels
|
int | list[int] | None
|
|
None
|
Returns:
| Type | Description |
|---|---|
None
|
None |
set_events(df_events, mode='w')
¶
Saves events to disk.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df_events
|
DataFrame
|
Events to save. Set None to delete all events store on disk. |
required |
mode
|
str
|
Whether to replace ('w') or append ('a') to existing events on disk. |
'w'
|
set_ios(p, channel=0)
¶
Stores the open state current for a channel on disk.
Stores the open state current, expressed as a polynomial of degree
N, on disk. Creates an N x M array on disk, where M is the
number of channels and stores the coefficients of the polynomial in
this table.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p
|
Polynomial
|
A polynomial describing the open state current for a channel. |
required |
channel
|
int
|
Which channel the polynomial describes. |
0
|
Todo
Raise an error if the existing table if for a different degree than
the input polynomial p.
set_steps(df_steps, mode='w')
¶
Saves steps to disk.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df_steps
|
StepsDataFrame
|
Steps to save. Set None to delete all events store on disk. |
required |
mode
|
str
|
Whether to replace ('w') or append ('a') to existing steps on disk. |
'w'
|