alt.hst.api.hstapp Module#

class HstBatchApp(avoidHwPreferences: bool = False)#

Bases: object

This class is used to start and close HyperStudy batch. It can be used as a context manager to ensure that HyperStudy is closed properly.

Example - Using HstBatchApp as a context manager#
with HstBatchApp(["-v", 2]) as hst:
    import alt.hst.api.session as session
    study = session.getStudy()
__enter__() HstBatchApp#

Implementation of object.__enter__ method so this class can be used as a context manager.

__exit__(exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None) None#

Implementation of object.__exit__ method so this class can be used as a context manager. If an exception caused the context to exit, then the parameters describe that exception.

Parameters:
  • exc_type (Optional[Type[BaseException]]) – The exception type.

  • exc_val (Optional[BaseException]) – The exception value.

  • exc_tb (Optional[TracebackType]) – The exception traceback.

close(checkState: bool = True) bool#

Close the HyperStudy API.

Parameters:

checkState (bool) – If True, check the state of the HyperStudy API before.

Returns:

True if the HyperStudy API is closed, False otherwise.

Raises:

Exception – If checkState is True and the HyperStudy API is in an invalid state.

start(options: Sequence[str] | None = None) bool#

Open the HyperStudy API.

Parameters:

options (Optional[Sequence[str]]) – Command line options to pass to the HyperStudy API.

Returns:

True if the HyperStudy API is opened, False otherwise.

Return type:

bool

Raises:

Exception – If the HyperStudy API is already opened.

usingExistingHyperStudyContext() bool#

Checks if the HyperStudy API is already opened.

Returns:

True if the HyperStudy API is already opened, False otherwise.

Return type:

bool