yt.frontends.ramses.field_handlers module¶
- class yt.frontends.ramses.field_handlers.FieldFileHandler(domain)[source]¶
Bases:
ABC
,HandlerMixin
Abstract class to handle particles in RAMSES. Each instance represents a single file (one domain).
To add support to a new particle file, inherit from this class and implement all functions containing a NotImplementedError.
See SinkParticleFileHandler for an example implementation.
- classmethod any_exist(ds)¶
This function should return True if the kind of particle represented by the class exists in the dataset. It takes as argument the class itself -not an instance- and a dataset.
- Parameters:
ds (a Ramses Dataset)
Note
This function is usually called once at the initialization of the RAMSES Dataset structure to determine if the particle type (e.g. regular particles) exists.
- abstract classmethod detect_fields(ds)[source]¶
Called once to setup the fields of this type
It should set the following static variables:
- parameters: dictionary
Dictionary containing the variables. The keys should match those of cls.attrs
- field_list: list of (ftype, fname)
The list of the field present in the file
- property exists¶
This function should return True if the file the instance exists. It is called for each file of the type found on the disk.
By default, it just returns whether the file exists. Override it for more complex cases.
- field_offsets = None¶
- field_types = None¶
- property has_descriptor¶
This function should return True if a file descriptor exists.
By default, it just returns whether the file exists. Override it for more complex cases.
- known_fields = None¶
- property level_count¶
Return the number of cells per level.
- property offset¶
Compute the offsets of the fields.
By default, it skips the header (as defined by cls.attrs) and computes the offset at each level.
It should be generic enough for most of the cases, but if the structure of your fluid file is non-canonical, change this.
- classmethod purge_detected_fields(ds)[source]¶
Purge the registry.
This should be called on dataset creation to force the field detection to be called.
- setup_handler(domain)¶
Initialize an instance of the class. This automatically sets the full path to the file. This is not intended to be overridden in most cases.
If you need more flexibility, rewrite this function to your need in the inherited class.
- class yt.frontends.ramses.field_handlers.GravFieldFileHandler(domain)[source]¶
Bases:
FieldFileHandler
- classmethod any_exist(ds)¶
This function should return True if the kind of particle represented by the class exists in the dataset. It takes as argument the class itself -not an instance- and a dataset.
- Parameters:
ds (a Ramses Dataset)
Note
This function is usually called once at the initialization of the RAMSES Dataset structure to determine if the particle type (e.g. regular particles) exists.
- attrs: tuple[tuple[str, int, str], ...] | None = (('ncpu', 1, 'i'), ('nvar', 1, 'i'), ('nlevelmax', 1, 'i'), ('nboundary', 1, 'i'))¶
- classmethod detect_fields(ds)[source]¶
Called once to setup the fields of this type
It should set the following static variables:
- parameters: dictionary
Dictionary containing the variables. The keys should match those of cls.attrs
- field_list: list of (ftype, fname)
The list of the field present in the file
- property exists¶
This function should return True if the file the instance exists. It is called for each file of the type found on the disk.
By default, it just returns whether the file exists. Override it for more complex cases.
- field_offsets = None¶
- field_types = None¶
- classmethod get_detected_fields(ds)¶
Get the detected fields from the registry.
- property has_descriptor¶
This function should return True if a file descriptor exists.
By default, it just returns whether the file exists. Override it for more complex cases.
- known_fields = None¶
- property level_count¶
Return the number of cells per level.
- property offset¶
Compute the offsets of the fields.
By default, it skips the header (as defined by cls.attrs) and computes the offset at each level.
It should be generic enough for most of the cases, but if the structure of your fluid file is non-canonical, change this.
- classmethod purge_detected_fields(ds)¶
Purge the registry.
This should be called on dataset creation to force the field detection to be called.
- classmethod set_detected_fields(ds, fields)¶
Store the detected fields into the registry.
- setup_handler(domain)¶
Initialize an instance of the class. This automatically sets the full path to the file. This is not intended to be overridden in most cases.
If you need more flexibility, rewrite this function to your need in the inherited class.
- class yt.frontends.ramses.field_handlers.HandlerMixin[source]¶
Bases:
object
This contains all the shared methods to handle RAMSES files.
This is not supposed to be user-facing.
- classmethod any_exist(ds)[source]¶
This function should return True if the kind of particle represented by the class exists in the dataset. It takes as argument the class itself -not an instance- and a dataset.
- Parameters:
ds (a Ramses Dataset)
Note
This function is usually called once at the initialization of the RAMSES Dataset structure to determine if the particle type (e.g. regular particles) exists.
- property exists¶
This function should return True if the file the instance exists. It is called for each file of the type found on the disk.
By default, it just returns whether the file exists. Override it for more complex cases.
- property has_descriptor¶
This function should return True if a file descriptor exists.
By default, it just returns whether the file exists. Override it for more complex cases.
- class yt.frontends.ramses.field_handlers.HydroFieldFileHandler(domain)[source]¶
Bases:
FieldFileHandler
- classmethod any_exist(ds)¶
This function should return True if the kind of particle represented by the class exists in the dataset. It takes as argument the class itself -not an instance- and a dataset.
- Parameters:
ds (a Ramses Dataset)
Note
This function is usually called once at the initialization of the RAMSES Dataset structure to determine if the particle type (e.g. regular particles) exists.
- attrs: tuple[tuple[str, int, str], ...] | None = (('ncpu', 1, 'i'), ('nvar', 1, 'i'), ('ndim', 1, 'i'), ('nlevelmax', 1, 'i'), ('nboundary', 1, 'i'), ('gamma', 1, 'd'))¶
- classmethod detect_fields(ds)[source]¶
Called once to setup the fields of this type
It should set the following static variables:
- parameters: dictionary
Dictionary containing the variables. The keys should match those of cls.attrs
- field_list: list of (ftype, fname)
The list of the field present in the file
- property exists¶
This function should return True if the file the instance exists. It is called for each file of the type found on the disk.
By default, it just returns whether the file exists. Override it for more complex cases.
- field_offsets = None¶
- field_types = None¶
- classmethod get_detected_fields(ds)¶
Get the detected fields from the registry.
- property has_descriptor¶
This function should return True if a file descriptor exists.
By default, it just returns whether the file exists. Override it for more complex cases.
- known_fields = None¶
- property level_count¶
Return the number of cells per level.
- property offset¶
Compute the offsets of the fields.
By default, it skips the header (as defined by cls.attrs) and computes the offset at each level.
It should be generic enough for most of the cases, but if the structure of your fluid file is non-canonical, change this.
- classmethod purge_detected_fields(ds)¶
Purge the registry.
This should be called on dataset creation to force the field detection to be called.
- classmethod set_detected_fields(ds, fields)¶
Store the detected fields into the registry.
- setup_handler(domain)¶
Initialize an instance of the class. This automatically sets the full path to the file. This is not intended to be overridden in most cases.
If you need more flexibility, rewrite this function to your need in the inherited class.
- class yt.frontends.ramses.field_handlers.RTFieldFileHandler(domain)[source]¶
Bases:
FieldFileHandler
- classmethod any_exist(ds)¶
This function should return True if the kind of particle represented by the class exists in the dataset. It takes as argument the class itself -not an instance- and a dataset.
- Parameters:
ds (a Ramses Dataset)
Note
This function is usually called once at the initialization of the RAMSES Dataset structure to determine if the particle type (e.g. regular particles) exists.
- attrs: tuple[tuple[str, int, str], ...] | None = (('ncpu', 1, 'i'), ('nvar', 1, 'i'), ('ndim', 1, 'i'), ('nlevelmax', 1, 'i'), ('nboundary', 1, 'i'), ('gamma', 1, 'd'))¶
- classmethod detect_fields(ds)[source]¶
Called once to setup the fields of this type
It should set the following static variables:
- parameters: dictionary
Dictionary containing the variables. The keys should match those of cls.attrs
- field_list: list of (ftype, fname)
The list of the field present in the file
- property exists¶
This function should return True if the file the instance exists. It is called for each file of the type found on the disk.
By default, it just returns whether the file exists. Override it for more complex cases.
- field_offsets = None¶
- field_types = None¶
- classmethod get_detected_fields(ds)¶
Get the detected fields from the registry.
- property has_descriptor¶
This function should return True if a file descriptor exists.
By default, it just returns whether the file exists. Override it for more complex cases.
- known_fields = None¶
- property level_count¶
Return the number of cells per level.
- property offset¶
Compute the offsets of the fields.
By default, it skips the header (as defined by cls.attrs) and computes the offset at each level.
It should be generic enough for most of the cases, but if the structure of your fluid file is non-canonical, change this.
- classmethod purge_detected_fields(ds)¶
Purge the registry.
This should be called on dataset creation to force the field detection to be called.
- classmethod set_detected_fields(ds, fields)¶
Store the detected fields into the registry.
- setup_handler(domain)¶
Initialize an instance of the class. This automatically sets the full path to the file. This is not intended to be overridden in most cases.
If you need more flexibility, rewrite this function to your need in the inherited class.