text
stringlengths
0
828
hlog.append(self.mean_field())
converging = (abs(hlog[-1] - hlog[-2]) > self.param['tol']).all() \
or (abs(self.restriction(self.param['lambda'], hlog[-1])) > self.param['tol']).all()
return hlog"
4880,"def restriction(self, lam, mean_field):
""""""Lagrange multiplier in lattice slave spin""""""
self.update_H(mean_field, lam)
restric = np.array([self.expected(op) - n for op, n in zip(self.oper['Sz+1/2'], self.param['populations'])])
return restric"
4881,"def others2db(file_path, file_type, is_copy, step_id, db_conn):
""""""Extract some meta-data from files (actually mostly from their paths) and stores it in a DB.
Arguments:
:param file_path: File path.
:param file_type: File type.
:param is_copy: Indicate if this file is a copy.
:param step_id: Step ID.
:param db_conn: Database connection.
:return:
""""""
logging.info(""Processing '%s'"" % file_path)
df = db_conn.db_session.query(db_conn.DataFile).filter_by(path=file_path).one_or_none()
if not df:
df = db_conn.DataFile(
path=file_path,
type=file_type,
is_copy=is_copy,
processing_step_id=step_id
)
db_conn.db_session.merge(df)
db_conn.db_session.commit()
else:
if file_type not in [None, '', df.type]:
df.type = file_type
db_conn.db_session.commit()
if is_copy not in [None, df.is_copy]:
df.is_copy = is_copy
db_conn.db_session.commit()
if step_id not in [None, df.processing_step_id]:
df.processing_step_id = step_id
db_conn.db_session.commit()"
4882,"def create_currency(cls, currency, **kwargs):
""""""Create Currency
Create a new Currency
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.create_currency(currency, async=True)
>>> result = thread.get()
:param async bool
:param Currency currency: Attributes of currency to create (required)
:return: Currency
If the method is called asynchronously,
returns the request thread.
""""""
kwargs['_return_http_data_only'] = True
if kwargs.get('async'):
return cls._create_currency_with_http_info(currency, **kwargs)
else:
(data) = cls._create_currency_with_http_info(currency, **kwargs)
return data"
4883,"def delete_currency_by_id(cls, currency_id, **kwargs):
""""""Delete Currency
Delete an instance of Currency by its ID.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.delete_currency_by_id(currency_id, async=True)
>>> result = thread.get()
:param async bool
:param str currency_id: ID of currency to delete. (required)
:return: None
If the method is called asynchronously,
returns the request thread.
""""""
kwargs['_return_http_data_only'] = True
if kwargs.get('async'):
return cls._delete_currency_by_id_with_http_info(currency_id, **kwargs)
else:
(data) = cls._delete_currency_by_id_with_http_info(currency_id, **kwargs)
return data"
4884,"def get_currency_by_id(cls, currency_id, **kwargs):
""""""Find Currency
Return single instance of Currency by its ID.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.get_currency_by_id(currency_id, async=True)
>>> result = thread.get()
:param async bool
:param str currency_id: ID of currency to return (required)
:return: Currency
If the method is called asynchronously,