repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_documentation_string
stringlengths
1
47.2k
func_code_url
stringlengths
85
339
sunt05/SuPy
src/supy/supy_save.py
save_df_state
def save_df_state( df_state: pd.DataFrame, site: str = '', path_dir_save: Path = Path('.'),)->Path: '''save `df_state` to a csv file Parameters ---------- df_state : pd.DataFrame a dataframe of model states produced by a supy run site : str, optional site ide...
python
def save_df_state( df_state: pd.DataFrame, site: str = '', path_dir_save: Path = Path('.'),)->Path: '''save `df_state` to a csv file Parameters ---------- df_state : pd.DataFrame a dataframe of model states produced by a supy run site : str, optional site ide...
save `df_state` to a csv file Parameters ---------- df_state : pd.DataFrame a dataframe of model states produced by a supy run site : str, optional site identifier (the default is '', which indicates an empty site code) path_dir_save : Path, optional path to directory to sav...
https://github.com/sunt05/SuPy/blob/47178bd5aee50a059414e3e504940662fbfae0dc/src/supy/supy_save.py#L194-L221
sunt05/SuPy
src/supy/supy_save.py
get_save_info
def get_save_info(path_runcontrol: str)->Tuple[int, Path, str]: '''get necessary information for saving supy results, which are (freq_s, dir_save, site) Parameters ---------- path_runcontrol : Path Path to SUEWS :ref:`RunControl.nml <suews:RunControl.nml>` Returns ------- tuple ...
python
def get_save_info(path_runcontrol: str)->Tuple[int, Path, str]: '''get necessary information for saving supy results, which are (freq_s, dir_save, site) Parameters ---------- path_runcontrol : Path Path to SUEWS :ref:`RunControl.nml <suews:RunControl.nml>` Returns ------- tuple ...
get necessary information for saving supy results, which are (freq_s, dir_save, site) Parameters ---------- path_runcontrol : Path Path to SUEWS :ref:`RunControl.nml <suews:RunControl.nml>` Returns ------- tuple A tuple including (freq_s, dir_save, site): freq_s: output...
https://github.com/sunt05/SuPy/blob/47178bd5aee50a059414e3e504940662fbfae0dc/src/supy/supy_save.py#L226-L260
sunt05/SuPy
src/supy/supy_util.py
gen_FS_DF
def gen_FS_DF(df_output): """generate DataFrame of scores. Parameters ---------- df_WS_data : type Description of parameter `df_WS_data`. Returns ------- type Description of returned object. """ df_day = pd.pivot_table( df_output, values=['T2', 'U10...
python
def gen_FS_DF(df_output): """generate DataFrame of scores. Parameters ---------- df_WS_data : type Description of parameter `df_WS_data`. Returns ------- type Description of returned object. """ df_day = pd.pivot_table( df_output, values=['T2', 'U10...
generate DataFrame of scores. Parameters ---------- df_WS_data : type Description of parameter `df_WS_data`. Returns ------- type Description of returned object.
https://github.com/sunt05/SuPy/blob/47178bd5aee50a059414e3e504940662fbfae0dc/src/supy/supy_util.py#L140-L174
sunt05/SuPy
src/supy/supy_util.py
gen_WS_DF
def gen_WS_DF(df_WS_data): """generate DataFrame of weighted sums. Parameters ---------- df_WS_data : type Description of parameter `df_WS_data`. Returns ------- type Description of returned object. """ df_fs = gen_FS_DF(df_WS_data) list_index = [('mean', 'T2'...
python
def gen_WS_DF(df_WS_data): """generate DataFrame of weighted sums. Parameters ---------- df_WS_data : type Description of parameter `df_WS_data`. Returns ------- type Description of returned object. """ df_fs = gen_FS_DF(df_WS_data) list_index = [('mean', 'T2'...
generate DataFrame of weighted sums. Parameters ---------- df_WS_data : type Description of parameter `df_WS_data`. Returns ------- type Description of returned object.
https://github.com/sunt05/SuPy/blob/47178bd5aee50a059414e3e504940662fbfae0dc/src/supy/supy_util.py#L177-L208
sunt05/SuPy
src/supy/supy_util.py
gen_TMY
def gen_TMY(df_output): '''generate TMY (typical meteorological year) from SuPy output. Parameters ---------- df_output : pandas.DataFrame Output from `run_supy`: longterm (e.g., >10 years) simulation results, otherwise not very useful. ''' # calculate weighted score ws = gen_WS_D...
python
def gen_TMY(df_output): '''generate TMY (typical meteorological year) from SuPy output. Parameters ---------- df_output : pandas.DataFrame Output from `run_supy`: longterm (e.g., >10 years) simulation results, otherwise not very useful. ''' # calculate weighted score ws = gen_WS_D...
generate TMY (typical meteorological year) from SuPy output. Parameters ---------- df_output : pandas.DataFrame Output from `run_supy`: longterm (e.g., >10 years) simulation results, otherwise not very useful.
https://github.com/sunt05/SuPy/blob/47178bd5aee50a059414e3e504940662fbfae0dc/src/supy/supy_util.py#L327-L354
sunt05/SuPy
src/supy/supy_util.py
_geoid_radius
def _geoid_radius(latitude: float) -> float: """Calculates the GEOID radius at a given latitude Parameters ---------- latitude : float Latitude (degrees) Returns ------- R : float GEOID Radius (meters) """ lat = deg2rad(latitude) return sqrt(1/(cos(lat) ** 2 / R...
python
def _geoid_radius(latitude: float) -> float: """Calculates the GEOID radius at a given latitude Parameters ---------- latitude : float Latitude (degrees) Returns ------- R : float GEOID Radius (meters) """ lat = deg2rad(latitude) return sqrt(1/(cos(lat) ** 2 / R...
Calculates the GEOID radius at a given latitude Parameters ---------- latitude : float Latitude (degrees) Returns ------- R : float GEOID Radius (meters)
https://github.com/sunt05/SuPy/blob/47178bd5aee50a059414e3e504940662fbfae0dc/src/supy/supy_util.py#L518-L532
sunt05/SuPy
src/supy/supy_util.py
geometric2geopotential
def geometric2geopotential(z: float, latitude: float) -> float: """Converts geometric height to geopoential height Parameters ---------- z : float Geometric height (meters) latitude : float Latitude (degrees) Returns ------- h : float Geopotential Height (meters...
python
def geometric2geopotential(z: float, latitude: float) -> float: """Converts geometric height to geopoential height Parameters ---------- z : float Geometric height (meters) latitude : float Latitude (degrees) Returns ------- h : float Geopotential Height (meters...
Converts geometric height to geopoential height Parameters ---------- z : float Geometric height (meters) latitude : float Latitude (degrees) Returns ------- h : float Geopotential Height (meters) above the reference ellipsoid
https://github.com/sunt05/SuPy/blob/47178bd5aee50a059414e3e504940662fbfae0dc/src/supy/supy_util.py#L535-L553
sunt05/SuPy
src/supy/supy_util.py
geopotential2geometric
def geopotential2geometric(h: float, latitude: float) -> float: """Converts geopoential height to geometric height Parameters ---------- h : float Geopotential height (meters) latitude : float Latitude (degrees) Returns ------- z : float Geometric Height (meters...
python
def geopotential2geometric(h: float, latitude: float) -> float: """Converts geopoential height to geometric height Parameters ---------- h : float Geopotential height (meters) latitude : float Latitude (degrees) Returns ------- z : float Geometric Height (meters...
Converts geopoential height to geometric height Parameters ---------- h : float Geopotential height (meters) latitude : float Latitude (degrees) Returns ------- z : float Geometric Height (meters) above the reference ellipsoid
https://github.com/sunt05/SuPy/blob/47178bd5aee50a059414e3e504940662fbfae0dc/src/supy/supy_util.py#L556-L574
sunt05/SuPy
src/supy/supy_util.py
get_ser_val_alt
def get_ser_val_alt(lat: float, lon: float, da_alt_x: xr.DataArray, da_alt: xr.DataArray, da_val: xr.DataArray)->pd.Series: '''interpolate atmospheric variable to a specified altitude Parameters ---------- lat : float latitude of specified site lon : ...
python
def get_ser_val_alt(lat: float, lon: float, da_alt_x: xr.DataArray, da_alt: xr.DataArray, da_val: xr.DataArray)->pd.Series: '''interpolate atmospheric variable to a specified altitude Parameters ---------- lat : float latitude of specified site lon : ...
interpolate atmospheric variable to a specified altitude Parameters ---------- lat : float latitude of specified site lon : float longitude of specified site da_alt_x : xr.DataArray desired altitude to interpolate variable at da_alt : xr.DataArray altitude associ...
https://github.com/sunt05/SuPy/blob/47178bd5aee50a059414e3e504940662fbfae0dc/src/supy/supy_util.py#L578-L617
sunt05/SuPy
src/supy/supy_util.py
get_df_val_alt
def get_df_val_alt(lat: float, lon: float, da_alt_meas: xr.DataArray, ds_val: xr.Dataset): '''interpolate atmospheric variables to a specified altitude Parameters ---------- lat : float latitude of specified site lon : float longitude of specified site da_alt_x : xr.DataArray ...
python
def get_df_val_alt(lat: float, lon: float, da_alt_meas: xr.DataArray, ds_val: xr.Dataset): '''interpolate atmospheric variables to a specified altitude Parameters ---------- lat : float latitude of specified site lon : float longitude of specified site da_alt_x : xr.DataArray ...
interpolate atmospheric variables to a specified altitude Parameters ---------- lat : float latitude of specified site lon : float longitude of specified site da_alt_x : xr.DataArray desired altitude to interpolate variable at da_alt : xr.DataArray altitude assoc...
https://github.com/sunt05/SuPy/blob/47178bd5aee50a059414e3e504940662fbfae0dc/src/supy/supy_util.py#L620-L661
sunt05/SuPy
src/supy/supy_util.py
gen_req_sfc
def gen_req_sfc(lat_x, lon_x, start, end, grid=[0.125, 0.125], scale=0): '''generate a dict of reqs kwargs for (lat_x,lon_x) spanning [start, end] Parameters ---------- lat_x : [type] [description] lon_x : [type] [description] start : [type] [description] end : [type...
python
def gen_req_sfc(lat_x, lon_x, start, end, grid=[0.125, 0.125], scale=0): '''generate a dict of reqs kwargs for (lat_x,lon_x) spanning [start, end] Parameters ---------- lat_x : [type] [description] lon_x : [type] [description] start : [type] [description] end : [type...
generate a dict of reqs kwargs for (lat_x,lon_x) spanning [start, end] Parameters ---------- lat_x : [type] [description] lon_x : [type] [description] start : [type] [description] end : [type] [description] grid : list, optional [description] (the def...
https://github.com/sunt05/SuPy/blob/47178bd5aee50a059414e3e504940662fbfae0dc/src/supy/supy_util.py#L756-L808
sunt05/SuPy
src/supy/supy_util.py
sel_list_pres
def sel_list_pres(ds_sfc_x): ''' select proper levels for model level data download ''' p_min, p_max = ds_sfc_x.sp.min().values, ds_sfc_x.sp.max().values list_pres_level = [ '1', '2', '3', '5', '7', '10', '20', '30', '50', '70', '100', '125', '150', '175', '20...
python
def sel_list_pres(ds_sfc_x): ''' select proper levels for model level data download ''' p_min, p_max = ds_sfc_x.sp.min().values, ds_sfc_x.sp.max().values list_pres_level = [ '1', '2', '3', '5', '7', '10', '20', '30', '50', '70', '100', '125', '150', '175', '20...
select proper levels for model level data download
https://github.com/sunt05/SuPy/blob/47178bd5aee50a059414e3e504940662fbfae0dc/src/supy/supy_util.py#L811-L838
ecell/ecell4
ecell4/util/simulation.py
load_world
def load_world(filename): """ Load a world from the given HDF5 filename. The return type is determined by ``ecell4_base.core.load_version_information``. Parameters ---------- filename : str A HDF5 filename. Returns ------- w : World Return one from ``BDWorld``, ``EG...
python
def load_world(filename): """ Load a world from the given HDF5 filename. The return type is determined by ``ecell4_base.core.load_version_information``. Parameters ---------- filename : str A HDF5 filename. Returns ------- w : World Return one from ``BDWorld``, ``EG...
Load a world from the given HDF5 filename. The return type is determined by ``ecell4_base.core.load_version_information``. Parameters ---------- filename : str A HDF5 filename. Returns ------- w : World Return one from ``BDWorld``, ``EGFRDWorld``, ``MesoscopicWorld``, ...
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/util/simulation.py#L10-L44
ecell/ecell4
ecell4/util/simulation.py
run_simulation
def run_simulation( t, y0=None, volume=1.0, model=None, solver='ode', is_netfree=False, species_list=None, without_reset=False, return_type='matplotlib', opt_args=(), opt_kwargs=None, structures=None, observers=(), progressbar=0, rndseed=None, factory=None, ## deprecated ...
python
def run_simulation( t, y0=None, volume=1.0, model=None, solver='ode', is_netfree=False, species_list=None, without_reset=False, return_type='matplotlib', opt_args=(), opt_kwargs=None, structures=None, observers=(), progressbar=0, rndseed=None, factory=None, ## deprecated ...
Run a simulation with the given model and plot the result on IPython notebook with matplotlib. Parameters ---------- t : array or Real A sequence of time points for which to solve for 'm'. y0 : dict Initial condition. volume : Real or Real3, optional A size of the simula...
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/util/simulation.py#L96-L318
ecell/ecell4
ecell4/util/simulation.py
number_observer
def number_observer(t=None, targets=None): """ Return a number observer. If t is None, return NumberObserver. If t is a number, return FixedIntervalNumberObserver. If t is an iterable (a list of numbers), return TimingNumberObserver. Parameters ---------- t : float, list or tuple, optional....
python
def number_observer(t=None, targets=None): """ Return a number observer. If t is None, return NumberObserver. If t is a number, return FixedIntervalNumberObserver. If t is an iterable (a list of numbers), return TimingNumberObserver. Parameters ---------- t : float, list or tuple, optional....
Return a number observer. If t is None, return NumberObserver. If t is a number, return FixedIntervalNumberObserver. If t is an iterable (a list of numbers), return TimingNumberObserver. Parameters ---------- t : float, list or tuple, optional. default None A timing of the observation. See ...
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/util/simulation.py#L320-L349
ecell/ecell4
ecell4/util/show.py
show
def show(target, *args, **kwargs): """ An utility function to display the given target object in the proper way. Paramters --------- target : NumberObserver, TrajectoryObserver, World, str When a NumberObserver object is given, show it with viz.plot_number_observer. When a Trajector...
python
def show(target, *args, **kwargs): """ An utility function to display the given target object in the proper way. Paramters --------- target : NumberObserver, TrajectoryObserver, World, str When a NumberObserver object is given, show it with viz.plot_number_observer. When a Trajector...
An utility function to display the given target object in the proper way. Paramters --------- target : NumberObserver, TrajectoryObserver, World, str When a NumberObserver object is given, show it with viz.plot_number_observer. When a TrajectoryObserver object is given, show it with viz.plo...
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/util/show.py#L15-L43
ecell/ecell4
ecell4/util/progressbar.py
ProgressBarSimulatorWrapper.run
def run(self, duration, obs): """Run the simulation. Parameters ---------- duration : Real a duration for running a simulation. A simulation is expected to be stopped at t() + duration. observers : list of Obeservers, optional observers ...
python
def run(self, duration, obs): """Run the simulation. Parameters ---------- duration : Real a duration for running a simulation. A simulation is expected to be stopped at t() + duration. observers : list of Obeservers, optional observers ...
Run the simulation. Parameters ---------- duration : Real a duration for running a simulation. A simulation is expected to be stopped at t() + duration. observers : list of Obeservers, optional observers
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/util/progressbar.py#L140-L169
ecell/ecell4
ecell4/util/progressbar.py
ProgressBarNotebook.run
def run(self, duration, obs=None): """Run the simulation. Parameters ---------- duration : Real a duration for running a simulation. A simulation is expected to be stopped at t() + duration. obs : list of Obeservers, optional observers ...
python
def run(self, duration, obs=None): """Run the simulation. Parameters ---------- duration : Real a duration for running a simulation. A simulation is expected to be stopped at t() + duration. obs : list of Obeservers, optional observers ...
Run the simulation. Parameters ---------- duration : Real a duration for running a simulation. A simulation is expected to be stopped at t() + duration. obs : list of Obeservers, optional observers
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/util/progressbar.py#L236-L276
ecell/ecell4
ecell4/extra/azure_batch.py
print_batch_exception
def print_batch_exception(batch_exception): """Prints the contents of the specified Batch exception. :param batch_exception: """ _log.error('-------------------------------------------') _log.error('Exception encountered:') if batch_exception.error and \ batch_exception.error.messag...
python
def print_batch_exception(batch_exception): """Prints the contents of the specified Batch exception. :param batch_exception: """ _log.error('-------------------------------------------') _log.error('Exception encountered:') if batch_exception.error and \ batch_exception.error.messag...
Prints the contents of the specified Batch exception. :param batch_exception:
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/extra/azure_batch.py#L45-L60
ecell/ecell4
ecell4/extra/azure_batch.py
upload_file_to_container
def upload_file_to_container(block_blob_client, container_name, file_path): """Uploads a local file to an Azure Blob storage container. :param block_blob_client: A blob service client. :type block_blob_client: `azure.storage.blob.BlockBlobService` :param str container_name: The name of the Azure Blob s...
python
def upload_file_to_container(block_blob_client, container_name, file_path): """Uploads a local file to an Azure Blob storage container. :param block_blob_client: A blob service client. :type block_blob_client: `azure.storage.blob.BlockBlobService` :param str container_name: The name of the Azure Blob s...
Uploads a local file to an Azure Blob storage container. :param block_blob_client: A blob service client. :type block_blob_client: `azure.storage.blob.BlockBlobService` :param str container_name: The name of the Azure Blob storage container. :param str file_path: The local path to the file. :rtype:...
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/extra/azure_batch.py#L62-L91
ecell/ecell4
ecell4/extra/azure_batch.py
get_container_sas_token
def get_container_sas_token(block_blob_client, container_name, blob_permissions): """Obtains a shared access signature granting the specified permissions to the container. :param block_blob_client: A blob service client. :type block_blob_client: `azure.storage.blob.BlockBlob...
python
def get_container_sas_token(block_blob_client, container_name, blob_permissions): """Obtains a shared access signature granting the specified permissions to the container. :param block_blob_client: A blob service client. :type block_blob_client: `azure.storage.blob.BlockBlob...
Obtains a shared access signature granting the specified permissions to the container. :param block_blob_client: A blob service client. :type block_blob_client: `azure.storage.blob.BlockBlobService` :param str container_name: The name of the Azure Blob storage container. :param BlobPermissions blob...
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/extra/azure_batch.py#L93-L114
ecell/ecell4
ecell4/extra/azure_batch.py
wrap_commands_in_shell
def wrap_commands_in_shell(ostype, commands): """Wrap commands in a shell Originally in azure-batch-samples.Python.Batch.common.helpers :param list commands: list of commands to wrap :param str ostype: OS type, linux or windows :rtype: str :return: a shell wrapping commands """ if ostyp...
python
def wrap_commands_in_shell(ostype, commands): """Wrap commands in a shell Originally in azure-batch-samples.Python.Batch.common.helpers :param list commands: list of commands to wrap :param str ostype: OS type, linux or windows :rtype: str :return: a shell wrapping commands """ if ostyp...
Wrap commands in a shell Originally in azure-batch-samples.Python.Batch.common.helpers :param list commands: list of commands to wrap :param str ostype: OS type, linux or windows :rtype: str :return: a shell wrapping commands
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/extra/azure_batch.py#L144-L159
ecell/ecell4
ecell4/extra/azure_batch.py
create_pool
def create_pool(batch_service_client, pool_id, resource_files, publisher, offer, sku, task_file, vm_size, node_count): """Creates a pool of compute nodes with the specified OS settings. :param batch_service_client: A Batch service client. :type batch_service_client: `azure.b...
python
def create_pool(batch_service_client, pool_id, resource_files, publisher, offer, sku, task_file, vm_size, node_count): """Creates a pool of compute nodes with the specified OS settings. :param batch_service_client: A Batch service client. :type batch_service_client: `azure.b...
Creates a pool of compute nodes with the specified OS settings. :param batch_service_client: A Batch service client. :type batch_service_client: `azure.batch.BatchServiceClient` :param str pool_id: An ID for the new pool. :param list resource_files: A collection of resource files for the pool's sta...
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/extra/azure_batch.py#L161-L232
ecell/ecell4
ecell4/extra/azure_batch.py
create_job
def create_job(batch_service_client, job_id, pool_id): """Creates a job with the specified ID, associated with the specified pool. :param batch_service_client: A Batch service client. :type batch_service_client: `azure.batch.BatchServiceClient` :param str job_id: The ID for the job. :param str pool...
python
def create_job(batch_service_client, job_id, pool_id): """Creates a job with the specified ID, associated with the specified pool. :param batch_service_client: A Batch service client. :type batch_service_client: `azure.batch.BatchServiceClient` :param str job_id: The ID for the job. :param str pool...
Creates a job with the specified ID, associated with the specified pool. :param batch_service_client: A Batch service client. :type batch_service_client: `azure.batch.BatchServiceClient` :param str job_id: The ID for the job. :param str pool_id: The ID for the pool.
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/extra/azure_batch.py#L234-L252
ecell/ecell4
ecell4/extra/azure_batch.py
add_tasks
def add_tasks(batch_service_client, job_id, loads, output_container_name, output_container_sas_token, task_file, acount_name): """Adds a task for each input file in the collection to the specified job. :param batch_service_client: A Batch service client. :type batch_service_clie...
python
def add_tasks(batch_service_client, job_id, loads, output_container_name, output_container_sas_token, task_file, acount_name): """Adds a task for each input file in the collection to the specified job. :param batch_service_client: A Batch service client. :type batch_service_clie...
Adds a task for each input file in the collection to the specified job. :param batch_service_client: A Batch service client. :type batch_service_client: `azure.batch.BatchServiceClient` :param str job_id: The ID of the job to which to add the tasks. :param list input_files: A collection of input files....
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/extra/azure_batch.py#L254-L302
ecell/ecell4
ecell4/extra/azure_batch.py
wait_for_tasks_to_complete
def wait_for_tasks_to_complete(batch_service_client, job_ids, timeout): """Returns when all tasks in the specified job reach the Completed state. :param batch_service_client: A Batch service client. :type batch_service_client: `azure.batch.BatchServiceClient` :param str job_id: The id of the job whose ...
python
def wait_for_tasks_to_complete(batch_service_client, job_ids, timeout): """Returns when all tasks in the specified job reach the Completed state. :param batch_service_client: A Batch service client. :type batch_service_client: `azure.batch.BatchServiceClient` :param str job_id: The id of the job whose ...
Returns when all tasks in the specified job reach the Completed state. :param batch_service_client: A Batch service client. :type batch_service_client: `azure.batch.BatchServiceClient` :param str job_id: The id of the job whose tasks should be to monitored. :param timedelta timeout: The duration to wai...
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/extra/azure_batch.py#L304-L337
ecell/ecell4
ecell4/extra/azure_batch.py
download_blobs_from_container
def download_blobs_from_container(block_blob_client, container_name, directory_path, prefix=None): """Downloads all blobs from the specified Azure Blob storage container. :param block_blob_client: A blob service client. :type block_blob_cl...
python
def download_blobs_from_container(block_blob_client, container_name, directory_path, prefix=None): """Downloads all blobs from the specified Azure Blob storage container. :param block_blob_client: A blob service client. :type block_blob_cl...
Downloads all blobs from the specified Azure Blob storage container. :param block_blob_client: A blob service client. :type block_blob_client: `azure.storage.blob.BlockBlobService` :param container_name: The Azure Blob storage container from which to download files. :param directory_path: The loca...
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/extra/azure_batch.py#L339-L368
ecell/ecell4
ecell4/extra/azure_batch.py
_read_stream_as_string
def _read_stream_as_string(stream, encoding): """Read stream as string Originally in azure-batch-samples.Python.Batch.common.helpers :param stream: input stream generator :param str encoding: The encoding of the file. The default is utf-8. :return: The file content. :rtype: str """ outp...
python
def _read_stream_as_string(stream, encoding): """Read stream as string Originally in azure-batch-samples.Python.Batch.common.helpers :param stream: input stream generator :param str encoding: The encoding of the file. The default is utf-8. :return: The file content. :rtype: str """ outp...
Read stream as string Originally in azure-batch-samples.Python.Batch.common.helpers :param stream: input stream generator :param str encoding: The encoding of the file. The default is utf-8. :return: The file content. :rtype: str
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/extra/azure_batch.py#L370-L388
ecell/ecell4
ecell4/extra/azure_batch.py
read_task_file_as_string
def read_task_file_as_string( batch_client, job_id, task_id, file_name, encoding=None): """Reads the specified file as a string. Originally in azure-batch-samples.Python.Batch.common.helpers :param batch_client: The batch client to use. :type batch_client: `batchserviceclient.BatchServiceClient...
python
def read_task_file_as_string( batch_client, job_id, task_id, file_name, encoding=None): """Reads the specified file as a string. Originally in azure-batch-samples.Python.Batch.common.helpers :param batch_client: The batch client to use. :type batch_client: `batchserviceclient.BatchServiceClient...
Reads the specified file as a string. Originally in azure-batch-samples.Python.Batch.common.helpers :param batch_client: The batch client to use. :type batch_client: `batchserviceclient.BatchServiceClient` :param str job_id: The id of the job. :param str task_id: The id of the task. :param str ...
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/extra/azure_batch.py#L390-L405
ecell/ecell4
ecell4/extra/azure_batch.py
print_task_output
def print_task_output(batch_client, job_id, task_ids, encoding=None): """Prints the stdout and stderr for each task specified. Originally in azure-batch-samples.Python.Batch.common.helpers :param batch_client: The batch client to use. :type batch_client: `batchserviceclient.BatchServiceClient` :par...
python
def print_task_output(batch_client, job_id, task_ids, encoding=None): """Prints the stdout and stderr for each task specified. Originally in azure-batch-samples.Python.Batch.common.helpers :param batch_client: The batch client to use. :type batch_client: `batchserviceclient.BatchServiceClient` :par...
Prints the stdout and stderr for each task specified. Originally in azure-batch-samples.Python.Batch.common.helpers :param batch_client: The batch client to use. :type batch_client: `batchserviceclient.BatchServiceClient` :param str job_id: The id of the job to monitor. :param task_ids: The collect...
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/extra/azure_batch.py#L407-L439
ecell/ecell4
ecell4/extra/azure_batch.py
run_azure
def run_azure(target, jobs, n=1, path='.', delete=True, config=None): """Execute a function for multiple sets of arguments on Microsoft Azure, and return the results as a list. :param function target: A target function. :param list jobs: A list of sets of arguments given to the target. :param int n...
python
def run_azure(target, jobs, n=1, path='.', delete=True, config=None): """Execute a function for multiple sets of arguments on Microsoft Azure, and return the results as a list. :param function target: A target function. :param list jobs: A list of sets of arguments given to the target. :param int n...
Execute a function for multiple sets of arguments on Microsoft Azure, and return the results as a list. :param function target: A target function. :param list jobs: A list of sets of arguments given to the target. :param int n: The number of repeats running the target. 1 as default. :param str path...
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/extra/azure_batch.py#L441-L755
ecell/ecell4
ecell4/extra/azure_batch.py
singlerun
def singlerun(job, task_id=0, job_id=0): """This task is for an example.""" import ecell4_base import ecell4 import ecell4.util.simulation import ecell4.util.decorator print('ecell4_base.__version__ = {:s}'.format(ecell4_base.__version__)) print('ecell4.__version__ = {:s}'.format(ecell4.__v...
python
def singlerun(job, task_id=0, job_id=0): """This task is for an example.""" import ecell4_base import ecell4 import ecell4.util.simulation import ecell4.util.decorator print('ecell4_base.__version__ = {:s}'.format(ecell4_base.__version__)) print('ecell4.__version__ = {:s}'.format(ecell4.__v...
This task is for an example.
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/extra/azure_batch.py#L757-L779
ecell/ecell4
ecell4/util/viz.py
plot_number_observer
def plot_number_observer(*args, **kwargs): """ Generate a plot from NumberObservers and show it. See plot_number_observer_with_matplotlib and _with_nya for details. Parameters ---------- obs : NumberObserver (e.g. FixedIntervalNumberObserver) interactive : bool, default False Choose...
python
def plot_number_observer(*args, **kwargs): """ Generate a plot from NumberObservers and show it. See plot_number_observer_with_matplotlib and _with_nya for details. Parameters ---------- obs : NumberObserver (e.g. FixedIntervalNumberObserver) interactive : bool, default False Choose...
Generate a plot from NumberObservers and show it. See plot_number_observer_with_matplotlib and _with_nya for details. Parameters ---------- obs : NumberObserver (e.g. FixedIntervalNumberObserver) interactive : bool, default False Choose a visualizer. If False, show the plot with matplotlib....
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/util/viz.py#L28-L58
ecell/ecell4
ecell4/util/viz.py
plot_world
def plot_world(*args, **kwargs): """ Generate a plot from received instance of World and show it. See also plot_world_with_elegans and plot_world_with_matplotlib. Parameters ---------- world : World or str World or a HDF5 filename to render. interactive : bool, default True ...
python
def plot_world(*args, **kwargs): """ Generate a plot from received instance of World and show it. See also plot_world_with_elegans and plot_world_with_matplotlib. Parameters ---------- world : World or str World or a HDF5 filename to render. interactive : bool, default True ...
Generate a plot from received instance of World and show it. See also plot_world_with_elegans and plot_world_with_matplotlib. Parameters ---------- world : World or str World or a HDF5 filename to render. interactive : bool, default True Choose a visualizer. If False, show the plot ...
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/util/viz.py#L60-L83
ecell/ecell4
ecell4/util/viz.py
plot_movie
def plot_movie(*args, **kwargs): """ Generate a movie from received instances of World and show them. See also plot_movie_with_elegans and plot_movie_with_matplotlib. Parameters ---------- worlds : list of World Worlds to render. interactive : bool, default True Choose a vis...
python
def plot_movie(*args, **kwargs): """ Generate a movie from received instances of World and show them. See also plot_movie_with_elegans and plot_movie_with_matplotlib. Parameters ---------- worlds : list of World Worlds to render. interactive : bool, default True Choose a vis...
Generate a movie from received instances of World and show them. See also plot_movie_with_elegans and plot_movie_with_matplotlib. Parameters ---------- worlds : list of World Worlds to render. interactive : bool, default True Choose a visualizer. If False, show the plot with matplot...
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/util/viz.py#L85-L103
ecell/ecell4
ecell4/util/viz.py
plot_trajectory
def plot_trajectory(*args, **kwargs): """ Generate a plot from received instance of TrajectoryObserver and show it See also plot_trajectory_with_elegans and plot_trajectory_with_matplotlib. Parameters ---------- obs : TrajectoryObserver TrajectoryObserver to render. interactive : bo...
python
def plot_trajectory(*args, **kwargs): """ Generate a plot from received instance of TrajectoryObserver and show it See also plot_trajectory_with_elegans and plot_trajectory_with_matplotlib. Parameters ---------- obs : TrajectoryObserver TrajectoryObserver to render. interactive : bo...
Generate a plot from received instance of TrajectoryObserver and show it See also plot_trajectory_with_elegans and plot_trajectory_with_matplotlib. Parameters ---------- obs : TrajectoryObserver TrajectoryObserver to render. interactive : bool, default True Choose a visualizer. If F...
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/util/viz.py#L105-L128
ecell/ecell4
ecell4/util/viz.py
plot_number_observer_with_matplotlib
def plot_number_observer_with_matplotlib(*args, **kwargs): """ Generate a plot from NumberObservers and show it on IPython notebook with matplotlib. Parameters ---------- obs : NumberObserver (e.g. FixedIntervalNumberObserver) fmt : str, optional opt : dict, optional matplotlib ...
python
def plot_number_observer_with_matplotlib(*args, **kwargs): """ Generate a plot from NumberObservers and show it on IPython notebook with matplotlib. Parameters ---------- obs : NumberObserver (e.g. FixedIntervalNumberObserver) fmt : str, optional opt : dict, optional matplotlib ...
Generate a plot from NumberObservers and show it on IPython notebook with matplotlib. Parameters ---------- obs : NumberObserver (e.g. FixedIntervalNumberObserver) fmt : str, optional opt : dict, optional matplotlib plot options. Examples -------- >>> plot_number_observer(o...
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/util/viz.py#L130-L274
ecell/ecell4
ecell4/util/viz.py
plot_number_observer_with_nya
def plot_number_observer_with_nya(obs, config=None, width=600, height=400, x=None, y=None, to_png=False): """ Generate a plot from NumberObservers and show it on IPython notebook with nyaplot. Parameters ---------- obs : NumberObserver (e.g. FixedIntervalNumberObserver) config : dict, optio...
python
def plot_number_observer_with_nya(obs, config=None, width=600, height=400, x=None, y=None, to_png=False): """ Generate a plot from NumberObservers and show it on IPython notebook with nyaplot. Parameters ---------- obs : NumberObserver (e.g. FixedIntervalNumberObserver) config : dict, optio...
Generate a plot from NumberObservers and show it on IPython notebook with nyaplot. Parameters ---------- obs : NumberObserver (e.g. FixedIntervalNumberObserver) config : dict, optional A config data for coloring. The dictionary will be updated during this plot. width : int, optional ...
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/util/viz.py#L276-L350
ecell/ecell4
ecell4/util/viz.py
__parse_world
def __parse_world( world, radius=None, species_list=None, max_count=None, predicator=None): """ Private function to parse world. Return infomation about particles (name, coordinates and particle size) for each species. """ from ecell4_base.core import Species if species_list is...
python
def __parse_world( world, radius=None, species_list=None, max_count=None, predicator=None): """ Private function to parse world. Return infomation about particles (name, coordinates and particle size) for each species. """ from ecell4_base.core import Species if species_list is...
Private function to parse world. Return infomation about particles (name, coordinates and particle size) for each species.
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/util/viz.py#L352-L403
ecell/ecell4
ecell4/util/viz.py
plot_movie_with_elegans
def plot_movie_with_elegans( worlds, radius=None, width=500, height=500, config=None, grid=False, species_list=None): """ Generate a movie from received instances of World and show them on IPython notebook. Parameters ---------- worlds : list of World Worlds to render. ...
python
def plot_movie_with_elegans( worlds, radius=None, width=500, height=500, config=None, grid=False, species_list=None): """ Generate a movie from received instances of World and show them on IPython notebook. Parameters ---------- worlds : list of World Worlds to render. ...
Generate a movie from received instances of World and show them on IPython notebook. Parameters ---------- worlds : list of World Worlds to render. radius : float, default None If this value is set, all particles in the world will be rendered as if their radius are the same....
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/util/viz.py#L476-L539
ecell/ecell4
ecell4/util/viz.py
plot_world_with_elegans
def plot_world_with_elegans( world, radius=None, width=350, height=350, config=None, grid=True, wireframe=False, species_list=None, debug=None, max_count=1000, camera_position=(-22, 23, 32), camera_rotation=(-0.6, 0.5, 0.6), return_id=False, predicator=None): """ Generate a plot ...
python
def plot_world_with_elegans( world, radius=None, width=350, height=350, config=None, grid=True, wireframe=False, species_list=None, debug=None, max_count=1000, camera_position=(-22, 23, 32), camera_rotation=(-0.6, 0.5, 0.6), return_id=False, predicator=None): """ Generate a plot ...
Generate a plot from received instance of World and show it on IPython notebook. This method returns the instance of dict that indicates color setting for each speices. You can use the dict as the parameter of plot_world, in order to use the same colors in another plot. Parameters ---------- wo...
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/util/viz.py#L541-L648
ecell/ecell4
ecell4/util/viz.py
plot_dense_array
def plot_dense_array( arr, length=256, ranges=None, colors=("#a6cee3", "#fb9a99"), grid=False, camera_position=(-22, 23, 32), camera_rotation=(-0.6, 0.5, 0.6)): """ Volume renderer Parameters ---------- arr : list of numpy.array i.e. [array([[1,2,3], [2,3,4]]), array([[1,2,3]])] ...
python
def plot_dense_array( arr, length=256, ranges=None, colors=("#a6cee3", "#fb9a99"), grid=False, camera_position=(-22, 23, 32), camera_rotation=(-0.6, 0.5, 0.6)): """ Volume renderer Parameters ---------- arr : list of numpy.array i.e. [array([[1,2,3], [2,3,4]]), array([[1,2,3]])] ...
Volume renderer Parameters ---------- arr : list of numpy.array i.e. [array([[1,2,3], [2,3,4]]), array([[1,2,3]])] ranges : list of tuple ranges for x, y, and z axis i.e. [(-100, 100), (-100, 100), (-100, 100)] colors : list of string colors for species length : ...
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/util/viz.py#L705-L800
ecell/ecell4
ecell4/util/viz.py
generate_html
def generate_html(keywords, tmpl_path, package_name='ecell4.util'): """ Generate static html file from JSON model and its own id. Parameters ---------- model : dict JSON model from which ecell4.viz generates a plot. model_id : string Unique id for the plot. Returns ----...
python
def generate_html(keywords, tmpl_path, package_name='ecell4.util'): """ Generate static html file from JSON model and its own id. Parameters ---------- model : dict JSON model from which ecell4.viz generates a plot. model_id : string Unique id for the plot. Returns ----...
Generate static html file from JSON model and its own id. Parameters ---------- model : dict JSON model from which ecell4.viz generates a plot. model_id : string Unique id for the plot. Returns ------- html : A HTML object
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/util/viz.py#L802-L825
ecell/ecell4
ecell4/util/viz.py
plot_trajectory_with_elegans
def plot_trajectory_with_elegans( obs, width=350, height=350, config=None, grid=True, wireframe=False, max_count=10, camera_position=(-22, 23, 32), camera_rotation=(-0.6, 0.5, 0.6), plot_range=None): """ Generate a plot from received instance of TrajectoryObserver and show it on IPyt...
python
def plot_trajectory_with_elegans( obs, width=350, height=350, config=None, grid=True, wireframe=False, max_count=10, camera_position=(-22, 23, 32), camera_rotation=(-0.6, 0.5, 0.6), plot_range=None): """ Generate a plot from received instance of TrajectoryObserver and show it on IPyt...
Generate a plot from received instance of TrajectoryObserver and show it on IPython notebook. Parameters ---------- obs : TrajectoryObserver TrajectoryObserver to render. width : float, default 350 Width of the plotting area. height : float, default 350 Height of the plo...
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/util/viz.py#L828-L932
ecell/ecell4
ecell4/util/viz.py
plot_world_with_matplotlib
def plot_world_with_matplotlib( world, marker_size=3, figsize=6, grid=True, wireframe=False, species_list=None, max_count=1000, angle=None, legend=True, noaxis=False, **kwargs): """ Generate a plot from received instance of World and show it on IPython notebook. Parameters -----...
python
def plot_world_with_matplotlib( world, marker_size=3, figsize=6, grid=True, wireframe=False, species_list=None, max_count=1000, angle=None, legend=True, noaxis=False, **kwargs): """ Generate a plot from received instance of World and show it on IPython notebook. Parameters -----...
Generate a plot from received instance of World and show it on IPython notebook. Parameters ---------- world : World or str World to render. A HDF5 filename is also acceptable. marker_size : float, default 3 Marker size for all species. Size is passed to scatter function as argu...
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/util/viz.py#L1106-L1153
ecell/ecell4
ecell4/util/viz.py
plot_trajectory_with_matplotlib
def plot_trajectory_with_matplotlib( obs, max_count=10, figsize=6, legend=True, angle=None, wireframe=False, grid=True, noaxis=False, plot_range=None, **kwargs): """ Generate a plot from received instance of TrajectoryObserver and show it on IPython notebook. Parameters ---------- ...
python
def plot_trajectory_with_matplotlib( obs, max_count=10, figsize=6, legend=True, angle=None, wireframe=False, grid=True, noaxis=False, plot_range=None, **kwargs): """ Generate a plot from received instance of TrajectoryObserver and show it on IPython notebook. Parameters ---------- ...
Generate a plot from received instance of TrajectoryObserver and show it on IPython notebook. Parameters ---------- obs : TrajectoryObserver TrajectoryObserver to render. max_count : Integer, default 10 The maximum number of particles to show. If None, show all. figsize : float,...
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/util/viz.py#L1155-L1208
ecell/ecell4
ecell4/util/viz.py
plot_trajectory2d_with_matplotlib
def plot_trajectory2d_with_matplotlib( obs, plane='xy', max_count=10, figsize=6, legend=True, wireframe=False, grid=True, noaxis=False, plot_range=None, **kwargs): """ Make a 2D plot from received instance of TrajectoryObserver and show it on IPython notebook. Parameters ---------- ...
python
def plot_trajectory2d_with_matplotlib( obs, plane='xy', max_count=10, figsize=6, legend=True, wireframe=False, grid=True, noaxis=False, plot_range=None, **kwargs): """ Make a 2D plot from received instance of TrajectoryObserver and show it on IPython notebook. Parameters ---------- ...
Make a 2D plot from received instance of TrajectoryObserver and show it on IPython notebook. Parameters ---------- obs : TrajectoryObserver TrajectoryObserver to render. plane : str, default 'xy' 'xy', 'yz', 'zx'. max_count : Integer, default 10 The maximum number of par...
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/util/viz.py#L1243-L1304
ecell/ecell4
ecell4/util/viz.py
plot_movie_of_trajectory2d_with_matplotlib
def plot_movie_of_trajectory2d_with_matplotlib( obs, plane='xy', figsize=6, grid=True, wireframe=False, max_count=None, angle=None, noaxis=False, interval=0.16, repeat_delay=3000, stride=1, rotate=None, legend=True, output=None, crf=10, bitrate='1M', plot_range=None, **kwargs): """ ...
python
def plot_movie_of_trajectory2d_with_matplotlib( obs, plane='xy', figsize=6, grid=True, wireframe=False, max_count=None, angle=None, noaxis=False, interval=0.16, repeat_delay=3000, stride=1, rotate=None, legend=True, output=None, crf=10, bitrate='1M', plot_range=None, **kwargs): """ ...
Generate a move from the received list of instances of World, and show it on IPython notebook. This function may require ffmpeg. Parameters ---------- worlds : list or FixedIntervalHDF5Observer A list of Worlds to render. plane : str, default 'xy' 'xy', 'yz', 'zx'. figsize : flo...
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/util/viz.py#L1306-L1410
ecell/ecell4
ecell4/util/viz.py
plot_movie_of_trajectory_with_matplotlib
def plot_movie_of_trajectory_with_matplotlib( obs, figsize=6, grid=True, wireframe=False, max_count=None, angle=None, noaxis=False, interval=0.16, repeat_delay=3000, stride=1, rotate=None, legend=True, output=None, crf=10, bitrate='1M', plot_range=None, **kwargs): """ Generate a ...
python
def plot_movie_of_trajectory_with_matplotlib( obs, figsize=6, grid=True, wireframe=False, max_count=None, angle=None, noaxis=False, interval=0.16, repeat_delay=3000, stride=1, rotate=None, legend=True, output=None, crf=10, bitrate='1M', plot_range=None, **kwargs): """ Generate a ...
Generate a move from the received list of instances of World, and show it on IPython notebook. This function may require ffmpeg. Parameters ---------- worlds : list or FixedIntervalHDF5Observer A list of Worlds to render. marker_size : float, default 3 Marker size for all species. S...
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/util/viz.py#L1534-L1639
ecell/ecell4
ecell4/util/viz.py
plot_world_with_attractive_mpl
def plot_world_with_attractive_mpl( world, marker_size=6, figsize=6, grid=True, wireframe=False, species_list=None, max_count=1000, angle=None, legend=True, noaxis=False, whratio=1.33, scale=1.0, **kwargs): """ Generate a plot from received instance of World and show it on IPython notebo...
python
def plot_world_with_attractive_mpl( world, marker_size=6, figsize=6, grid=True, wireframe=False, species_list=None, max_count=1000, angle=None, legend=True, noaxis=False, whratio=1.33, scale=1.0, **kwargs): """ Generate a plot from received instance of World and show it on IPython notebo...
Generate a plot from received instance of World and show it on IPython notebook. Parameters ---------- world : World or str World to render. A HDF5 filename is also acceptable. marker_size : float, default 3 Marker size for all species. Size is passed to scatter function as argu...
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/util/viz.py#L1643-L1699
ecell/ecell4
ecell4/util/viz.py
plot_movie_with_attractive_mpl
def plot_movie_with_attractive_mpl( worlds, marker_size=6, figsize=6, grid=True, wireframe=False, species_list=None, max_count=None, angle=None, noaxis=False, interval=0.16, repeat_delay=3000, stride=1, rotate=None, legend=True, whratio=1.33, scale=1, output=None, crf=10, bitrate='1M', *...
python
def plot_movie_with_attractive_mpl( worlds, marker_size=6, figsize=6, grid=True, wireframe=False, species_list=None, max_count=None, angle=None, noaxis=False, interval=0.16, repeat_delay=3000, stride=1, rotate=None, legend=True, whratio=1.33, scale=1, output=None, crf=10, bitrate='1M', *...
Generate a move from the received list of instances of World, and show it on IPython notebook. This function may require ffmpeg. Parameters ---------- worlds : list or FixedIntervalHDF5Observer A list of Worlds to render. marker_size : float, default 3 Marker size for all species. S...
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/util/viz.py#L1774-L1906
ecell/ecell4
ecell4/util/viz.py
plot_world2d_with_matplotlib
def plot_world2d_with_matplotlib( world, plane='xy', marker_size=3, figsize=6, grid=True, wireframe=False, species_list=None, max_count=1000, angle=None, legend=True, noaxis=False, scale=1.0, **kwargs): """ Make a 2D plot from received instance of World and show it on IPython notebook. ...
python
def plot_world2d_with_matplotlib( world, plane='xy', marker_size=3, figsize=6, grid=True, wireframe=False, species_list=None, max_count=1000, angle=None, legend=True, noaxis=False, scale=1.0, **kwargs): """ Make a 2D plot from received instance of World and show it on IPython notebook. ...
Make a 2D plot from received instance of World and show it on IPython notebook. Parameters ---------- world : World or str World to render. A HDF5 filename is also acceptable. plane : str, default 'xy' 'xy', 'yz', 'zx'. marker_size : float, default 3 Marker size for all spec...
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/util/viz.py#L1908-L1974
ecell/ecell4
ecell4/util/viz.py
plot_movie2d_with_matplotlib
def plot_movie2d_with_matplotlib( worlds, plane='xy', marker_size=3, figsize=6, grid=True, wireframe=False, species_list=None, max_count=None, angle=None, noaxis=False, interval=0.16, repeat_delay=3000, stride=1, rotate=None, legend=True, scale=1, output=None, crf=10, bitrate='1M', **kwa...
python
def plot_movie2d_with_matplotlib( worlds, plane='xy', marker_size=3, figsize=6, grid=True, wireframe=False, species_list=None, max_count=None, angle=None, noaxis=False, interval=0.16, repeat_delay=3000, stride=1, rotate=None, legend=True, scale=1, output=None, crf=10, bitrate='1M', **kwa...
Generate a movie projected on the given plane from the received list of instances of World, and show it on IPython notebook. This function may require ffmpeg. Parameters ---------- worlds : list or FixedIntervalHDF5Observer A list of Worlds to render. plane : str, default 'xy' '...
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/util/viz.py#L1999-L2134
ecell/ecell4
ecell4/util/viz.py
plot_world_with_plotly
def plot_world_with_plotly(world, species_list=None, max_count=1000): """ Plot a World on IPython Notebook """ if isinstance(world, str): from .simulation import load_world world = load_world(world) if species_list is None: species_list = [sp.serial() for sp in world.list_sp...
python
def plot_world_with_plotly(world, species_list=None, max_count=1000): """ Plot a World on IPython Notebook """ if isinstance(world, str): from .simulation import load_world world = load_world(world) if species_list is None: species_list = [sp.serial() for sp in world.list_sp...
Plot a World on IPython Notebook
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/util/viz.py#L2136-L2182
ecell/ecell4
ecell4/extra/_unit.py
getUnitRegistry
def getUnitRegistry(length="meter", time="second", substance="item", volume=None, other=()): """Return a pint.UnitRegistry made compatible with ecell4. Parameters ---------- length : str, optional A default unit for '[length]'. 'meter' is its default. time : str, optional A default ...
python
def getUnitRegistry(length="meter", time="second", substance="item", volume=None, other=()): """Return a pint.UnitRegistry made compatible with ecell4. Parameters ---------- length : str, optional A default unit for '[length]'. 'meter' is its default. time : str, optional A default ...
Return a pint.UnitRegistry made compatible with ecell4. Parameters ---------- length : str, optional A default unit for '[length]'. 'meter' is its default. time : str, optional A default unit for '[time]'. 'second' is its default. substance : str, optional A default unit for...
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/extra/_unit.py#L32-L74
ecell/ecell4
ecell4/datasource/biogrid.py
biogridDataSource.interactor
def interactor(self, geneList=None, org=None): """ Supposing geneList returns an unique item. """ geneList = geneList or [] organisms = organisms or [] querydata = self.interactions(geneList, org) returnData = {} for i in querydata: if not ret...
python
def interactor(self, geneList=None, org=None): """ Supposing geneList returns an unique item. """ geneList = geneList or [] organisms = organisms or [] querydata = self.interactions(geneList, org) returnData = {} for i in querydata: if not ret...
Supposing geneList returns an unique item.
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/datasource/biogrid.py#L96-L109
ecell/ecell4
ecell4/datasource/psicquic.py
parse_psimitab
def parse_psimitab(content, fmt='tab27'): """https://code.google.com/archive/p/psimi/wikis/PsimiTab27Format.wiki """ columns = [ 'Unique identifier for interactor A', 'Unique identifier for interactor B', 'Alternative identifier for interactor A', 'Alternative identifier for ...
python
def parse_psimitab(content, fmt='tab27'): """https://code.google.com/archive/p/psimi/wikis/PsimiTab27Format.wiki """ columns = [ 'Unique identifier for interactor A', 'Unique identifier for interactor B', 'Alternative identifier for interactor A', 'Alternative identifier for ...
https://code.google.com/archive/p/psimi/wikis/PsimiTab27Format.wiki
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/datasource/psicquic.py#L176-L236
ecell/ecell4
ecell4/util/ports.py
export_sbml
def export_sbml(model, y0=None, volume=1.0, is_valid=True): """ Export a model as a SBMLDocument. Parameters ---------- model : NetworkModel y0 : dict Initial condition. volume : Real or Real3, optional A size of the simulation volume. 1 as a default. is_valid : bool, op...
python
def export_sbml(model, y0=None, volume=1.0, is_valid=True): """ Export a model as a SBMLDocument. Parameters ---------- model : NetworkModel y0 : dict Initial condition. volume : Real or Real3, optional A size of the simulation volume. 1 as a default. is_valid : bool, op...
Export a model as a SBMLDocument. Parameters ---------- model : NetworkModel y0 : dict Initial condition. volume : Real or Real3, optional A size of the simulation volume. 1 as a default. is_valid : bool, optional Check if the generated model is valid. True as a default.
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/util/ports.py#L31-L218
ecell/ecell4
ecell4/util/ports.py
save_sbml
def save_sbml(filename, model, y0=None, volume=1.0, is_valid=True): """ Save a model in the SBML format. Parameters ---------- model : NetworkModel y0 : dict Initial condition. volume : Real or Real3, optional A size of the simulation volume. is_valid : bool, optional ...
python
def save_sbml(filename, model, y0=None, volume=1.0, is_valid=True): """ Save a model in the SBML format. Parameters ---------- model : NetworkModel y0 : dict Initial condition. volume : Real or Real3, optional A size of the simulation volume. is_valid : bool, optional ...
Save a model in the SBML format. Parameters ---------- model : NetworkModel y0 : dict Initial condition. volume : Real or Real3, optional A size of the simulation volume. is_valid : bool, optional Check if the generated model is valid. True as a default.
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/util/ports.py#L220-L245
ecell/ecell4
ecell4/util/ports.py
import_sbml
def import_sbml(document): """ Import a model from a SBMLDocument. Parameters ---------- document : SBMLDocument Returns ------- model : NetworkModel y0 : dict Initial condition. volume : Real or Real3, optional A size of the simulation volume. """ from...
python
def import_sbml(document): """ Import a model from a SBMLDocument. Parameters ---------- document : SBMLDocument Returns ------- model : NetworkModel y0 : dict Initial condition. volume : Real or Real3, optional A size of the simulation volume. """ from...
Import a model from a SBMLDocument. Parameters ---------- document : SBMLDocument Returns ------- model : NetworkModel y0 : dict Initial condition. volume : Real or Real3, optional A size of the simulation volume.
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/util/ports.py#L252-L375
ecell/ecell4
ecell4/util/ports.py
load_sbml
def load_sbml(filename): """ Load a model from a SBML file. Parameters ---------- filename : str The input SBML filename. Returns ------- model : NetworkModel y0 : dict Initial condition. volume : Real or Real3, optional A size of the simulation volume. ...
python
def load_sbml(filename): """ Load a model from a SBML file. Parameters ---------- filename : str The input SBML filename. Returns ------- model : NetworkModel y0 : dict Initial condition. volume : Real or Real3, optional A size of the simulation volume. ...
Load a model from a SBML file. Parameters ---------- filename : str The input SBML filename. Returns ------- model : NetworkModel y0 : dict Initial condition. volume : Real or Real3, optional A size of the simulation volume.
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/util/ports.py#L377-L411
ecell/ecell4
ecell4/util/decorator.py
get_model
def get_model(is_netfree=False, without_reset=False, seeds=None, effective=False): """ Generate a model with parameters in the global scope, ``SPECIES_ATTRIBUTES`` and ``REACTIONRULES``. Parameters ---------- is_netfree : bool, optional Return ``NetfreeModel`` if True, and ``NetworkMode...
python
def get_model(is_netfree=False, without_reset=False, seeds=None, effective=False): """ Generate a model with parameters in the global scope, ``SPECIES_ATTRIBUTES`` and ``REACTIONRULES``. Parameters ---------- is_netfree : bool, optional Return ``NetfreeModel`` if True, and ``NetworkMode...
Generate a model with parameters in the global scope, ``SPECIES_ATTRIBUTES`` and ``REACTIONRULES``. Parameters ---------- is_netfree : bool, optional Return ``NetfreeModel`` if True, and ``NetworkModel`` if else. Default is False. without_reset : bool, optional Do not reset ...
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/util/decorator.py#L143-L194
ecell/ecell4
ecell4/extra/ensemble.py
run_serial
def run_serial(target, jobs, n=1, **kwargs): """ Evaluate the given function with each set of arguments, and return a list of results. This function does in series. Parameters ---------- target : function A function to be evaluated. The function must accepts three arguments, whi...
python
def run_serial(target, jobs, n=1, **kwargs): """ Evaluate the given function with each set of arguments, and return a list of results. This function does in series. Parameters ---------- target : function A function to be evaluated. The function must accepts three arguments, whi...
Evaluate the given function with each set of arguments, and return a list of results. This function does in series. Parameters ---------- target : function A function to be evaluated. The function must accepts three arguments, which are a list of arguments given as `jobs`, a job and tas...
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/extra/ensemble.py#L22-L71
ecell/ecell4
ecell4/extra/ensemble.py
run_multiprocessing
def run_multiprocessing(target, jobs, n=1, nproc=None, **kwargs): """ Evaluate the given function with each set of arguments, and return a list of results. This function does in parallel by using `multiprocessing`. Parameters ---------- target : function A function to be evaluated. The ...
python
def run_multiprocessing(target, jobs, n=1, nproc=None, **kwargs): """ Evaluate the given function with each set of arguments, and return a list of results. This function does in parallel by using `multiprocessing`. Parameters ---------- target : function A function to be evaluated. The ...
Evaluate the given function with each set of arguments, and return a list of results. This function does in parallel by using `multiprocessing`. Parameters ---------- target : function A function to be evaluated. The function must accepts three arguments, which are a list of arguments g...
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/extra/ensemble.py#L73-L147
ecell/ecell4
ecell4/extra/ensemble.py
run_sge
def run_sge(target, jobs, n=1, nproc=None, path='.', delete=True, wait=True, environ=None, modules=(), **kwargs): """ Evaluate the given function with each set of arguments, and return a list of results. This function does in parallel on the Sun Grid Engine einvironment. Parameters ---------- t...
python
def run_sge(target, jobs, n=1, nproc=None, path='.', delete=True, wait=True, environ=None, modules=(), **kwargs): """ Evaluate the given function with each set of arguments, and return a list of results. This function does in parallel on the Sun Grid Engine einvironment. Parameters ---------- t...
Evaluate the given function with each set of arguments, and return a list of results. This function does in parallel on the Sun Grid Engine einvironment. Parameters ---------- target : function A function to be evaluated. The function must accepts three arguments, which are a list of ar...
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/extra/ensemble.py#L149-L323
ecell/ecell4
ecell4/extra/ensemble.py
run_azure
def run_azure(target, jobs, n=1, nproc=None, path='.', delete=True, config=None, **kwargs): """ Evaluate the given function with each set of arguments, and return a list of results. This function does in parallel with Microsoft Azure Batch. This function is the work in progress. The argument `nproc...
python
def run_azure(target, jobs, n=1, nproc=None, path='.', delete=True, config=None, **kwargs): """ Evaluate the given function with each set of arguments, and return a list of results. This function does in parallel with Microsoft Azure Batch. This function is the work in progress. The argument `nproc...
Evaluate the given function with each set of arguments, and return a list of results. This function does in parallel with Microsoft Azure Batch. This function is the work in progress. The argument `nproc` doesn't work yet. See `ecell4.extra.azure_batch.run_azure` for details. See Also --------...
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/extra/ensemble.py#L503-L523
ecell/ecell4
ecell4/extra/ensemble.py
getseed
def getseed(myseed, i): """ Return a single seed from a long seed given by `genseeds`. Parameters ---------- myseed : bytes A long seed given by `genseeds(n)`. i : int An index less than n. Returns ------- rndseed : int A seed (less than (2 ** 31)) """ ...
python
def getseed(myseed, i): """ Return a single seed from a long seed given by `genseeds`. Parameters ---------- myseed : bytes A long seed given by `genseeds(n)`. i : int An index less than n. Returns ------- rndseed : int A seed (less than (2 ** 31)) """ ...
Return a single seed from a long seed given by `genseeds`. Parameters ---------- myseed : bytes A long seed given by `genseeds(n)`. i : int An index less than n. Returns ------- rndseed : int A seed (less than (2 ** 31))
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/extra/ensemble.py#L543-L562
ecell/ecell4
ecell4/extra/ensemble.py
list_species
def list_species(model, seeds=None): """This function is deprecated.""" seeds = None or [] from ecell4_base.core import Species if not isinstance(seeds, list): seeds = list(seeds) expanded = model.expand([Species(serial) for serial in seeds]) species_list = [sp.serial() for sp in expa...
python
def list_species(model, seeds=None): """This function is deprecated.""" seeds = None or [] from ecell4_base.core import Species if not isinstance(seeds, list): seeds = list(seeds) expanded = model.expand([Species(serial) for serial in seeds]) species_list = [sp.serial() for sp in expa...
This function is deprecated.
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/extra/ensemble.py#L582-L594
ecell/ecell4
ecell4/extra/ensemble.py
ensemble_simulations
def ensemble_simulations( t, y0=None, volume=1.0, model=None, solver='ode', is_netfree=False, species_list=None, without_reset=False, return_type='matplotlib', opt_args=(), opt_kwargs=None, structures=None, rndseed=None, n=1, nproc=None, method=None, errorbar=True, **kwargs): """ Run sim...
python
def ensemble_simulations( t, y0=None, volume=1.0, model=None, solver='ode', is_netfree=False, species_list=None, without_reset=False, return_type='matplotlib', opt_args=(), opt_kwargs=None, structures=None, rndseed=None, n=1, nproc=None, method=None, errorbar=True, **kwargs): """ Run sim...
Run simulations multiple times and return its ensemble. Arguments are almost same with ``ecell4.util.simulation.run_simulation``. `observers` and `progressbar` is not available here. Parameters ---------- n : int, optional A number of runs. Default is 1. nproc : int, optional A ...
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/extra/ensemble.py#L597-L775
ecell/ecell4
ecell4/extra/bdml.py
save_bd5
def save_bd5( space, filename, group_index=0, object_name="molecule", spatial_unit="meter", time_unit="second", trunc=False, with_radius=False): """Save a space in the BDML-BD5 format (https://github.com/openssbd/BDML-BD5). Open file for read/write, if it already exists, and create a ne...
python
def save_bd5( space, filename, group_index=0, object_name="molecule", spatial_unit="meter", time_unit="second", trunc=False, with_radius=False): """Save a space in the BDML-BD5 format (https://github.com/openssbd/BDML-BD5). Open file for read/write, if it already exists, and create a ne...
Save a space in the BDML-BD5 format (https://github.com/openssbd/BDML-BD5). Open file for read/write, if it already exists, and create a new file, otherwise. If trunc is True, always create a new file. A new group named `group_name` is created. If the group already exists, returns an exception. Pa...
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/extra/bdml.py#L6-L53
dlon/html2markdown
html2markdown.py
_escapeCharacters
def _escapeCharacters(tag): """non-recursively escape underlines and asterisks in the tag""" for i,c in enumerate(tag.contents): if type(c) != bs4.element.NavigableString: continue c.replace_with(_escapeCharSub(r'\\\1', c))
python
def _escapeCharacters(tag): """non-recursively escape underlines and asterisks in the tag""" for i,c in enumerate(tag.contents): if type(c) != bs4.element.NavigableString: continue c.replace_with(_escapeCharSub(r'\\\1', c))
non-recursively escape underlines and asterisks in the tag
https://github.com/dlon/html2markdown/blob/5946da7136e69a67b3dd37fd0e896be4d6a5b482/html2markdown.py#L148-L154
dlon/html2markdown
html2markdown.py
_breakRemNewlines
def _breakRemNewlines(tag): """non-recursively break spaces and remove newlines in the tag""" for i,c in enumerate(tag.contents): if type(c) != bs4.element.NavigableString: continue c.replace_with(re.sub(r' {2,}', ' ', c).replace('\n',''))
python
def _breakRemNewlines(tag): """non-recursively break spaces and remove newlines in the tag""" for i,c in enumerate(tag.contents): if type(c) != bs4.element.NavigableString: continue c.replace_with(re.sub(r' {2,}', ' ', c).replace('\n',''))
non-recursively break spaces and remove newlines in the tag
https://github.com/dlon/html2markdown/blob/5946da7136e69a67b3dd37fd0e896be4d6a5b482/html2markdown.py#L156-L161
dlon/html2markdown
html2markdown.py
_markdownify
def _markdownify(tag, _listType=None, _blockQuote=False, _listIndex=1): """recursively converts a tag into markdown""" children = tag.find_all(recursive=False) if tag.name == '[document]': for child in children: _markdownify(child) return if tag.name not in _supportedTags or not _supportedAttrs(tag): if ...
python
def _markdownify(tag, _listType=None, _blockQuote=False, _listIndex=1): """recursively converts a tag into markdown""" children = tag.find_all(recursive=False) if tag.name == '[document]': for child in children: _markdownify(child) return if tag.name not in _supportedTags or not _supportedAttrs(tag): if ...
recursively converts a tag into markdown
https://github.com/dlon/html2markdown/blob/5946da7136e69a67b3dd37fd0e896be4d6a5b482/html2markdown.py#L163-L330
dlon/html2markdown
html2markdown.py
convert
def convert(html): """converts an html string to markdown while preserving unsupported markup.""" bs = BeautifulSoup(html, 'html.parser') _markdownify(bs) ret = unicode(bs).replace(u'\xa0', '&nbsp;') ret = re.sub(r'\n{3,}', r'\n\n', ret) # ! FIXME: hack ret = re.sub(r'&lt;&lt;&lt;FLOATING LINK: (.+)&gt;&gt;&gt;'...
python
def convert(html): """converts an html string to markdown while preserving unsupported markup.""" bs = BeautifulSoup(html, 'html.parser') _markdownify(bs) ret = unicode(bs).replace(u'\xa0', '&nbsp;') ret = re.sub(r'\n{3,}', r'\n\n', ret) # ! FIXME: hack ret = re.sub(r'&lt;&lt;&lt;FLOATING LINK: (.+)&gt;&gt;&gt;'...
converts an html string to markdown while preserving unsupported markup.
https://github.com/dlon/html2markdown/blob/5946da7136e69a67b3dd37fd0e896be4d6a5b482/html2markdown.py#L332-L347
timknip/pyswf
swf/filters.py
SWFFilterFactory.create
def create(cls, type): """ Return the specified Filter """ if type == 0: return FilterDropShadow(id) elif type == 1: return FilterBlur(id) elif type == 2: return FilterGlow(id) elif type == 3: return FilterBevel(id) elif type == 4: return FilterGradientGlow(id) el...
python
def create(cls, type): """ Return the specified Filter """ if type == 0: return FilterDropShadow(id) elif type == 1: return FilterBlur(id) elif type == 2: return FilterGlow(id) elif type == 3: return FilterBevel(id) elif type == 4: return FilterGradientGlow(id) el...
Return the specified Filter
https://github.com/timknip/pyswf/blob/3740cc80d7650156831e728ea0d408819e5671eb/swf/filters.py#L220-L231
timknip/pyswf
swf/data.py
SWFRectangle.dimensions
def dimensions(self): """ Returns dimensions as (x, y) tuple. """ return (self.xmax - self.xmin, self.ymax - self.ymin)
python
def dimensions(self): """ Returns dimensions as (x, y) tuple. """ return (self.xmax - self.xmin, self.ymax - self.ymin)
Returns dimensions as (x, y) tuple.
https://github.com/timknip/pyswf/blob/3740cc80d7650156831e728ea0d408819e5671eb/swf/data.py#L1000-L1004
timknip/pyswf
swf/movie.py
SWF.export
def export(self, exporter=None, force_stroke=False): """ Export this SWF using the specified exporter. When no exporter is passed in the default exporter used is swf.export.SVGExporter. Exporters should extend the swf.export.BaseExporter class. @param ...
python
def export(self, exporter=None, force_stroke=False): """ Export this SWF using the specified exporter. When no exporter is passed in the default exporter used is swf.export.SVGExporter. Exporters should extend the swf.export.BaseExporter class. @param ...
Export this SWF using the specified exporter. When no exporter is passed in the default exporter used is swf.export.SVGExporter. Exporters should extend the swf.export.BaseExporter class. @param exporter : the exporter to use @param force_stroke : set to true ...
https://github.com/timknip/pyswf/blob/3740cc80d7650156831e728ea0d408819e5671eb/swf/movie.py#L114-L131
timknip/pyswf
swf/movie.py
SWF.parse
def parse(self, data): """ Parses the SWF. The @data parameter can be a file object or a SWFStream """ self._data = data = data if isinstance(data, SWFStream) else SWFStream(data) self._header = SWFHeader(self._data) if self._header.compressed: ...
python
def parse(self, data): """ Parses the SWF. The @data parameter can be a file object or a SWFStream """ self._data = data = data if isinstance(data, SWFStream) else SWFStream(data) self._header = SWFHeader(self._data) if self._header.compressed: ...
Parses the SWF. The @data parameter can be a file object or a SWFStream
https://github.com/timknip/pyswf/blob/3740cc80d7650156831e728ea0d408819e5671eb/swf/movie.py#L137-L162
timknip/pyswf
swf/stream.py
int32
def int32(x): """ Return a signed or unsigned int """ if x>0xFFFFFFFF: raise OverflowError if x>0x7FFFFFFF: x=int(0x100000000-x) if x<2147483648: return -x else: return -2147483648 return x
python
def int32(x): """ Return a signed or unsigned int """ if x>0xFFFFFFFF: raise OverflowError if x>0x7FFFFFFF: x=int(0x100000000-x) if x<2147483648: return -x else: return -2147483648 return x
Return a signed or unsigned int
https://github.com/timknip/pyswf/blob/3740cc80d7650156831e728ea0d408819e5671eb/swf/stream.py#L490-L500
timknip/pyswf
swf/stream.py
SWFStream.bin
def bin(self, s): """ Return a value as a binary string """ return str(s) if s<=1 else bin(s>>1) + str(s&1)
python
def bin(self, s): """ Return a value as a binary string """ return str(s) if s<=1 else bin(s>>1) + str(s&1)
Return a value as a binary string
https://github.com/timknip/pyswf/blob/3740cc80d7650156831e728ea0d408819e5671eb/swf/stream.py#L22-L24
timknip/pyswf
swf/stream.py
SWFStream.calc_max_bits
def calc_max_bits(self, signed, values): """ Calculates the maximim needed bits to represent a value """ b = 0 vmax = -10000000 for val in values: if signed: b = b | val if val >= 0 else b | ~val << 1 vmax = val if vmax < val else vmax...
python
def calc_max_bits(self, signed, values): """ Calculates the maximim needed bits to represent a value """ b = 0 vmax = -10000000 for val in values: if signed: b = b | val if val >= 0 else b | ~val << 1 vmax = val if vmax < val else vmax...
Calculates the maximim needed bits to represent a value
https://github.com/timknip/pyswf/blob/3740cc80d7650156831e728ea0d408819e5671eb/swf/stream.py#L26-L42
timknip/pyswf
swf/stream.py
SWFStream.readbits
def readbits(self, bits): """ Read the specified number of bits from the stream. Returns 0 for bits == 0. """ if bits == 0: return 0 # fast byte-aligned path if bits % 8 == 0 and self._bits_pending == 0: return self._read_...
python
def readbits(self, bits): """ Read the specified number of bits from the stream. Returns 0 for bits == 0. """ if bits == 0: return 0 # fast byte-aligned path if bits % 8 == 0 and self._bits_pending == 0: return self._read_...
Read the specified number of bits from the stream. Returns 0 for bits == 0.
https://github.com/timknip/pyswf/blob/3740cc80d7650156831e728ea0d408819e5671eb/swf/stream.py#L56-L105
timknip/pyswf
swf/stream.py
SWFStream.readSB
def readSB(self, bits): """ Read a signed int using the specified number of bits """ shift = 32 - bits return int32(self.readbits(bits) << shift) >> shift
python
def readSB(self, bits): """ Read a signed int using the specified number of bits """ shift = 32 - bits return int32(self.readbits(bits) << shift) >> shift
Read a signed int using the specified number of bits
https://github.com/timknip/pyswf/blob/3740cc80d7650156831e728ea0d408819e5671eb/swf/stream.py#L111-L114
timknip/pyswf
swf/stream.py
SWFStream.readEncodedU32
def readEncodedU32(self): """ Read a encoded unsigned int """ self.reset_bits_pending(); result = self.readUI8(); if result & 0x80 != 0: result = (result & 0x7f) | (self.readUI8() << 7) if result & 0x4000 != 0: result = (result & 0x3fff) | (self.re...
python
def readEncodedU32(self): """ Read a encoded unsigned int """ self.reset_bits_pending(); result = self.readUI8(); if result & 0x80 != 0: result = (result & 0x7f) | (self.readUI8() << 7) if result & 0x4000 != 0: result = (result & 0x3fff) | (self.re...
Read a encoded unsigned int
https://github.com/timknip/pyswf/blob/3740cc80d7650156831e728ea0d408819e5671eb/swf/stream.py#L155-L167
timknip/pyswf
swf/stream.py
SWFStream.readFLOAT16
def readFLOAT16(self): """ Read a 2 byte float """ self.reset_bits_pending() word = self.readUI16() sign = -1 if ((word & 0x8000) != 0) else 1 exponent = (word >> 10) & 0x1f significand = word & 0x3ff if exponent == 0: if significand == 0: ...
python
def readFLOAT16(self): """ Read a 2 byte float """ self.reset_bits_pending() word = self.readUI16() sign = -1 if ((word & 0x8000) != 0) else 1 exponent = (word >> 10) & 0x1f significand = word & 0x3ff if exponent == 0: if significand == 0: ...
Read a 2 byte float
https://github.com/timknip/pyswf/blob/3740cc80d7650156831e728ea0d408819e5671eb/swf/stream.py#L174-L192
timknip/pyswf
swf/stream.py
SWFStream.readSTYLECHANGERECORD
def readSTYLECHANGERECORD(self, states, fill_bits, line_bits, level = 1): """ Read a SWFShapeRecordStyleChange """ return SWFShapeRecordStyleChange(self, states, fill_bits, line_bits, level)
python
def readSTYLECHANGERECORD(self, states, fill_bits, line_bits, level = 1): """ Read a SWFShapeRecordStyleChange """ return SWFShapeRecordStyleChange(self, states, fill_bits, line_bits, level)
Read a SWFShapeRecordStyleChange
https://github.com/timknip/pyswf/blob/3740cc80d7650156831e728ea0d408819e5671eb/swf/stream.py#L263-L265
timknip/pyswf
swf/stream.py
SWFStream.readTEXTRECORD
def readTEXTRECORD(self, glyphBits, advanceBits, previousRecord=None, level=1): """ Read a SWFTextRecord """ if self.readUI8() == 0: return None else: self.seek(self.tell() - 1) return SWFTextRecord(self, glyphBits, advanceBits, previousRecord, level)
python
def readTEXTRECORD(self, glyphBits, advanceBits, previousRecord=None, level=1): """ Read a SWFTextRecord """ if self.readUI8() == 0: return None else: self.seek(self.tell() - 1) return SWFTextRecord(self, glyphBits, advanceBits, previousRecord, level)
Read a SWFTextRecord
https://github.com/timknip/pyswf/blob/3740cc80d7650156831e728ea0d408819e5671eb/swf/stream.py#L271-L277
timknip/pyswf
swf/stream.py
SWFStream.readACTIONRECORD
def readACTIONRECORD(self): """ Read a SWFActionRecord """ action = None actionCode = self.readUI8() if actionCode != 0: actionLength = self.readUI16() if actionCode >= 0x80 else 0 #print "0x%x"%actionCode, actionLength action = SWFActionFactory.create...
python
def readACTIONRECORD(self): """ Read a SWFActionRecord """ action = None actionCode = self.readUI8() if actionCode != 0: actionLength = self.readUI16() if actionCode >= 0x80 else 0 #print "0x%x"%actionCode, actionLength action = SWFActionFactory.create...
Read a SWFActionRecord
https://github.com/timknip/pyswf/blob/3740cc80d7650156831e728ea0d408819e5671eb/swf/stream.py#L307-L316
timknip/pyswf
swf/stream.py
SWFStream.readACTIONRECORDs
def readACTIONRECORDs(self): """ Read zero or more button records (zero-terminated) """ out = [] while 1: action = self.readACTIONRECORD() if action: out.append(action) else: break return out
python
def readACTIONRECORDs(self): """ Read zero or more button records (zero-terminated) """ out = [] while 1: action = self.readACTIONRECORD() if action: out.append(action) else: break return out
Read zero or more button records (zero-terminated)
https://github.com/timknip/pyswf/blob/3740cc80d7650156831e728ea0d408819e5671eb/swf/stream.py#L318-L327
timknip/pyswf
swf/stream.py
SWFStream.readCLIPACTIONRECORD
def readCLIPACTIONRECORD(self, version): """ Read a SWFClipActionRecord """ pos = self.tell() flags = self.readUI32() if version >= 6 else self.readUI16() if flags == 0: return None else: self.seek(pos) return SWFClipActionRecord(self, version)
python
def readCLIPACTIONRECORD(self, version): """ Read a SWFClipActionRecord """ pos = self.tell() flags = self.readUI32() if version >= 6 else self.readUI16() if flags == 0: return None else: self.seek(pos) return SWFClipActionRecord(self, version)
Read a SWFClipActionRecord
https://github.com/timknip/pyswf/blob/3740cc80d7650156831e728ea0d408819e5671eb/swf/stream.py#L333-L341
timknip/pyswf
swf/stream.py
SWFStream.readRGB
def readRGB(self): """ Read a RGB color """ self.reset_bits_pending(); r = self.readUI8() g = self.readUI8() b = self.readUI8() return (0xff << 24) | (r << 16) | (g << 8) | b
python
def readRGB(self): """ Read a RGB color """ self.reset_bits_pending(); r = self.readUI8() g = self.readUI8() b = self.readUI8() return (0xff << 24) | (r << 16) | (g << 8) | b
Read a RGB color
https://github.com/timknip/pyswf/blob/3740cc80d7650156831e728ea0d408819e5671eb/swf/stream.py#L347-L353
timknip/pyswf
swf/stream.py
SWFStream.readRGBA
def readRGBA(self): """ Read a RGBA color """ self.reset_bits_pending(); r = self.readUI8() g = self.readUI8() b = self.readUI8() a = self.readUI8() return (a << 24) | (r << 16) | (g << 8) | b
python
def readRGBA(self): """ Read a RGBA color """ self.reset_bits_pending(); r = self.readUI8() g = self.readUI8() b = self.readUI8() a = self.readUI8() return (a << 24) | (r << 16) | (g << 8) | b
Read a RGBA color
https://github.com/timknip/pyswf/blob/3740cc80d7650156831e728ea0d408819e5671eb/swf/stream.py#L355-L362
timknip/pyswf
swf/stream.py
SWFStream.readString
def readString(self): """ Read a string """ s = self.f.read(1) string = b"" while ord(s) > 0: string += s s = self.f.read(1) return string.decode()
python
def readString(self): """ Read a string """ s = self.f.read(1) string = b"" while ord(s) > 0: string += s s = self.f.read(1) return string.decode()
Read a string
https://github.com/timknip/pyswf/blob/3740cc80d7650156831e728ea0d408819e5671eb/swf/stream.py#L368-L375
timknip/pyswf
swf/stream.py
SWFStream.readFILTER
def readFILTER(self): """ Read a SWFFilter """ filterId = self.readUI8() filter = SWFFilterFactory.create(filterId) filter.parse(self) return filter
python
def readFILTER(self): """ Read a SWFFilter """ filterId = self.readUI8() filter = SWFFilterFactory.create(filterId) filter.parse(self) return filter
Read a SWFFilter
https://github.com/timknip/pyswf/blob/3740cc80d7650156831e728ea0d408819e5671eb/swf/stream.py#L377-L382
timknip/pyswf
swf/stream.py
SWFStream.readFILTERLIST
def readFILTERLIST(self): """ Read a length-prefixed list of FILTERs """ number = self.readUI8() return [self.readFILTER() for _ in range(number)]
python
def readFILTERLIST(self): """ Read a length-prefixed list of FILTERs """ number = self.readUI8() return [self.readFILTER() for _ in range(number)]
Read a length-prefixed list of FILTERs
https://github.com/timknip/pyswf/blob/3740cc80d7650156831e728ea0d408819e5671eb/swf/stream.py#L384-L387
timknip/pyswf
swf/stream.py
SWFStream.readBUTTONRECORDs
def readBUTTONRECORDs(self, version): """ Read zero or more button records (zero-terminated) """ out = [] while 1: button = self.readBUTTONRECORD(version) if button: out.append(button) else: break return out
python
def readBUTTONRECORDs(self, version): """ Read zero or more button records (zero-terminated) """ out = [] while 1: button = self.readBUTTONRECORD(version) if button: out.append(button) else: break return out
Read zero or more button records (zero-terminated)
https://github.com/timknip/pyswf/blob/3740cc80d7650156831e728ea0d408819e5671eb/swf/stream.py#L409-L418
timknip/pyswf
swf/stream.py
SWFStream.readBUTTONCONDACTIONSs
def readBUTTONCONDACTIONSs(self): """ Read zero or more button-condition actions """ out = [] while 1: action = self.readBUTTONCONDACTION() if action: out.append(action) else: break return out
python
def readBUTTONCONDACTIONSs(self): """ Read zero or more button-condition actions """ out = [] while 1: action = self.readBUTTONCONDACTION() if action: out.append(action) else: break return out
Read zero or more button-condition actions
https://github.com/timknip/pyswf/blob/3740cc80d7650156831e728ea0d408819e5671eb/swf/stream.py#L427-L436
timknip/pyswf
swf/stream.py
SWFStream.readtag_header
def readtag_header(self): """ Read a tag header """ pos = self.tell() tag_type_and_length = self.readUI16() tag_length = tag_type_and_length & 0x003f if tag_length == 0x3f: # The SWF10 spec sez that this is a signed int. # Shouldn't it be an unsigned int? ...
python
def readtag_header(self): """ Read a tag header """ pos = self.tell() tag_type_and_length = self.readUI16() tag_length = tag_type_and_length & 0x003f if tag_length == 0x3f: # The SWF10 spec sez that this is a signed int. # Shouldn't it be an unsigned int? ...
Read a tag header
https://github.com/timknip/pyswf/blob/3740cc80d7650156831e728ea0d408819e5671eb/swf/stream.py#L459-L468
timknip/pyswf
swf/stream.py
SWFStream.read
def read(self, count=0): """ Read """ return self.f.read(count) if count > 0 else self.f.read()
python
def read(self, count=0): """ Read """ return self.f.read(count) if count > 0 else self.f.read()
Read
https://github.com/timknip/pyswf/blob/3740cc80d7650156831e728ea0d408819e5671eb/swf/stream.py#L478-L480
timknip/pyswf
swf/tag.py
TagFactory.create
def create(cls, type): """ Return the created tag by specifying an integer """ if type == 0: return TagEnd() elif type == 1: return TagShowFrame() elif type == 2: return TagDefineShape() elif type == 4: return TagPlaceObject() elif type == 5: return TagRemoveObject() ...
python
def create(cls, type): """ Return the created tag by specifying an integer """ if type == 0: return TagEnd() elif type == 1: return TagShowFrame() elif type == 2: return TagDefineShape() elif type == 4: return TagPlaceObject() elif type == 5: return TagRemoveObject() ...
Return the created tag by specifying an integer
https://github.com/timknip/pyswf/blob/3740cc80d7650156831e728ea0d408819e5671eb/swf/tag.py#L18-L79