neuralib.util.verbose

neuralib.util.verbose.fprint(*msgs, vtype='info', timestamp=True, **kwarg)[source]

Formatting print with different colors based on verbose type

Parameters:
  • msgs – print message

  • vtype (Literal['info', 'io', 'warning', 'error', 'pass', 'debug'] | str) – verbose type

  • timestamp (bool) – If add time info

Return type:

None

neuralib.util.verbose.printdf(df, nrows=None, ncols=None, do_print=True, **kwargs)[source]

print dataframe with given row numbers (polars) if isinstance pandas dataframe, print all.

Parameters:
  • df (DataFrame | DataFrame) – polars or pandas dataframe

  • nrows (int | None) – number of rows (applicable in polars case)

  • ncols (int | None) – number of columns

  • do_print (bool) – do print otherwise, only return the str

  • kwargs – additional arguments pass the pl.Config()

Returns:

Return type:

str

neuralib.util.verbose.print_h5py(group, indent=0)[source]
Parameters:
  • group (Group | str | Path | bytes | BinaryIO | BufferedIOBase | BufferedReader)

  • indent (int)

Return type:

None

neuralib.util.verbose.print_load(file, verb='LOAD')[source]

print message for loading file.

If file is not existed, ‘!’ will add after verb. File load message doesn’t print twice and more if it shows continuously, so it is okay that wrap a loading method and call print_load() on target file.

use flag “load”.

Parameters:
  • file (str | Path | bytes | BinaryIO | BufferedIOBase | BufferedReader) – file path

  • verb – default ‘LOAD’

Returns:

file

Return type:

Path

neuralib.util.verbose.print_save(file, verb='SAVE')[source]

print message for saving file.

If file is not existed, ‘+’ will add after verb. File save message doesn’t print twice and more if it shows continuously, so it is okay that wrap a saving method and call print_load() on target file.

use flag “save”.

Parameters:
  • file (str | Path | bytes | BinaryIO | BufferedIOBase | BufferedReader) – file path

  • verb – default ‘SAVE’

Returns:

file

Return type:

Path

neuralib.util.verbose.publish_annotation(level, *, project=None, figure=None, caption=None, as_doc=False, as_attributes=True)[source]

Annotation for knowing the class/function using scenario in paper publication

Parameters:
  • level (Literal['main', 'sup', 'appendix', 'test']) – {‘main’, ‘sup’, ‘appendix’, ‘test’}

  • project (list[str] | str | None) – Project name or list of project name

  • figure (list[str] | str | None) – Figure number or list of figure name

  • caption (str | None) – Other caption

  • as_doc (bool) – As documents, be able to parser the .. note:: block by Sphinx

  • as_attributes (bool) – If set info as attributes

Returns: