mxcubecore.HardwareObjects.Session#

Session hardware object.

Contains information regarding the current session and methods to access and manipulate this information.

Classes

Session(name)

class mxcubecore.HardwareObjects.Session.Session(name)[source]#

Bases: HardwareObject

get_base_data_directory()[source]#

Returns the base data directory taking the ‘contextual’ information into account, such as if the current user is inhouse.

Returns:

The base data path.

Return type:

str

get_base_image_directory()[source]#
Returns:

The base path for images.

Return type:

str

get_base_process_directory()[source]#
Returns:

The base path for processed data.

Return type:

str

get_default_prefix(sample_data_node=None, generic_name=False)[source]#

Returns the default prefix, using sample data such as the acronym as parts in the prefix.

Parameters:

sample_data_node (Sample) – The data node to get additional information from, (which will be added to the prefix).

Returns:

The default prefix.

Return type:

str

get_default_subdir(sample_data: dict) str[source]#

Gets the default sub-directory based on sample information

Parameters:

sample_data (dict) – Lims sample dictionary

Returns:

Sub-directory path string

Return type:

str

get_full_path(subdir: str = '', tag: str = '') Tuple[str, str][source]#

Returns the full path to both image and processed data. The path(s) returned will follow the convention:

<base_directory>/<subdir>/run_<NUMBER>_<tag>

Where NUMBER is a automatically sequential number and base_directory the path returned by get_base_image/process_directory

Parameters:
  • subdir (str) – subdirectory

  • tag (str) – tag for

Returns:

Tuple with the full path to image and processed data

Return type:

Tuple[str, str]

get_group_name()[source]#
Returns:

Name of user group

Return type:

str

get_image_directory(sub_dir: str = '') str[source]#

Returns the full path to images

Parameters:
  • subdir – sub directory relative to path returned by get_base_image_directory

  • sub_dir (str) –

Returns:

The full path to images.

Return type:

str

get_inhouse_user()[source]#
Returns:

The current inhouse user.

Return type:

tuple (<proposal_code>, <proposal_number>)

get_path_with_proposal_as_root(path: str) str[source]#

Strips the beginning of the path so that it starts with the proposal folder as root

Path:

The full path

Returns:

Path stripped so that it starts with proposal

Parameters:

path (str) –

Return type:

str

get_process_directory(sub_dir: str = '') str[source]#

Returns the full path to processed data,

Parameters:
  • subdir – sub directory relative to path returned by get_base_process_directory

  • sub_dir (str) –

Returns:

The full path to processed data.

Return type:

str

get_proposal()[source]#
Returns:

The proposal, ‘local-user’ if no proposal is available

Return type:

str

get_session_start_date()[source]#
Returns:

The session start date

Return type:

str

init()[source]#

‘public’ post-initialization method. Override as needed.

For ConfiguredObjects called after loading contained objects.

is_inhouse(proposal_code=None, proposal_number=None)[source]#

Determines if a given proposal is considered to be inhouse.

Parameters:
  • proposal_code (str) – Proposal code

  • proposal_number (str) – Proposal number

Returns:

True if the proposal is inhouse, otherwise False.

Return type:

bool

prepare_directories(_session)[source]#

Prepares directories required for the given session.

This method is a placeholder intended to be overridden in subclasses to implement logic for creating or preparing directories. By default, the method is empty and does not perform any actions nor raise errors, since its implementation may be skipped in some cases.

Parameters:

_session – The session object containing session-specific information.

set_session_start_date(start_date_str)[source]#
Parameters:

start_date_str (str) – The session start date

set_user_group(group_name)[source]#
Parameters:

group_name (str) – Name of user group