4.2. mbl.analysis.level_statistic.LevelStatistic#

class mbl.analysis.level_statistic.LevelStatistic(raw_df=None)[source]#

Bases: object

Analyze the level statistic on \(K\)-rounds of experiment (disorder trials), with each having \(N\) levels,

\[\langle r \rangle = \mathbb{E}_{k, n}\, r_n^{(k)},\]

where \(r\) is the gap ratio parameter defined in gap_ratio().

Note that the order of taking average does matter when constraining in certain charge sector only, instead of the full spectrum.

Parameters

raw_df (pandas.core.frame.DataFrame) – The raw data. If provided, local queries will be executed. Default None to extract data from AWS Athena.

Examples

>>> agent = LevelStatistic()
>>> df = agent.fetch_gap_ratio()
__init__(raw_df=None)[source]#

Analyze the level statistic on \(K\)-rounds of experiment (disorder trials), with each having \(N\) levels,

\[\langle r \rangle = \mathbb{E}_{k, n}\, r_n^{(k)},\]

where \(r\) is the gap ratio parameter defined in gap_ratio().

Note that the order of taking average does matter when constraining in certain charge sector only, instead of the full spectrum.

Parameters

raw_df (Optional[pandas.core.frame.DataFrame]) – The raw data. If provided, local queries will be executed. Default None to extract data from AWS Athena.

Examples

>>> agent = LevelStatistic()
>>> df = agent.fetch_gap_ratio()

Methods

__init__([raw_df])

Analyze the level statistic on \(K\)-rounds of experiment (disorder trials), with each having \(N\) levels,

athena_query(n, h[, penalty, s_target, ...])

averaged_gap_ratio(df[, order])

check_modin_df()

df_cleaning()

disorder_average(df)

extract_gap(df)

Feed in the DataFrame obtained through either local_query() or athena_query(), then compute the energy gap and the gap ratio parameter.

fetch_gap_ratio(n, h[, chi, total_sz, ...])

gap_ratio(gap)

For k-th disorder trial, the gap ratio is defined as

level_average(df)

local_query(n, h[, penalty, s_target, seed, ...])

query_elements(n, h[, penalty, s_target, ...])

Attributes

raw_df

class Metadata(database: str = 'random_heisenberg', ed_table: str = 'ed', tsdrg_table: str = 'folding_tsdrg')[source]#

Bases: object

Parameters
  • database (str) –

  • ed_table (str) –

  • tsdrg_table (str) –

Return type

None

database: str = 'random_heisenberg'#
ed_table: str = 'ed'#
tsdrg_table: str = 'folding_tsdrg'#
__init__(database='random_heisenberg', ed_table='ed', tsdrg_table='folding_tsdrg')#
Parameters
  • database (str) –

  • ed_table (str) –

  • tsdrg_table (str) –

Return type

None

__init__(raw_df=None)[source]#

Analyze the level statistic on \(K\)-rounds of experiment (disorder trials), with each having \(N\) levels,

\[\langle r \rangle = \mathbb{E}_{k, n}\, r_n^{(k)},\]

where \(r\) is the gap ratio parameter defined in gap_ratio().

Note that the order of taking average does matter when constraining in certain charge sector only, instead of the full spectrum.

Parameters

raw_df (Optional[pandas.core.frame.DataFrame]) – The raw data. If provided, local queries will be executed. Default None to extract data from AWS Athena.

Examples

>>> agent = LevelStatistic()
>>> df = agent.fetch_gap_ratio()
property raw_df: pandas.core.frame.DataFrame#
classmethod query_elements(n, h, penalty=0.0, s_target=0, seed=None, chi=None, relative_offset=None, total_sz=None, tol=1e-12)[source]#
Parameters
  • n (int) –

  • h (float) –

  • penalty (float) –

  • s_target (int) –

  • seed (Optional[int]) –

  • chi (Optional[int]) –

  • relative_offset (Optional[float]) –

  • total_sz (Optional[int]) –

  • tol (float) –

Return type

List[str]

df_cleaning()[source]#
Parameters

func (Callable) –

local_query(n, h, penalty=0.0, s_target=0, seed=None, chi=None, relative_offset=None, total_sz=None, tol=1e-12)[source]#
Parameters
  • n (int) –

  • h (float) –

  • penalty (float) –

  • s_target (int) –

  • seed (int) –

  • chi (int) –

  • relative_offset (float) –

  • total_sz (int) –

  • tol (float) –

Return type

pandas.core.frame.DataFrame

classmethod athena_query(n, h, penalty=0.0, s_target=0, seed=None, chi=None, relative_offset=None, total_sz=None, tol=1e-12, **kwargs)[source]#
Parameters
  • n (int) –

  • h (float) –

  • penalty (float) –

  • s_target (int) –

  • seed (int) –

  • chi (int) –

  • relative_offset (float) –

  • total_sz (int) –

  • tol (float) –

Return type

pandas.core.frame.DataFrame

check_modin_df()[source]#
Parameters

func (Callable) –

classmethod extract_gap(df)[source]#

Feed in the DataFrame obtained through either local_query() or athena_query(), then compute the energy gap and the gap ratio parameter.

Parameters

df (modin.pandas.dataframe.DataFrame) –

Return type

modin.pandas.dataframe.DataFrame

Returns:

static gap_ratio(gap)[source]#

For k-th disorder trial, the gap ratio is defined as

\[r_n^{(k)} = \min\left( \frac{\delta_n}{\delta_{n+1}}, \frac{\delta_{n+1}}{\delta_n} \right),\]

where \(\delta_n = E_{n+1} - E_n\) is the n-th energy gap.

Parameters

gap (numpy.ndarray) –

Return type

numpy.ndarray

Returns:

classmethod level_average(df)[source]#
Parameters

df (modin.pandas.dataframe.DataFrame) –

Return type

modin.pandas.series.Series

classmethod disorder_average(df)[source]#
Parameters

df (modin.pandas.dataframe.DataFrame) –

Return type

modin.pandas.series.Series

classmethod averaged_gap_ratio(df, order=AverageOrder.LEVEL_FIRST)[source]#
Parameters
Return type

float

classmethod fetch_gap_ratio(n, h, chi=None, total_sz=None, relative_offset=None, order=AverageOrder.LEVEL_FIRST)[source]#
Parameters
Return type

float