hexsha
string
size
int64
ext
string
lang
string
max_stars_repo_path
string
max_stars_repo_name
string
max_stars_repo_head_hexsha
string
max_stars_repo_licenses
list
max_stars_count
int64
max_stars_repo_stars_event_min_datetime
string
max_stars_repo_stars_event_max_datetime
string
max_issues_repo_path
string
max_issues_repo_name
string
max_issues_repo_head_hexsha
string
max_issues_repo_licenses
list
max_issues_count
int64
max_issues_repo_issues_event_min_datetime
string
max_issues_repo_issues_event_max_datetime
string
max_forks_repo_path
string
max_forks_repo_name
string
max_forks_repo_head_hexsha
string
max_forks_repo_licenses
list
max_forks_count
int64
max_forks_repo_forks_event_min_datetime
string
max_forks_repo_forks_event_max_datetime
string
content
string
avg_line_length
float64
max_line_length
int64
alphanum_fraction
float64
qsc_code_num_words_quality_signal
int64
qsc_code_num_chars_quality_signal
float64
qsc_code_mean_word_length_quality_signal
float64
qsc_code_frac_words_unique_quality_signal
float64
qsc_code_frac_chars_top_2grams_quality_signal
float64
qsc_code_frac_chars_top_3grams_quality_signal
float64
qsc_code_frac_chars_top_4grams_quality_signal
float64
qsc_code_frac_chars_dupe_5grams_quality_signal
float64
qsc_code_frac_chars_dupe_6grams_quality_signal
float64
qsc_code_frac_chars_dupe_7grams_quality_signal
float64
qsc_code_frac_chars_dupe_8grams_quality_signal
float64
qsc_code_frac_chars_dupe_9grams_quality_signal
float64
qsc_code_frac_chars_dupe_10grams_quality_signal
float64
qsc_code_frac_chars_replacement_symbols_quality_signal
float64
qsc_code_frac_chars_digital_quality_signal
float64
qsc_code_frac_chars_whitespace_quality_signal
float64
qsc_code_size_file_byte_quality_signal
float64
qsc_code_num_lines_quality_signal
float64
qsc_code_num_chars_line_max_quality_signal
float64
qsc_code_num_chars_line_mean_quality_signal
float64
qsc_code_frac_chars_alphabet_quality_signal
float64
qsc_code_frac_chars_comments_quality_signal
float64
qsc_code_cate_xml_start_quality_signal
float64
qsc_code_frac_lines_dupe_lines_quality_signal
float64
qsc_code_cate_autogen_quality_signal
float64
qsc_code_frac_lines_long_string_quality_signal
float64
qsc_code_frac_chars_string_length_quality_signal
float64
qsc_code_frac_chars_long_word_length_quality_signal
float64
qsc_code_frac_lines_string_concat_quality_signal
float64
qsc_code_cate_encoded_data_quality_signal
float64
qsc_code_frac_chars_hex_words_quality_signal
float64
qsc_code_frac_lines_prompt_comments_quality_signal
float64
qsc_code_frac_lines_assert_quality_signal
float64
qsc_codepython_cate_ast_quality_signal
float64
qsc_codepython_frac_lines_func_ratio_quality_signal
float64
qsc_codepython_cate_var_zero_quality_signal
bool
qsc_codepython_frac_lines_pass_quality_signal
float64
qsc_codepython_frac_lines_import_quality_signal
float64
qsc_codepython_frac_lines_simplefunc_quality_signal
float64
qsc_codepython_score_lines_no_logic_quality_signal
float64
qsc_codepython_frac_lines_print_quality_signal
float64
qsc_code_num_words
int64
qsc_code_num_chars
int64
qsc_code_mean_word_length
int64
qsc_code_frac_words_unique
null
qsc_code_frac_chars_top_2grams
int64
qsc_code_frac_chars_top_3grams
int64
qsc_code_frac_chars_top_4grams
int64
qsc_code_frac_chars_dupe_5grams
int64
qsc_code_frac_chars_dupe_6grams
int64
qsc_code_frac_chars_dupe_7grams
int64
qsc_code_frac_chars_dupe_8grams
int64
qsc_code_frac_chars_dupe_9grams
int64
qsc_code_frac_chars_dupe_10grams
int64
qsc_code_frac_chars_replacement_symbols
int64
qsc_code_frac_chars_digital
int64
qsc_code_frac_chars_whitespace
int64
qsc_code_size_file_byte
int64
qsc_code_num_lines
int64
qsc_code_num_chars_line_max
int64
qsc_code_num_chars_line_mean
int64
qsc_code_frac_chars_alphabet
int64
qsc_code_frac_chars_comments
int64
qsc_code_cate_xml_start
int64
qsc_code_frac_lines_dupe_lines
int64
qsc_code_cate_autogen
int64
qsc_code_frac_lines_long_string
int64
qsc_code_frac_chars_string_length
int64
qsc_code_frac_chars_long_word_length
int64
qsc_code_frac_lines_string_concat
null
qsc_code_cate_encoded_data
int64
qsc_code_frac_chars_hex_words
int64
qsc_code_frac_lines_prompt_comments
int64
qsc_code_frac_lines_assert
int64
qsc_codepython_cate_ast
int64
qsc_codepython_frac_lines_func_ratio
int64
qsc_codepython_cate_var_zero
int64
qsc_codepython_frac_lines_pass
int64
qsc_codepython_frac_lines_import
int64
qsc_codepython_frac_lines_simplefunc
int64
qsc_codepython_score_lines_no_logic
int64
qsc_codepython_frac_lines_print
int64
effective
string
hits
int64
364b6cc7d99ce27f96771330179853de3c897972
28
py
Python
python/python-office-coffee-algorithm/app/coffee_pot.py
DEV3L/archive
652e37bf949cfcb2174b97ed5b7dbb6285a8dbe8
[ "Beerware" ]
null
null
null
python/python-office-coffee-algorithm/app/coffee_pot.py
DEV3L/archive
652e37bf949cfcb2174b97ed5b7dbb6285a8dbe8
[ "Beerware" ]
null
null
null
python/python-office-coffee-algorithm/app/coffee_pot.py
DEV3L/archive
652e37bf949cfcb2174b97ed5b7dbb6285a8dbe8
[ "Beerware" ]
null
null
null
class CoffeePot(): pass
9.333333
18
0.642857
3
28
6
1
0
0
0
0
0
0
0
0
0
0
0
0.25
28
2
19
14
0.857143
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0.5
0
0
0.5
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
0
0
0
0
0
5
3684aacfe0eb04d35043fdd7b02875fac72dfcee
84
py
Python
tests/file_fixtures/function_missing_args.py
typenil/typegripe
b773b7a67f682d92b477da20c057a4582118ca27
[ "MIT" ]
1
2020-06-29T02:59:34.000Z
2020-06-29T02:59:34.000Z
tests/file_fixtures/function_missing_args.py
typenil/typegripe
b773b7a67f682d92b477da20c057a4582118ca27
[ "MIT" ]
null
null
null
tests/file_fixtures/function_missing_args.py
typenil/typegripe
b773b7a67f682d92b477da20c057a4582118ca27
[ "MIT" ]
null
null
null
def fully_typed_function(this, thing) -> float: return len(this) / float(thing)
28
47
0.714286
12
84
4.833333
0.75
0
0
0
0
0
0
0
0
0
0
0
0.154762
84
2
48
42
0.816901
0
0
0
0
0
0
0
0
0
0
0
0
1
0.5
false
0
0
0.5
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
5
36ab4fb3cd692a055aebd54a897da127af0a433a
155
py
Python
sample_project/another_app/tasks/deep_down_tasks/one_dedicated_task.py
valyagolev/django-cloud-tasks
baacde0139ebe4cdc2e39dbe0963d8b7d5ca646a
[ "Apache-2.0" ]
2
2021-06-15T13:26:04.000Z
2022-01-27T15:46:07.000Z
sample_project/another_app/tasks/deep_down_tasks/one_dedicated_task.py
valyagolev/django-cloud-tasks
baacde0139ebe4cdc2e39dbe0963d8b7d5ca646a
[ "Apache-2.0" ]
8
2021-01-11T01:10:43.000Z
2022-02-23T22:29:39.000Z
sample_project/another_app/tasks/deep_down_tasks/one_dedicated_task.py
joaodaher/django-cloud-tasks
bc8ff94a281bda8b49ee73229d5ed5cacdd7a388
[ "Apache-2.0" ]
2
2021-01-05T14:38:14.000Z
2021-06-16T23:50:32.000Z
from django_cloud_tasks.tasks import Task class OneBigDedicatedTask(Task): def run(self, name): return f"Chuck Norris is better than {name}"
22.142857
52
0.729032
22
155
5.045455
0.863636
0
0
0
0
0
0
0
0
0
0
0
0.193548
155
6
53
25.833333
0.888
0
0
0
0
0
0.219355
0
0
0
0
0
0
1
0.25
false
0
0.25
0.25
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
5
36b12473fe38ce965085f3531cd8111c6595df1b
571
py
Python
tornado-restful-api/api/core/base_handler.py
eclipsegst/tornado-rest-api
52d946601b66f816cb5cf6648607edace61b542b
[ "MIT" ]
null
null
null
tornado-restful-api/api/core/base_handler.py
eclipsegst/tornado-rest-api
52d946601b66f816cb5cf6648607edace61b542b
[ "MIT" ]
null
null
null
tornado-restful-api/api/core/base_handler.py
eclipsegst/tornado-rest-api
52d946601b66f816cb5cf6648607edace61b542b
[ "MIT" ]
null
null
null
#!/usr/bin/env python #-------------------------------------------------------------- # Tornado restful api # # Date: 2016-04-26 # # Author: Zhaolong Zhong #-------------------------------------------------------------- import tornado.web class BaseHandler(tornado.web.RequestHandler): def initialize(self): pass def set_default_header(self): self.set_header("Content-Type", "application/json") @property def db(self): return self.application.db @property def user_dao(self): return self.application.user_dao
22.84
63
0.52014
56
571
5.214286
0.625
0.068493
0.09589
0.171233
0
0
0
0
0
0
0
0.016985
0.175131
571
25
64
22.84
0.602972
0.360771
0
0.166667
0
0
0.078212
0
0
0
0
0
0
1
0.333333
false
0.083333
0.083333
0.166667
0.666667
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
1
1
0
0
5
36c3cba9cf0d7ee801e42cd0b3576d3af1e8ad0c
106
py
Python
relay/relay_output.py
ihrigb/stagebuzzer
dbce1c5fa59a6f22e74d84ccc96d4d1a28a5b680
[ "Apache-2.0" ]
null
null
null
relay/relay_output.py
ihrigb/stagebuzzer
dbce1c5fa59a6f22e74d84ccc96d4d1a28a5b680
[ "Apache-2.0" ]
null
null
null
relay/relay_output.py
ihrigb/stagebuzzer
dbce1c5fa59a6f22e74d84ccc96d4d1a28a5b680
[ "Apache-2.0" ]
null
null
null
class RelayOutput: def enable_relay(self, name: str): pass def reset(self): pass
15.142857
38
0.584906
13
106
4.692308
0.769231
0
0
0
0
0
0
0
0
0
0
0
0.330189
106
6
39
17.666667
0.859155
0
0
0.4
0
0
0
0
0
0
0
0
0
1
0.4
false
0.4
0
0
0.6
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
1
0
0
5
36db59b040c98d3fde0070df9a9df5219fb825f8
94
py
Python
user/services/__init__.py
sharif-42/Style-Icon
26cd93cdd991588ce41f0032b033551f9f1a1bce
[ "MIT" ]
1
2022-01-01T11:51:30.000Z
2022-01-01T11:51:30.000Z
user/services/__init__.py
sharif-42/Style-Icon
26cd93cdd991588ce41f0032b033551f9f1a1bce
[ "MIT" ]
null
null
null
user/services/__init__.py
sharif-42/Style-Icon
26cd93cdd991588ce41f0032b033551f9f1a1bce
[ "MIT" ]
null
null
null
from .user_service import UserService from .user_login_log_service import UserLoginLogService
31.333333
55
0.893617
12
94
6.666667
0.666667
0.2
0
0
0
0
0
0
0
0
0
0
0.085106
94
2
56
47
0.930233
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
7fcc7b39e2d5006551a661ebae6d71b752d8f39e
94
py
Python
services/postgres/room/rollback_migrations.py
buckmaxwell/jukebox
3b04fd1e38e9d3f57d86cf6695bcc3d8e8126681
[ "MIT" ]
1
2020-08-11T16:19:49.000Z
2020-08-11T16:19:49.000Z
services/postgres/room/rollback_migrations.py
buckmaxwell/jukebox
3b04fd1e38e9d3f57d86cf6695bcc3d8e8126681
[ "MIT" ]
39
2020-05-06T05:27:19.000Z
2022-02-27T08:35:36.000Z
services/postgres/room/rollback_migrations.py
buckmaxwell/jukebox
3b04fd1e38e9d3f57d86cf6695bcc3d8e8126681
[ "MIT" ]
null
null
null
#!/usr/bin/env python3 from migrator import rollback_migrations rollback_migrations("room")
15.666667
40
0.808511
12
94
6.166667
0.833333
0.486486
0
0
0
0
0
0
0
0
0
0.011765
0.095745
94
5
41
18.8
0.858824
0.223404
0
0
0
0
0.055556
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
7fe5930a67ea81cbfaced803e87bcc61846b21d3
126
py
Python
ht/tip/admin.py
caoxuCarlos/htyw_ecust
90277333510de14d936153fa2b164efbc5d068b8
[ "MIT" ]
null
null
null
ht/tip/admin.py
caoxuCarlos/htyw_ecust
90277333510de14d936153fa2b164efbc5d068b8
[ "MIT" ]
null
null
null
ht/tip/admin.py
caoxuCarlos/htyw_ecust
90277333510de14d936153fa2b164efbc5d068b8
[ "MIT" ]
null
null
null
from django.contrib import admin from .models import Suggestion # Register your models here. admin.site.register(Suggestion)
21
32
0.81746
17
126
6.058824
0.647059
0
0
0
0
0
0
0
0
0
0
0
0.119048
126
6
33
21
0.927928
0.206349
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.666667
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
3d04c3d070c65cbfce9f2a399bc5e3b16da57445
78
py
Python
test.py
romaindudek/PyTranslation-Pot-Po-Mo
d162d1825a81793d8ab2d48c3d92c6d376573842
[ "MIT" ]
null
null
null
test.py
romaindudek/PyTranslation-Pot-Po-Mo
d162d1825a81793d8ab2d48c3d92c6d376573842
[ "MIT" ]
null
null
null
test.py
romaindudek/PyTranslation-Pot-Po-Mo
d162d1825a81793d8ab2d48c3d92c6d376573842
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- import locale print(_("C'est un truc à traduire"))
11.142857
36
0.602564
12
78
3.833333
1
0
0
0
0
0
0
0
0
0
0
0.015873
0.192308
78
7
36
11.142857
0.714286
0.269231
0
0
0
0
0.428571
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0.5
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
1
0
5
3d2f290c1151e9fb7a95d53f79df6cd76d7bff30
208
py
Python
daml_dit_ddit/subcommand_show.py
digital-asset/daml-dit-dd
99ff5c3eb40c9369bb5d6137e51d4a9aada267a6
[ "Apache-2.0" ]
null
null
null
daml_dit_ddit/subcommand_show.py
digital-asset/daml-dit-dd
99ff5c3eb40c9369bb5d6137e51d4a9aada267a6
[ "Apache-2.0" ]
null
null
null
daml_dit_ddit/subcommand_show.py
digital-asset/daml-dit-dd
99ff5c3eb40c9369bb5d6137e51d4a9aada267a6
[ "Apache-2.0" ]
null
null
null
from .common import \ load_dabl_meta, \ show_package_summary def subcommand_main(): dabl_meta = load_dabl_meta() show_package_summary(dabl_meta) def setup(sp): return subcommand_main
14.857143
35
0.725962
28
208
4.964286
0.535714
0.230216
0.172662
0.230216
0.431655
0.431655
0
0
0
0
0
0
0.201923
208
13
36
16
0.837349
0
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.125
0.125
0.5
0
1
0
0
null
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
5
3d5fa4f34b26eb5ff76e344c91ebfbaf1190b3eb
3,412
py
Python
dask/array/tests/test_linalg.py
gabrielelanaro/dask
b5827ec358adfe5ec5b72be732aecc10e4b08da6
[ "BSD-3-Clause" ]
null
null
null
dask/array/tests/test_linalg.py
gabrielelanaro/dask
b5827ec358adfe5ec5b72be732aecc10e4b08da6
[ "BSD-3-Clause" ]
null
null
null
dask/array/tests/test_linalg.py
gabrielelanaro/dask
b5827ec358adfe5ec5b72be732aecc10e4b08da6
[ "BSD-3-Clause" ]
1
2021-11-11T13:45:57.000Z
2021-11-11T13:45:57.000Z
from __future__ import absolute_import import pytest pytest.importorskip('numpy') import numpy as np from dask.array import from_array from dask.array.linalg import tsqr, svd_compressed def test_tsqr_regular_blocks(): m, n = 20, 10 mat = np.random.rand(m, n) data = from_array(mat, chunks=(10, n), name='A') q, r = tsqr(data) q = np.array(q) r = np.array(r) assert np.allclose(mat, np.dot(q, r)) # accuracy check assert np.allclose(np.eye(n, n), np.dot(q.T, q)) # q must be orthonormal assert np.all(r == np.triu(r)) # r must be upper triangular def test_tsqr_irregular_blocks(): m, n = 20, 10 mat = np.random.rand(m, n) data = from_array(mat, chunks=(3, n), name='A')[1:] mat2 = mat[1:, :] q, r = tsqr(data) q = np.array(q) r = np.array(r) assert np.allclose(mat2, np.dot(q, r)) # accuracy check assert np.allclose(np.eye(n, n), np.dot(q.T, q)) # q must be orthonormal assert np.all(r == np.triu(r)) # r must be upper triangular def test_tsqr_svd_regular_blocks(): m, n = 20, 10 mat = np.random.rand(m, n) data = from_array(mat, chunks=(10, n), name='A') u, s, vt = tsqr(data, compute_svd=True) u = np.array(u) s = np.array(s) vt = np.array(vt) usvt = np.dot(u, np.dot(np.diag(s), vt)) s_exact = np.linalg.svd(mat)[1] assert np.allclose(mat, usvt) # accuracy check assert np.allclose(np.eye(n, n), np.dot(u.T, u)) # u must be orthonormal assert np.allclose(np.eye(n, n), np.dot(vt, vt.T)) # v must be orthonormal assert np.allclose(s, s_exact) # s must contain the singular values def test_tsqr_svd_irregular_blocks(): m, n = 20, 10 mat = np.random.rand(m, n) data = from_array(mat, chunks=(3, n), name='A')[1:] mat2 = mat[1:, :] u, s, vt = tsqr(data, compute_svd=True) u = np.array(u) s = np.array(s) vt = np.array(vt) usvt = np.dot(u, np.dot(np.diag(s), vt)) s_exact = np.linalg.svd(mat2)[1] assert np.allclose(mat2, usvt) # accuracy check assert np.allclose(np.eye(n, n), np.dot(u.T, u)) # u must be orthonormal assert np.allclose(np.eye(n, n), np.dot(vt, vt.T)) # v must be orthonormal assert np.allclose(s, s_exact) # s must contain the singular values def test_svd_compressed(): m, n = 300, 250 r = 10 np.random.seed(1234) mat1 = np.random.randn(m, r) mat2 = np.random.randn(r, n) mat = mat1.dot(mat2) data = from_array(mat, chunks=(50, 50)) n_iter = 6 for i in range(n_iter): u, s, vt = svd_compressed(data, r) u = np.array(u) s = np.array(s) vt = np.array(vt) if i == 0: usvt = np.dot(u, np.dot(np.diag(s), vt)) else: usvt += np.dot(u, np.dot(np.diag(s), vt)) usvt /= n_iter tol = 2e-1 assert np.allclose(np.linalg.norm(mat - usvt), np.linalg.norm(mat), rtol=tol, atol=tol) # average accuracy check u, s, vt = svd_compressed(data, r) u = np.array(u)[:, :r] s = np.array(s)[:r] vt = np.array(vt)[:r, :] s_exact = np.linalg.svd(mat)[1] s_exact = s_exact[:r] assert np.allclose(np.eye(r, r), np.dot(u.T, u)) # u must be orthonormal assert np.allclose(np.eye(r, r), np.dot(vt, vt.T)) # v must be orthonormal assert np.allclose(s, s_exact) # s must contain the singular values
29.413793
79
0.589977
602
3,412
3.272425
0.141196
0.073096
0.129949
0.082234
0.754822
0.743655
0.743655
0.730964
0.730964
0.718274
0
0.022665
0.25
3,412
115
80
29.669565
0.747167
0.122216
0
0.556818
0
0
0.003024
0
0
0
0
0
0.204545
1
0.056818
false
0
0.068182
0
0.125
0
0
0
0
null
0
0
0
0
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
e9f4fba85d50d668eb69d02a38e255bfdb1f2321
117
py
Python
{{cookiecutter.repo_name}}/test/__init__.py
pattertj/python-best-practices-cookiecutter
007db3ee4f5ae174f1a0fb0eb1f3995a50ceebf9
[ "MIT" ]
2
2021-05-16T13:54:27.000Z
2021-11-16T01:54:08.000Z
{{cookiecutter.repo_name}}/test/__init__.py
pattertj/python-best-practices-cookiecutter
007db3ee4f5ae174f1a0fb0eb1f3995a50ceebf9
[ "MIT" ]
null
null
null
{{cookiecutter.repo_name}}/test/__init__.py
pattertj/python-best-practices-cookiecutter
007db3ee4f5ae174f1a0fb0eb1f3995a50ceebf9
[ "MIT" ]
null
null
null
import os import sys sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".", "{{cookiecutter.repo_name}}"))
23.4
94
0.709402
18
117
4.333333
0.666667
0.153846
0
0
0
0
0
0
0
0
0
0.009259
0.076923
117
4
95
29.25
0.712963
0
0
0
0
0
0.230769
0.222222
0
0
0
0
0
1
0
true
0
0.666667
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
180be5c758686d30b63e0ff35f7bbc9f7916b146
145
py
Python
Dataset/Leetcode/train/78/43.py
kkcookies99/UAST
fff81885aa07901786141a71e5600a08d7cb4868
[ "MIT" ]
null
null
null
Dataset/Leetcode/train/78/43.py
kkcookies99/UAST
fff81885aa07901786141a71e5600a08d7cb4868
[ "MIT" ]
null
null
null
Dataset/Leetcode/train/78/43.py
kkcookies99/UAST
fff81885aa07901786141a71e5600a08d7cb4868
[ "MIT" ]
null
null
null
class Solution: def XXX(self, nums: List[int]) -> List[List[int]]: return reduce(lambda x, y: x + [i + [y] for i in x], nums, [[]])
29
72
0.544828
24
145
3.291667
0.666667
0.177215
0
0
0
0
0
0
0
0
0
0
0.248276
145
4
73
36.25
0.724771
0
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0
0.333333
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
5
18128de1ce2323f913be84b18a4a3f1b61100b8a
74,618
py
Python
dev/IncompressibleLiquids/data_incompressible.py
perrante/coolprop
c67ecc570e545d624c18feaf2a01e48b63ae1501
[ "MIT" ]
12
2015-04-21T07:43:09.000Z
2021-11-09T08:35:58.000Z
dev/IncompressibleLiquids/data_incompressible.py
perrante/coolprop
c67ecc570e545d624c18feaf2a01e48b63ae1501
[ "MIT" ]
32
2015-01-04T05:05:05.000Z
2017-12-13T18:03:29.000Z
dev/IncompressibleLiquids/data_incompressible.py
perrante/coolprop
c67ecc570e545d624c18feaf2a01e48b63ae1501
[ "MIT" ]
8
2015-01-01T21:15:37.000Z
2020-08-05T13:31:50.000Z
import numpy class LiquidData(object): """ A base class that defines all the variables needed in order to make a proper fit. You can copy this code put in your data and some documentation for where the information came from. """ Name = None # Name of the current fluid Desc = None # Name of the current fluid Tmin = None # Minimum temperature in K TminPsat = None # Minimum saturation temperature in K Tmax = None # Maximum temperature in K T = None # Temperature for data points in K rho = None # Density in kg/m3 c_p = None # Heat capacity in J/(kg.K) lam = None # Thermal conductivity in W/(m.K) mu_dyn = None # Dynamic viscosity in Pa.s psat = None # Saturation pressure in Pa class Example(LiquidData): """ Heat transfer fluid TherminolD12 by Solutia """ Name = "Example" Tmin = -85 + 273.15 TminPsat= 40 + 273.15 Tmax = 260 + 273.15 T = numpy.array([ 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150])+273.15 # Kelvin rho = numpy.array([ 740, 733, 726, 717, 710, 702, 695, 687, 679, 670, 662]) # kg/m3 c_p = numpy.array([ 2235, 2280, 2326, 2361, 2406, 2445, 2485, 2528, 2571, 2607, 2645]) # J/kg-K lam = numpy.array([0.105, 0.104, 0.102, 0.100, 0.098, 0.096, 0.095, 0.093, 0.091, 0.089, 0.087]) # W/m-K mu_dyn = numpy.array([0.804, 0.704, 0.623, 0.556, 0.498, 0.451, 0.410, 0.374, 0.346, 0.317, 0.289]) # Pa-s psat = numpy.array([ 0.5, 0.9, 1.4, 2.3, 3.9, 6.0, 8.7, 12.4, 17.6, 24.4, 33.2]) # Pa #class TherminolD12(LiquidData): # """ # Heat transfer fluid Therminol D12 by Solutia # Source: http://twt.mpei.ac.ru/MCS/Worksheets/HEDH/.%5C..%5C..%5C..%5CTTHB%5CHEDH%5CHTF-D12.PDF # """ # Tmin = -85 + 273.15 # TminPsat= 40 + 273.15 # Tmax = 260 + 273.15 # T = numpy.array([ 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150])+273.15 # Kelvin # rho = numpy.array([ 740, 733, 726, 717, 710, 702, 695, 687, 679, 670, 662]) # kg/m3 # c_p = numpy.array([ 2235, 2280, 2326, 2361, 2406, 2445, 2485, 2528, 2571, 2607, 2645])/1000. # kJ/kg-K # lam = numpy.array([0.105, 0.104, 0.102, 0.100, 0.098, 0.096, 0.095, 0.093, 0.091, 0.089, 0.087])/1000. # kW/m-K # mu_dyn = numpy.array([0.804, 0.704, 0.623, 0.556, 0.498, 0.451, 0.410, 0.374, 0.346, 0.317, 0.289])/1000. # Pa-s # psat = numpy.array([ 0.5, 0.9, 1.4, 2.3, 3.9, 6.0, 8.7, 12.4, 17.6, 24.4, 33.2]) # kPa class TherminolD12(LiquidData): """ Heat transfer fluid Therminol D12 by Solutia Source: Therminol Heat Transfer Reference Disk """ T = numpy.array([-8.50000E+1, -8.00000E+1, -7.50000E+1, -7.00000E+1, -6.50000E+1, -6.00000E+1, -5.50000E+1, -5.00000E+1, -4.50000E+1, -4.00000E+1, -3.50000E+1, -3.00000E+1, -2.50000E+1, -2.00000E+1, -1.50000E+1, -1.00000E+1, -5.00000E+0, +0.00000E+0, +5.00000E+0, +1.00000E+1, +1.50000E+1, +2.00000E+1, +2.50000E+1, +3.00000E+1, +3.50000E+1, +4.00000E+1, +4.50000E+1, +5.00000E+1, +5.50000E+1, +6.00000E+1, +6.50000E+1, +7.00000E+1, +7.50000E+1, +8.00000E+1, +8.50000E+1, +9.00000E+1, +9.50000E+1, +1.00000E+2, +1.05000E+2, +1.10000E+2, +1.15000E+2, +1.20000E+2, +1.25000E+2, +1.30000E+2, +1.35000E+2, +1.40000E+2, +1.45000E+2, +1.50000E+2, +1.55000E+2, +1.60000E+2, +1.65000E+2, +1.70000E+2, +1.75000E+2, +1.80000E+2, +1.85000E+2, +1.90000E+2, +1.95000E+2, +2.00000E+2, +2.05000E+2, +2.10000E+2, +2.15000E+2, +2.20000E+2, +2.25000E+2, +2.30000E+2])+273.15 # Kelvin rho = numpy.array([+8.35000E+2, +8.32000E+2, +8.28000E+2, +8.25000E+2, +8.22000E+2, +8.18000E+2, +8.15000E+2, +8.11000E+2, +8.08000E+2, +8.05000E+2, +8.01000E+2, +7.98000E+2, +7.94000E+2, +7.91000E+2, +7.87000E+2, +7.84000E+2, +7.80000E+2, +7.77000E+2, +7.73000E+2, +7.70000E+2, +7.66000E+2, +7.62000E+2, +7.59000E+2, +7.55000E+2, +7.52000E+2, +7.48000E+2, +7.44000E+2, +7.41000E+2, +7.37000E+2, +7.33000E+2, +7.29000E+2, +7.26000E+2, +7.22000E+2, +7.18000E+2, +7.14000E+2, +7.10000E+2, +7.06000E+2, +7.03000E+2, +6.99000E+2, +6.95000E+2, +6.91000E+2, +6.87000E+2, +6.82000E+2, +6.78000E+2, +6.74000E+2, +6.70000E+2, +6.66000E+2, +6.61000E+2, +6.57000E+2, +6.53000E+2, +6.48000E+2, +6.44000E+2, +6.39000E+2, +6.35000E+2, +6.30000E+2, +6.25000E+2, +6.20000E+2, +6.16000E+2, +6.11000E+2, +6.06000E+2, +6.00000E+2, +5.95000E+2, +5.90000E+2, +5.84000E+2]) # kg/m3 c_p = numpy.array([+1.69400E+0, +1.71200E+0, +1.73100E+0, +1.75000E+0, +1.76800E+0, +1.78700E+0, +1.80600E+0, +1.82400E+0, +1.84300E+0, +1.86200E+0, +1.88100E+0, +1.90000E+0, +1.91900E+0, +1.93800E+0, +1.95700E+0, +1.97700E+0, +1.99600E+0, +2.01500E+0, +2.03500E+0, +2.05400E+0, +2.07300E+0, +2.09300E+0, +2.11300E+0, +2.13200E+0, +2.15200E+0, +2.17200E+0, +2.19100E+0, +2.21100E+0, +2.23100E+0, +2.25100E+0, +2.27100E+0, +2.29100E+0, +2.31200E+0, +2.33200E+0, +2.35200E+0, +2.37300E+0, +2.39300E+0, +2.41400E+0, +2.43400E+0, +2.45500E+0, +2.47600E+0, +2.49600E+0, +2.51700E+0, +2.53800E+0, +2.55900E+0, +2.58000E+0, +2.60200E+0, +2.62300E+0, +2.64400E+0, +2.66600E+0, +2.68700E+0, +2.70900E+0, +2.73100E+0, +2.75300E+0, +2.77500E+0, +2.79700E+0, +2.82000E+0, +2.84200E+0, +2.86500E+0, +2.88800E+0, +2.91100E+0, +2.93500E+0, +2.95900E+0, +2.98300E+0])*1000. # J/kg-K lam = numpy.array([+1.24400E-1, +1.23800E-1, +1.23200E-1, +1.22500E-1, +1.21900E-1, +1.21300E-1, +1.20600E-1, +1.20000E-1, +1.19300E-1, +1.18600E-1, +1.18000E-1, +1.17300E-1, +1.16600E-1, +1.15900E-1, +1.15200E-1, +1.14500E-1, +1.13700E-1, +1.13000E-1, +1.12200E-1, +1.11500E-1, +1.10700E-1, +1.10000E-1, +1.09200E-1, +1.08400E-1, +1.07600E-1, +1.06800E-1, +1.06000E-1, +1.05200E-1, +1.04400E-1, +1.03500E-1, +1.02700E-1, +1.01900E-1, +1.01000E-1, +1.00100E-1, +9.93000E-2, +9.84000E-2, +9.75000E-2, +9.66000E-2, +9.57000E-2, +9.48000E-2, +9.39000E-2, +9.29000E-2, +9.20000E-2, +9.10000E-2, +9.01000E-2, +8.91000E-2, +8.82000E-2, +8.72000E-2, +8.62000E-2, +8.52000E-2, +8.42000E-2, +8.32000E-2, +8.22000E-2, +8.12000E-2, +8.01000E-2, +7.91000E-2, +7.80000E-2, +7.70000E-2, +7.59000E-2, +7.48000E-2, +7.38000E-2, +7.27000E-2, +7.16000E-2, +7.05000E-2]) # W/m-K mu_dyn = numpy.array([+3.59000E-1, +1.77000E-1, +9.59000E-2, +5.64000E-2, +3.55000E-2, +2.36000E-2, +1.65000E-2, +1.20000E-2, +9.07000E-3, +7.06000E-3, +5.63000E-3, +4.60000E-3, +3.82000E-3, +3.24000E-3, +2.78000E-3, +2.41000E-3, +2.12000E-3, +1.88000E-3, +1.69000E-3, +1.52000E-3, +1.38000E-3, +1.26000E-3, +1.16000E-3, +1.07000E-3, +9.88000E-4, +9.18000E-4, +8.56000E-4, +8.00000E-4, +7.50000E-4, +7.05000E-4, +6.64000E-4, +6.26000E-4, +5.92000E-4, +5.61000E-4, +5.31000E-4, +5.04000E-4, +4.79000E-4, +4.56000E-4, +4.35000E-4, +4.14000E-4, +3.95000E-4, +3.78000E-4, +3.61000E-4, +3.45000E-4, +3.30000E-4, +3.16000E-4, +3.03000E-4, +2.90000E-4, +2.78000E-4, +2.67000E-4, +2.57000E-4, +2.46000E-4, +2.37000E-4, +2.27000E-4, +2.19000E-4, +2.10000E-4, +2.02000E-4, +1.95000E-4, +1.87000E-4, +1.80000E-4, +1.74000E-4, +1.67000E-4, +1.61000E-4, +1.56000E-4]) # Pa-s psat = numpy.array([+4.75000E-9, +2.07000E-8, +8.08000E-8, +2.81000E-7, +8.86000E-7, +2.56000E-6, +6.82000E-6, +1.70000E-5, +3.96000E-5, +8.75000E-5, +1.84000E-4, +3.68000E-4, +7.06000E-4, +1.30000E-3, +2.33000E-3, +4.02000E-3, +6.75000E-3, +1.10000E-2, +1.76000E-2, +2.73000E-2, +4.16000E-2, +6.21000E-2, +9.10000E-2, +1.31000E-1, +1.86000E-1, +2.59000E-1, +3.56000E-1, +4.84000E-1, +6.48000E-1, +8.59000E-1, +1.13000E+0, +1.46000E+0, +1.88000E+0, +2.39000E+0, +3.01000E+0, +3.77000E+0, +4.68000E+0, +5.76000E+0, +7.05000E+0, +8.57000E+0, +1.03000E+1, +1.24000E+1, +1.48000E+1, +1.76000E+1, +2.08000E+1, +2.44000E+1, +2.85000E+1, +3.32000E+1, +3.84000E+1, +4.43000E+1, +5.09000E+1, +5.83000E+1, +6.64000E+1, +7.55000E+1, +8.55000E+1, +9.65000E+1, +1.09000E+2, +1.22000E+2, +1.36000E+2, +1.52000E+2, +1.69000E+2, +1.88000E+2, +2.08000E+2, +2.29000E+2])*1000. # Pa Tmin = numpy.min(T) Tmax = numpy.max(T) TminPsat= Tmin Name = "TD12" Desc = "TherminolD12" class TherminolVP1(LiquidData): """ Heat transfer fluid Therminol VP-1 by Solutia Source: Therminol Heat Transfer Reference Disk """ T = numpy.array([+1.20000E+1, +1.70000E+1, +2.20000E+1, +2.70000E+1, +3.20000E+1, +3.70000E+1, +4.20000E+1, +4.70000E+1, +5.20000E+1, +5.70000E+1, +6.20000E+1, +6.70000E+1, +7.20000E+1, +7.70000E+1, +8.20000E+1, +8.70000E+1, +9.20000E+1, +9.70000E+1, +1.02000E+2, +1.07000E+2, +1.12000E+2, +1.17000E+2, +1.22000E+2, +1.27000E+2, +1.32000E+2, +1.37000E+2, +1.42000E+2, +1.47000E+2, +1.52000E+2, +1.57000E+2, +1.62000E+2, +1.67000E+2, +1.72000E+2, +1.77000E+2, +1.82000E+2, +1.87000E+2, +1.92000E+2, +1.97000E+2, +2.02000E+2, +2.07000E+2, +2.12000E+2, +2.17000E+2, +2.22000E+2, +2.27000E+2, +2.32000E+2, +2.37000E+2, +2.42000E+2, +2.47000E+2, +2.52000E+2, +2.57000E+2, +2.62000E+2, +2.67000E+2, +2.72000E+2, +2.77000E+2, +2.82000E+2, +2.87000E+2, +2.92000E+2, +2.97000E+2, +3.02000E+2, +3.07000E+2, +3.12000E+2, +3.17000E+2, +3.22000E+2, +3.27000E+2, +3.32000E+2, +3.37000E+2, +3.42000E+2, +3.47000E+2, +3.52000E+2, +3.57000E+2, +3.62000E+2, +3.67000E+2, +3.72000E+2, +3.77000E+2, +3.82000E+2, +3.87000E+2, +3.92000E+2, +3.97000E+2])+273.15 # Kelvin rho = numpy.array([+1.07000E+3, +1.07000E+3, +1.06000E+3, +1.06000E+3, +1.05000E+3, +1.05000E+3, +1.05000E+3, +1.04000E+3, +1.04000E+3, +1.03000E+3, +1.03000E+3, +1.03000E+3, +1.02000E+3, +1.02000E+3, +1.01000E+3, +1.01000E+3, +1.01000E+3, +1.00000E+3, +9.97000E+2, +9.93000E+2, +9.88000E+2, +9.84000E+2, +9.80000E+2, +9.76000E+2, +9.72000E+2, +9.67000E+2, +9.63000E+2, +9.59000E+2, +9.55000E+2, +9.50000E+2, +9.46000E+2, +9.42000E+2, +9.37000E+2, +9.33000E+2, +9.29000E+2, +9.24000E+2, +9.20000E+2, +9.15000E+2, +9.11000E+2, +9.06000E+2, +9.02000E+2, +8.98000E+2, +8.93000E+2, +8.89000E+2, +8.84000E+2, +8.79000E+2, +8.75000E+2, +8.70000E+2, +8.65000E+2, +8.60000E+2, +8.56000E+2, +8.51000E+2, +8.46000E+2, +8.41000E+2, +8.36000E+2, +8.31000E+2, +8.25000E+2, +8.20000E+2, +8.15000E+2, +8.10000E+2, +8.04000E+2, +7.99000E+2, +7.93000E+2, +7.88000E+2, +7.82000E+2, +7.76000E+2, +7.70000E+2, +7.65000E+2, +7.59000E+2, +7.52000E+2, +7.46000E+2, +7.40000E+2, +7.33000E+2, +7.27000E+2, +7.20000E+2, +7.13000E+2, +7.06000E+2, +6.99000E+2]) # kg/m3 c_p = numpy.array([+1.52300E+0, +1.53700E+0, +1.55200E+0, +1.56600E+0, +1.58100E+0, +1.59600E+0, +1.61000E+0, +1.62400E+0, +1.63900E+0, +1.65300E+0, +1.66800E+0, +1.68200E+0, +1.69600E+0, +1.71000E+0, +1.72400E+0, +1.73900E+0, +1.75300E+0, +1.76700E+0, +1.78100E+0, +1.79500E+0, +1.80900E+0, +1.82200E+0, +1.83600E+0, +1.85000E+0, +1.86400E+0, +1.87800E+0, +1.89100E+0, +1.90500E+0, +1.91900E+0, +1.93200E+0, +1.94600E+0, +1.95900E+0, +1.97300E+0, +1.98600E+0, +2.00000E+0, +2.01300E+0, +2.02700E+0, +2.04000E+0, +2.05400E+0, +2.06700E+0, +2.08000E+0, +2.09300E+0, +2.10700E+0, +2.12000E+0, +2.13300E+0, +2.14700E+0, +2.16000E+0, +2.17300E+0, +2.18600E+0, +2.19900E+0, +2.21300E+0, +2.22600E+0, +2.23900E+0, +2.25200E+0, +2.26600E+0, +2.27900E+0, +2.29300E+0, +2.30600E+0, +2.31900E+0, +2.33300E+0, +2.34700E+0, +2.36000E+0, +2.37400E+0, +2.38800E+0, +2.40200E+0, +2.41600E+0, +2.43100E+0, +2.44600E+0, +2.46000E+0, +2.47600E+0, +2.49100E+0, +2.50700E+0, +2.52300E+0, +2.54000E+0, +2.55800E+0, +2.57600E+0, +2.59500E+0, +2.61500E+0])*1000. # J/kg-K lam = numpy.array([+1.37000E-1, +1.36600E-1, +1.36100E-1, +1.35600E-1, +1.35200E-1, +1.34700E-1, +1.34200E-1, +1.33600E-1, +1.33100E-1, +1.32600E-1, +1.32000E-1, +1.31500E-1, +1.30900E-1, +1.30400E-1, +1.29800E-1, +1.29200E-1, +1.28600E-1, +1.28000E-1, +1.27400E-1, +1.26800E-1, +1.26200E-1, +1.25600E-1, +1.24900E-1, +1.24300E-1, +1.23600E-1, +1.22900E-1, +1.22300E-1, +1.21600E-1, +1.20900E-1, +1.20200E-1, +1.19500E-1, +1.18700E-1, +1.18000E-1, +1.17300E-1, +1.16500E-1, +1.15800E-1, +1.15000E-1, +1.14200E-1, +1.13500E-1, +1.12700E-1, +1.11900E-1, +1.11100E-1, +1.10300E-1, +1.09400E-1, +1.08600E-1, +1.07800E-1, +1.06900E-1, +1.06000E-1, +1.05200E-1, +1.04300E-1, +1.03400E-1, +1.02500E-1, +1.01600E-1, +1.00700E-1, +9.98000E-2, +9.89000E-2, +9.79000E-2, +9.70000E-2, +9.60000E-2, +9.51000E-2, +9.41000E-2, +9.31000E-2, +9.21000E-2, +9.11000E-2, +9.01000E-2, +8.91000E-2, +8.81000E-2, +8.71000E-2, +8.60000E-2, +8.50000E-2, +8.39000E-2, +8.29000E-2, +8.18000E-2, +8.07000E-2, +7.96000E-2, +7.85000E-2, +7.74000E-2, +7.63000E-2]) # W/m-K mu_dyn = numpy.array([+5.48000E-3, +4.68000E-3, +4.05000E-3, +3.54000E-3, +3.12000E-3, +2.78000E-3, +2.49000E-3, +2.24000E-3, +2.04000E-3, +1.86000E-3, +1.70000E-3, +1.57000E-3, +1.45000E-3, +1.34000E-3, +1.25000E-3, +1.16000E-3, +1.09000E-3, +1.02000E-3, +9.62000E-4, +9.06000E-4, +8.56000E-4, +8.10000E-4, +7.68000E-4, +7.29000E-4, +6.93000E-4, +6.60000E-4, +6.30000E-4, +6.01000E-4, +5.75000E-4, +5.51000E-4, +5.28000E-4, +5.06000E-4, +4.86000E-4, +4.67000E-4, +4.50000E-4, +4.33000E-4, +4.18000E-4, +4.03000E-4, +3.89000E-4, +3.76000E-4, +3.64000E-4, +3.52000E-4, +3.41000E-4, +3.30000E-4, +3.20000E-4, +3.10000E-4, +3.01000E-4, +2.93000E-4, +2.84000E-4, +2.77000E-4, +2.69000E-4, +2.62000E-4, +2.55000E-4, +2.48000E-4, +2.42000E-4, +2.36000E-4, +2.30000E-4, +2.25000E-4, +2.19000E-4, +2.14000E-4, +2.09000E-4, +2.04000E-4, +2.00000E-4, +1.96000E-4, +1.91000E-4, +1.87000E-4, +1.83000E-4, +1.80000E-4, +1.76000E-4, +1.72000E-4, +1.69000E-4, +1.66000E-4, +1.62000E-4, +1.59000E-4, +1.56000E-4, +1.53000E-4, +1.51000E-4, +1.48000E-4]) # Pa-s psat = numpy.array([+5.76000E-4, +9.86000E-4, +1.65000E-3, +2.68000E-3, +4.27000E-3, +6.67000E-3, +1.02000E-2, +1.53000E-2, +2.26000E-2, +3.29000E-2, +4.71000E-2, +6.65000E-2, +9.26000E-2, +1.27000E-1, +1.73000E-1, +2.32000E-1, +3.09000E-1, +4.07000E-1, +5.30000E-1, +6.85000E-1, +8.77000E-1, +1.11000E+0, +1.40000E+0, +1.76000E+0, +2.18000E+0, +2.70000E+0, +3.31000E+0, +4.03000E+0, +4.88000E+0, +5.88000E+0, +7.05000E+0, +8.40000E+0, +9.96000E+0, +1.18000E+1, +1.38000E+1, +1.62000E+1, +1.89000E+1, +2.19000E+1, +2.53000E+1, +2.92000E+1, +3.35000E+1, +3.84000E+1, +4.37000E+1, +4.97000E+1, +5.63000E+1, +6.37000E+1, +7.17000E+1, +8.06000E+1, +9.03000E+1, +1.01000E+2, +1.13000E+2, +1.25000E+2, +1.39000E+2, +1.54000E+2, +1.70000E+2, +1.87000E+2, +2.06000E+2, +2.26000E+2, +2.48000E+2, +2.71000E+2, +2.96000E+2, +3.23000E+2, +3.51000E+2, +3.82000E+2, +4.14000E+2, +4.48000E+2, +4.85000E+2, +5.24000E+2, +5.64000E+2, +6.08000E+2, +6.54000E+2, +7.02000E+2, +7.53000E+2, +8.06000E+2, +8.62000E+2, +9.21000E+2, +9.83000E+2, +1.05000E+3])*1000. # Pa Tmin = numpy.min(T) Tmax = numpy.max(T) TminPsat= Tmin Name = "TVP1" Desc = "TherminolVP1" class Therminol66(LiquidData): """ Heat transfer fluid Therminol 66 by Solutia Source: Therminol Heat Transfer Reference Disk """ temp = numpy.linspace(0, 380, 30) # Celsius temperaure def f_rho( T_C): return -0.614254 * T_C - 0.000321 * T_C**2 + 1020.62 def f_cp( T_C): return 0.003313 * T_C + 0.0000008970785 * T_C**2 + 1.496005 def f_mu( T_C): return numpy.exp(586.375/(T_C+62.5) -2.2809 ) def f_lam( T_C): return -0.000033 * T_C - 0.00000015 * T_C**2 + 0.118294 def f_psa( T_C): return numpy.exp(-9094.51/(T_C+340) + 17.6371 ) T = temp + 273.15 # Kelvin rho = f_rho(temp) # kg/m3 c_p = f_cp(temp)*1e3 # J/kg-K lam = f_lam(temp) # W/m-K # Viscosity: Pa-s (dynamic = kinematic * rho) # mm2/s /1e6 -> m2/s * kg/m3 = kg/s/m = Pa s mu_dyn = f_mu(temp)/1e6 * rho psat = f_psa(temp) * 1e3 # Pa Tmin = numpy.min(T) Tmax = numpy.max(T) TminPsat= 70+273.15 Name = "T66" Desc = "Therminol66" class Therminol72(LiquidData): """ Heat transfer fluid Therminol 72 by Solutia Source: Therminol Heat Transfer Reference Disk """ T = numpy.array([-1.00000E+1, -5.00000E+0, +0.00000E+0, +5.00000E+0, +1.00000E+1, +1.50000E+1, +2.00000E+1, +2.50000E+1, +3.00000E+1, +3.50000E+1, +4.00000E+1, +4.50000E+1, +5.00000E+1, +5.50000E+1, +6.00000E+1, +6.50000E+1, +7.00000E+1, +7.50000E+1, +8.00000E+1, +8.50000E+1, +9.00000E+1, +9.50000E+1, +1.00000E+2, +1.05000E+2, +1.10000E+2, +1.15000E+2, +1.20000E+2, +1.25000E+2, +1.30000E+2, +1.35000E+2, +1.40000E+2, +1.45000E+2, +1.50000E+2, +1.55000E+2, +1.60000E+2, +1.65000E+2, +1.70000E+2, +1.75000E+2, +1.80000E+2, +1.85000E+2, +1.90000E+2, +1.95000E+2, +2.00000E+2, +2.05000E+2, +2.10000E+2, +2.15000E+2, +2.20000E+2, +2.25000E+2, +2.30000E+2, +2.35000E+2, +2.40000E+2, +2.45000E+2, +2.50000E+2, +2.55000E+2, +2.60000E+2, +2.65000E+2, +2.70000E+2, +2.75000E+2, +2.80000E+2, +2.85000E+2, +2.90000E+2, +2.95000E+2, +3.00000E+2, +3.05000E+2, +3.10000E+2, +3.15000E+2, +3.20000E+2, +3.25000E+2, +3.30000E+2, +3.35000E+2, +3.40000E+2, +3.45000E+2, +3.50000E+2, +3.55000E+2, +3.60000E+2, +3.65000E+2, +3.70000E+2, +3.75000E+2, +3.80000E+2])+273.15 # Kelvin rho = numpy.array([+1.11000E+3, +1.10000E+3, +1.10000E+3, +1.09000E+3, +1.09000E+3, +1.08000E+3, +1.08000E+3, +1.07000E+3, +1.07000E+3, +1.07000E+3, +1.06000E+3, +1.06000E+3, +1.05000E+3, +1.05000E+3, +1.04000E+3, +1.04000E+3, +1.03000E+3, +1.03000E+3, +1.02000E+3, +1.02000E+3, +1.02000E+3, +1.01000E+3, +1.01000E+3, +1.00000E+3, +9.97000E+2, +9.93000E+2, +9.88000E+2, +9.84000E+2, +9.79000E+2, +9.74000E+2, +9.70000E+2, +9.65000E+2, +9.61000E+2, +9.56000E+2, +9.52000E+2, +9.47000E+2, +9.43000E+2, +9.38000E+2, +9.34000E+2, +9.29000E+2, +9.25000E+2, +9.20000E+2, +9.16000E+2, +9.11000E+2, +9.06000E+2, +9.02000E+2, +8.98000E+2, +8.93000E+2, +8.89000E+2, +8.84000E+2, +8.80000E+2, +8.75000E+2, +8.71000E+2, +8.66000E+2, +8.62000E+2, +8.57000E+2, +8.53000E+2, +8.48000E+2, +8.44000E+2, +8.39000E+2, +8.34000E+2, +8.30000E+2, +8.25000E+2, +8.21000E+2, +8.16000E+2, +8.12000E+2, +8.07000E+2, +8.03000E+2, +7.98000E+2, +7.94000E+2, +7.89000E+2, +7.85000E+2, +7.80000E+2, +7.76000E+2, +7.71000E+2, +7.66000E+2, +7.62000E+2, +7.57000E+2, +7.53000E+2]) # kg/m3 c_p = numpy.array([+1.47100E+0, +1.48400E+0, +1.49800E+0, +1.51200E+0, +1.52500E+0, +1.53900E+0, +1.55200E+0, +1.56600E+0, +1.57900E+0, +1.59300E+0, +1.60600E+0, +1.62000E+0, +1.63400E+0, +1.64700E+0, +1.66100E+0, +1.67400E+0, +1.68800E+0, +1.70100E+0, +1.71500E+0, +1.72800E+0, +1.74200E+0, +1.75500E+0, +1.76900E+0, +1.78300E+0, +1.79600E+0, +1.81000E+0, +1.82300E+0, +1.83700E+0, +1.85000E+0, +1.86400E+0, +1.87700E+0, +1.89100E+0, +1.90500E+0, +1.91800E+0, +1.93200E+0, +1.94500E+0, +1.95900E+0, +1.97200E+0, +1.98600E+0, +1.99900E+0, +2.01300E+0, +2.02600E+0, +2.04000E+0, +2.05400E+0, +2.06700E+0, +2.08100E+0, +2.09400E+0, +2.10800E+0, +2.12100E+0, +2.13500E+0, +2.14800E+0, +2.16200E+0, +2.17600E+0, +2.18900E+0, +2.20300E+0, +2.21600E+0, +2.23000E+0, +2.24300E+0, +2.25700E+0, +2.27000E+0, +2.28400E+0, +2.29700E+0, +2.31100E+0, +2.32500E+0, +2.33800E+0, +2.35200E+0, +2.36500E+0, +2.37900E+0, +2.39200E+0, +2.40600E+0, +2.41900E+0, +2.43300E+0, +2.44600E+0, +2.46000E+0, +2.47400E+0, +2.48700E+0, +2.50100E+0, +2.51400E+0, +2.52800E+0])*1000. # J/kg-K lam = numpy.array([+1.43200E-1, +1.42600E-1, +1.42000E-1, +1.41400E-1, +1.40800E-1, +1.40200E-1, +1.39600E-1, +1.39000E-1, +1.38400E-1, +1.37800E-1, +1.37100E-1, +1.36500E-1, +1.35900E-1, +1.35300E-1, +1.34700E-1, +1.34100E-1, +1.33500E-1, +1.32900E-1, +1.32300E-1, +1.31700E-1, +1.31100E-1, +1.30500E-1, +1.29900E-1, +1.29300E-1, +1.28700E-1, +1.28000E-1, +1.27400E-1, +1.26800E-1, +1.26200E-1, +1.25600E-1, +1.25000E-1, +1.24400E-1, +1.23800E-1, +1.23200E-1, +1.22600E-1, +1.22000E-1, +1.21400E-1, +1.20800E-1, +1.20200E-1, +1.19600E-1, +1.18900E-1, +1.18300E-1, +1.17700E-1, +1.17100E-1, +1.16500E-1, +1.15900E-1, +1.15300E-1, +1.14700E-1, +1.14100E-1, +1.13500E-1, +1.12900E-1, +1.12300E-1, +1.11700E-1, +1.11100E-1, +1.10500E-1, +1.09800E-1, +1.09200E-1, +1.08600E-1, +1.08000E-1, +1.07400E-1, +1.06800E-1, +1.06200E-1, +1.05600E-1, +1.05000E-1, +1.04400E-1, +1.03800E-1, +1.03200E-1, +1.02600E-1, +1.02000E-1, +1.01400E-1, +1.00700E-1, +1.00100E-1, +9.95000E-2, +9.89000E-2, +9.83000E-2, +9.77000E-2, +9.71000E-2, +9.65000E-2, +9.59000E-2]) # W/m-K mu_dyn = numpy.array([+3.83000E-1, +1.19000E-1, +5.92000E-2, +3.60000E-2, +2.44000E-2, +1.77000E-2, +1.35000E-2, +1.07000E-2, +8.68000E-3, +7.21000E-3, +6.09000E-3, +5.21000E-3, +4.52000E-3, +3.96000E-3, +3.50000E-3, +3.12000E-3, +2.79000E-3, +2.52000E-3, +2.28000E-3, +2.08000E-3, +1.90000E-3, +1.75000E-3, +1.61000E-3, +1.49000E-3, +1.38000E-3, +1.29000E-3, +1.20000E-3, +1.12000E-3, +1.05000E-3, +9.86000E-4, +9.28000E-4, +8.74000E-4, +8.25000E-4, +7.79000E-4, +7.38000E-4, +6.99000E-4, +6.64000E-4, +6.31000E-4, +6.00000E-4, +5.72000E-4, +5.45000E-4, +5.20000E-4, +4.97000E-4, +4.75000E-4, +4.55000E-4, +4.36000E-4, +4.18000E-4, +4.01000E-4, +3.85000E-4, +3.70000E-4, +3.55000E-4, +3.42000E-4, +3.29000E-4, +3.17000E-4, +3.05000E-4, +2.95000E-4, +2.84000E-4, +2.74000E-4, +2.65000E-4, +2.56000E-4, +2.47000E-4, +2.39000E-4, +2.31000E-4, +2.24000E-4, +2.17000E-4, +2.10000E-4, +2.03000E-4, +1.97000E-4, +1.91000E-4, +1.85000E-4, +1.80000E-4, +1.75000E-4, +1.69000E-4, +1.65000E-4, +1.60000E-4, +1.55000E-4, +1.51000E-4, +1.47000E-4, +1.43000E-4]) # Pa-s psat = numpy.array([+9.60000E-1, +1.05000E+0, +1.14000E+0, +1.24000E+0, +1.35000E+0, +1.47000E+0, +1.60000E+0, +1.74000E+0, +1.89000E+0, +2.06000E+0, +2.24000E+0, +2.44000E+0, +2.65000E+0, +2.88000E+0, +3.14000E+0, +3.41000E+0, +3.71000E+0, +4.03000E+0, +4.39000E+0, +4.77000E+0, +5.18000E+0, +5.63000E+0, +6.12000E+0, +6.66000E+0, +7.23000E+0, +7.86000E+0, +8.54000E+0, +9.27000E+0, +1.01000E+1, +1.10000E+1, +1.19000E+1, +1.29000E+1, +1.40000E+1, +1.52000E+1, +1.65000E+1, +1.80000E+1, +1.95000E+1, +2.12000E+1, +2.30000E+1, +2.49000E+1, +2.71000E+1, +2.94000E+1, +3.19000E+1, +3.46000E+1, +3.75000E+1, +4.07000E+1, +4.42000E+1, +4.79000E+1, +5.20000E+1, +5.64000E+1, +6.11000E+1, +6.63000E+1, +7.19000E+1, +7.79000E+1, +8.45000E+1, +9.15000E+1, +9.92000E+1, +1.08000E+2, +1.17000E+2, +1.26000E+2, +1.37000E+2, +1.48000E+2, +1.61000E+2, +1.74000E+2, +1.89000E+2, +2.04000E+2, +2.21000E+2, +2.40000E+2, +2.60000E+2, +2.81000E+2, +3.04000E+2, +3.30000E+2, +3.57000E+2, +3.86000E+2, +4.18000E+2, +4.53000E+2, +4.90000E+2, +5.30000E+2, +5.74000E+2])*1000. # Pa Tmin = numpy.min(T) Tmax = numpy.max(T) TminPsat= Tmin Name = "T72" Desc = "Therminol72" class DowthermJ(LiquidData): """ Heat transfer fluid Dowtherm J by Dow Chemicals Source: Dow Chemicals data sheet """ T = numpy.array([-8.00000E+1, -7.00000E+1, -6.00000E+1, -5.00000E+1, -4.00000E+1, -3.00000E+1, -2.00000E+1, -1.00000E+1, +0.00000E+0, +1.00000E+1, +2.00000E+1, +3.00000E+1, +4.00000E+1, +5.00000E+1, +6.00000E+1, +7.00000E+1, +8.00000E+1, +9.00000E+1, +1.00000E+2, +1.10000E+2, +1.20000E+2, +1.30000E+2, +1.40000E+2, +1.50000E+2, +1.60000E+2, +1.70000E+2, +1.80000E+2, +1.81300E+2, +1.90000E+2, +2.00000E+2, +2.10000E+2, +2.20000E+2, +2.30000E+2, +2.40000E+2, +2.50000E+2, +2.60000E+2, +2.70000E+2, +2.80000E+2, +2.90000E+2, +3.00000E+2, +3.10000E+2, +3.20000E+2, +3.30000E+2, +3.40000E+2, +3.45000E+2])+273.15 # Kelvin rho = numpy.array([+9.31300E+2, +9.27900E+2, +9.21000E+2, +9.14100E+2, +9.07100E+2, +9.00000E+2, +8.92900E+2, +8.85700E+2, +8.78500E+2, +8.71100E+2, +8.63700E+2, +8.56200E+2, +8.48700E+2, +8.41000E+2, +8.33200E+2, +8.25400E+2, +8.17400E+2, +8.09400E+2, +8.01200E+2, +7.92900E+2, +7.84400E+2, +7.75900E+2, +7.67100E+2, +7.58300E+2, +7.49200E+2, +7.40000E+2, +7.30600E+2, +7.29300E+2, +7.20900E+2, +7.11000E+2, +7.00900E+2, +6.90500E+2, +6.79800E+2, +6.68800E+2, +6.57300E+2, +6.45500E+2, +6.33100E+2, +6.20200E+2, +6.06600E+2, +5.92200E+2, +5.76900E+2, +5.60400E+2, +5.42400E+2, +5.22400E+2, +5.11400E+2]) # kg/m3 c_p = numpy.array([+1.58400E+0, +1.59400E+0, +1.61600E+0, +1.63900E+0, +1.66300E+0, +1.68800E+0, +1.71400E+0, +1.74100E+0, +1.76900E+0, +1.79800E+0, +1.82800E+0, +1.85900E+0, +1.89000E+0, +1.92300E+0, +1.95500E+0, +1.98900E+0, +2.02300E+0, +2.05800E+0, +2.09300E+0, +2.12900E+0, +2.16500E+0, +2.20200E+0, +2.23900E+0, +2.27700E+0, +2.31500E+0, +2.35300E+0, +2.39200E+0, +2.39700E+0, +2.43200E+0, +2.47200E+0, +2.51200E+0, +2.55300E+0, +2.59400E+0, +2.63600E+0, +2.68000E+0, +2.72400E+0, +2.76900E+0, +2.81600E+0, +2.86600E+0, +2.91900E+0, +2.97600E+0, +3.04000E+0, +3.11500E+0, +3.20800E+0, +3.26500E+0])*1000. # J/kg-K lam = numpy.array([+1.48500E-1, +1.47500E-1, +1.45300E-1, +1.43200E-1, +1.41100E-1, +1.39000E-1, +1.36800E-1, +1.34700E-1, +1.32600E-1, +1.30500E-1, +1.28400E-1, +1.26200E-1, +1.24100E-1, +1.22000E-1, +1.19900E-1, +1.17700E-1, +1.15600E-1, +1.13500E-1, +1.11400E-1, +1.09300E-1, +1.07100E-1, +1.05000E-1, +1.02900E-1, +1.00800E-1, +9.87000E-2, +9.65000E-2, +9.44000E-2, +9.41000E-2, +9.23000E-2, +9.02000E-2, +8.80000E-2, +8.59000E-2, +8.38000E-2, +8.17000E-2, +7.96000E-2, +7.74000E-2, +7.53000E-2, +7.32000E-2, +7.11000E-2, +6.90000E-2, +6.68000E-2, +6.47000E-2, +6.26000E-2, +6.05000E-2, +5.94000E-2]) # W/m-K mu_dyn = numpy.array([+8.43000E+0, +7.11000E+0, +5.12000E+0, +3.78000E+0, +2.88000E+0, +2.25000E+0, +1.80000E+0, +1.48000E+0, +1.23000E+0, +1.05000E+0, +9.10000E-1, +7.90000E-1, +7.00000E-1, +6.30000E-1, +5.60000E-1, +5.10000E-1, +4.70000E-1, +4.30000E-1, +4.00000E-1, +3.70000E-1, +3.50000E-1, +3.30000E-1, +3.10000E-1, +2.90000E-1, +2.80000E-1, +2.70000E-1, +2.50000E-1, +2.50000E-1, +2.40000E-1, +2.30000E-1, +2.30000E-1, +2.20000E-1, +2.10000E-1, +2.00000E-1, +2.00000E-1, +1.90000E-1, +1.80000E-1, +1.80000E-1, +1.70000E-1, +1.70000E-1, +1.70000E-1, +1.60000E-1, +1.60000E-1, +1.60000E-1, +1.50000E-1])/1000. # Pa-s psat = numpy.array([+0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +5.00000E-3, +1.00000E-2, +2.00000E-2, +3.00000E-2, +5.00000E-2, +8.00000E-2, +1.10000E-1, +1.60000E-1, +2.30000E-1, +3.20000E-1, +4.30000E-1, +5.80000E-1, +7.60000E-1, +9.80000E-1, +1.01000E+0, +1.25000E+0, +1.58000E+0, +1.97000E+0, +2.43000E+0, +2.96000E+0, +3.59000E+0, +4.30000E+0, +5.13000E+0, +6.06000E+0, +7.12000E+0, +8.31000E+0, +9.64000E+0, +1.11300E+1, +1.27900E+1, +1.46400E+1, +1.66900E+1, +1.78000E+1])*1e5 # Pa Tmin = numpy.min(T) Tmax = numpy.max(T) TminPsat= 50 + 273.15 Name = "DowJ" Desc = "DowthermJ" class DowthermQ(LiquidData): """ Heat transfer fluid Dowtherm Q by Dow Chemicals Source: Dow Chemicals data sheet """ T = numpy.array([-3.50000E+1, -3.00000E+1, -2.00000E+1, -1.00000E+1, +0.00000E+0, +1.00000E+1, +2.00000E+1, +3.00000E+1, +4.00000E+1, +5.00000E+1, +6.00000E+1, +7.00000E+1, +8.00000E+1, +9.00000E+1, +1.00000E+2, +1.10000E+2, +1.20000E+2, +1.30000E+2, +1.40000E+2, +1.50000E+2, +1.60000E+2, +1.70000E+2, +1.80000E+2, +1.90000E+2, +2.00000E+2, +2.10000E+2, +2.20000E+2, +2.30000E+2, +2.40000E+2, +2.50000E+2, +2.60000E+2, +2.70000E+2, +2.80000E+2, +2.90000E+2, +3.00000E+2, +3.10000E+2, +3.20000E+2, +3.30000E+2, +3.40000E+2, +3.50000E+2, +3.60000E+2])+273.15 # Kelvin rho = numpy.array([+1.01140E+3, +1.00320E+3, +9.95600E+2, +9.88000E+2, +9.80500E+2, +9.72900E+2, +9.65400E+2, +9.57800E+2, +9.50200E+2, +9.42700E+2, +9.35100E+2, +9.27600E+2, +9.20000E+2, +9.12400E+2, +9.04900E+2, +8.97300E+2, +8.89800E+2, +8.82200E+2, +8.74600E+2, +8.67100E+2, +8.59500E+2, +8.52000E+2, +8.44400E+2, +8.36800E+2, +8.29300E+2, +8.21700E+2, +8.14200E+2, +8.06600E+2, +7.99000E+2, +7.91500E+2, +7.83900E+2, +7.76400E+2, +7.68800E+2, +7.61200E+2, +7.53700E+2, +7.46100E+2, +7.38600E+2, +7.31000E+2, +7.23400E+2, +7.15900E+2, +7.08300E+2]) # kg/m3 c_p = numpy.array([+1.47800E+0, +1.49200E+0, +1.52500E+0, +1.55700E+0, +1.58900E+0, +1.62100E+0, +1.65300E+0, +1.68500E+0, +1.71600E+0, +1.74800E+0, +1.77900E+0, +1.81100E+0, +1.84200E+0, +1.87300E+0, +1.90400E+0, +1.93500E+0, +1.96600E+0, +1.99700E+0, +2.02700E+0, +2.05800E+0, +2.08800E+0, +2.11800E+0, +2.14800E+0, +2.17800E+0, +2.20800E+0, +2.23800E+0, +2.26800E+0, +2.29700E+0, +2.32700E+0, +2.35600E+0, +2.38600E+0, +2.41500E+0, +2.44400E+0, +2.47300E+0, +2.50200E+0, +2.53000E+0, +2.55900E+0, +2.58700E+0, +2.61600E+0, +2.64400E+0, +2.67200E+0])*1000. # J/kg-K lam = numpy.array([+1.28000E-1, +1.27700E-1, +1.26600E-1, +1.25500E-1, +1.24400E-1, +1.23200E-1, +1.22000E-1, +1.20800E-1, +1.19500E-1, +1.18300E-1, +1.17000E-1, +1.15600E-1, +1.14300E-1, +1.12900E-1, +1.11500E-1, +1.10100E-1, +1.08700E-1, +1.07200E-1, +1.05800E-1, +1.04300E-1, +1.02800E-1, +1.01300E-1, +9.98000E-2, +9.82000E-2, +9.67000E-2, +9.52000E-2, +9.36000E-2, +9.21000E-2, +9.05000E-2, +8.89000E-2, +8.74000E-2, +8.58000E-2, +8.43000E-2, +8.27000E-2, +8.11000E-2, +7.96000E-2, +7.80000E-2, +7.65000E-2, +7.49000E-2, +7.34000E-2, +7.19000E-2]) # W/m-K mu_dyn = numpy.array([+4.66000E+1, +2.42000E+1, +1.61000E+1, +1.09000E+1, +7.56000E+0, +5.42000E+0, +4.00000E+0, +3.04000E+0, +2.37000E+0, +1.89000E+0, +1.54000E+0, +1.28000E+0, +1.07000E+0, +9.20000E-1, +8.00000E-1, +7.00000E-1, +6.20000E-1, +5.50000E-1, +5.00000E-1, +4.50000E-1, +4.10000E-1, +3.80000E-1, +3.50000E-1, +3.30000E-1, +3.10000E-1, +2.90000E-1, +2.70000E-1, +2.60000E-1, +2.40000E-1, +2.30000E-1, +2.20000E-1, +2.10000E-1, +2.00000E-1, +1.90000E-1, +1.90000E-1, +1.80000E-1, +1.70000E-1, +1.70000E-1, +1.60000E-1, +1.60000E-1, +1.50000E-1])/1000. # Pa-s psat = numpy.array([+0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +5.00000E-3, +1.00000E-2, +2.00000E-2, +3.00000E-2, +5.00000E-2, +7.00000E-2, +9.00000E-2, +1.30000E-1, +1.70000E-1, +2.30000E-1, +3.10000E-1, +4.00000E-1, +5.10000E-1, +6.40000E-1, +8.10000E-1, +1.00000E+0, +1.24000E+0, +1.51000E+0, +1.82000E+0, +2.19000E+0, +2.61000E+0, +3.09000E+0, +3.64000E+0, +4.25000E+0, +4.95000E+0])*1e5 # Pa Tmin = numpy.min(T) Tmax = numpy.max(T) TminPsat= 120 + 273.15 Name = "DowQ" Desc = "DowthermQ" class Texatherm22(LiquidData): """ Heat transfer fluid Texatherm 22 by Texaco Source: Texaco data sheet """ T = numpy.array([+0.00000E+0, +4.00000E+1, +5.00000E+1, +1.00000E+2, +1.50000E+2, +2.00000E+2, +2.50000E+2, +3.00000E+2, +3.50000E+2])+273.15 # Kelvin rho = numpy.array([+8.74500E+2, +8.47300E+2, +8.42500E+2, +8.10500E+2, +7.76300E+2, +7.41600E+2, +7.03200E+2, +6.68000E+2, +6.21500E+2]) # kg/m3 c_p = numpy.array([+1.81000E+0, +1.95000E+0, +1.99000E+0, +2.18000E+0, +2.36000E+0, +2.54000E+0, +2.72000E+0, +2.90000E+0, +3.08000E+0])*1e3 # J/kg-K lam = numpy.array([+1.35000E-1, +1.32000E-1, +1.32000E-1, +1.28000E-1, +1.25000E-1, +1.21000E-1, +1.17100E-1, +1.13000E-1, +1.10000E-1]) # W/m-K mu_dyn = numpy.array([+4.19760E+2, +0.00000E+0, +2.31688E+1, +0.00000E+0, +2.09601E+0, +1.26072E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0])/1000. # Pa-s psat = numpy.array([+0.00000E+0, +5.3300E-10, +4.00000E-8, +2.67000E-7, +2.27000E-5, +4.67000E-4, +6.67000E-3, +2.13000E-2, +5.33000E-2])*1e5 # Pa Tmin = numpy.min(T) Tmax = numpy.max(T) TminPsat= 40 + 273.15 Name = "TX22" Desc = "Texatherm22" class NitrateSalt(LiquidData): """ Heat transfer fluid based on 60% NaNO3 and 40% KNO3 Source: Solar Power Tower Design Basis Document, Alexis B. Zavoico, Sandia Labs, USA """ temp = numpy.linspace(300, 600, 25) # Celsius temperaure def f_rho( T_C): return 2090 - 0.636 * T_C def f_cp( T_C): return 1443 + 0.172 * T_C def f_mu( T_C): return 22.714 - 0.120 * T_C + 2.281 * 1e-4 * T_C*T_C - 1.474 * 1e-7 * T_C*T_C*T_C def f_lam( T_C): return 0.443 + 1.9e-4 * T_C T = temp + 273.15 # Kelvin rho = f_rho(temp) # kg/m3 c_p = f_cp(temp) # J/kg-K lam = f_lam(temp) # W/m-K mu_dyn = f_mu(temp)/1e3 # Pa-s psat = temp * 0 # Pa Tmin = numpy.min(T) Tmax = numpy.max(T) TminPsat= Tmax Name = "NaK" Desc = "NitrateSalt" class SylthermXLT(LiquidData): """ Heat transfer fluid Syltherm XLT by Dow Chemicals Source: Dow Chemicals data sheet """ T = numpy.array([-1.00000E+2, -9.50000E+1, -9.00000E+1, -8.50000E+1, -8.00000E+1, -7.50000E+1, -7.00000E+1, -6.50000E+1, -6.00000E+1, -5.50000E+1, -5.00000E+1, -4.50000E+1, -4.00000E+1, -3.50000E+1, -3.00000E+1, -2.50000E+1, -2.00000E+1, -1.50000E+1, -1.00000E+1, -5.00000E+0, +0.00000E+0, +5.00000E+0, +1.00000E+1, +1.50000E+1, +2.00000E+1, +2.50000E+1, +3.00000E+1, +3.50000E+1, +4.00000E+1, +4.50000E+1, +5.00000E+1, +5.50000E+1, +6.00000E+1, +6.50000E+1, +7.00000E+1, +7.50000E+1, +8.00000E+1, +8.50000E+1, +9.00000E+1, +9.50000E+1, +1.00000E+2, +1.05000E+2, +1.10000E+2, +1.15000E+2, +1.20000E+2, +1.25000E+2, +1.30000E+2, +1.35000E+2, +1.40000E+2, +1.45000E+2, +1.50000E+2, +1.55000E+2, +1.60000E+2, +1.65000E+2, +1.70000E+2, +1.75000E+2, +1.80000E+2, +1.85000E+2, +1.90000E+2, +1.95000E+2, +2.00000E+2, +2.05000E+2, +2.10000E+2, +2.15000E+2, +2.20000E+2, +2.25000E+2, +2.30000E+2, +2.35000E+2, +2.40000E+2, +2.45000E+2, +2.50000E+2, +2.55000E+2, +2.60000E+2])+273.15 # Kelvin rho = numpy.array([+9.78500E+2, +9.73400E+2, +9.68300E+2, +9.63100E+2, +9.58000E+2, +9.52900E+2, +9.47700E+2, +9.42600E+2, +9.37500E+2, +9.32300E+2, +9.27200E+2, +9.22000E+2, +9.16900E+2, +9.11800E+2, +9.06600E+2, +9.01500E+2, +8.96400E+2, +8.91200E+2, +8.86100E+2, +8.81000E+2, +8.75800E+2, +8.70700E+2, +8.65500E+2, +8.60400E+2, +8.55300E+2, +8.50100E+2, +8.45000E+2, +8.39900E+2, +8.34700E+2, +8.29600E+2, +8.24500E+2, +8.19300E+2, +8.14200E+2, +8.09100E+2, +8.03900E+2, +7.98800E+2, +7.93600E+2, +7.88500E+2, +7.83400E+2, +7.78200E+2, +7.73100E+2, +7.68000E+2, +7.62800E+2, +7.57700E+2, +7.52600E+2, +7.47400E+2, +7.42300E+2, +7.37200E+2, +7.32000E+2, +7.26900E+2, +7.21700E+2, +7.16600E+2, +7.11500E+2, +7.06300E+2, +7.01200E+2, +6.96100E+2, +6.90900E+2, +6.85800E+2, +6.80700E+2, +6.75500E+2, +6.70400E+2, +6.65300E+2, +6.60100E+2, +6.55000E+2, +6.49800E+2, +6.44700E+2, +6.39600E+2, +6.34400E+2, +6.29300E+2, +6.24200E+2, +6.19000E+2, +6.13900E+2, +6.08800E+2]) # kg/m3 c_p = numpy.array([+1.52000E+0, +1.53000E+0, +1.54100E+0, +1.55100E+0, +1.56200E+0, +1.57200E+0, +1.58300E+0, +1.59300E+0, +1.60400E+0, +1.61400E+0, +1.62500E+0, +1.63500E+0, +1.64600E+0, +1.65600E+0, +1.66700E+0, +1.67700E+0, +1.68800E+0, +1.69800E+0, +1.70900E+0, +1.71900E+0, +1.73000E+0, +1.74000E+0, +1.75100E+0, +1.76100E+0, +1.77200E+0, +1.78200E+0, +1.79300E+0, +1.80300E+0, +1.81400E+0, +1.82400E+0, +1.83500E+0, +1.84500E+0, +1.85600E+0, +1.86600E+0, +1.87700E+0, +1.88700E+0, +1.89800E+0, +1.90800E+0, +1.91900E+0, +1.92900E+0, +1.94000E+0, +1.95000E+0, +1.96100E+0, +1.97100E+0, +1.98200E+0, +1.99200E+0, +2.00300E+0, +2.01300E+0, +2.02400E+0, +2.03400E+0, +2.04500E+0, +2.05500E+0, +2.06600E+0, +2.07600E+0, +2.08700E+0, +2.09700E+0, +2.10800E+0, +2.11800E+0, +2.12900E+0, +2.13900E+0, +2.15000E+0, +2.16000E+0, +2.17100E+0, +2.18100E+0, +2.19200E+0, +2.20200E+0, +2.21300E+0, +2.22300E+0, +2.23400E+0, +2.24400E+0, +2.25500E+0, +2.26500E+0, +2.27600E+0])*1e3 # J/kg-K lam = numpy.array([+1.34100E-1, +1.33200E-1, +1.32400E-1, +1.31500E-1, +1.30600E-1, +1.29700E-1, +1.28800E-1, +1.27900E-1, +1.26900E-1, +1.26000E-1, +1.25000E-1, +1.24100E-1, +1.23100E-1, +1.22100E-1, +1.21100E-1, +1.20100E-1, +1.19100E-1, +1.18100E-1, +1.17100E-1, +1.16100E-1, +1.15000E-1, +1.14000E-1, +1.12900E-1, +1.11900E-1, +1.10800E-1, +1.09700E-1, +1.08600E-1, +1.07500E-1, +1.06400E-1, +1.05300E-1, +1.04200E-1, +1.03000E-1, +1.01900E-1, +1.00800E-1, +9.96000E-2, +9.84400E-2, +9.72800E-2, +9.61000E-2, +9.49200E-2, +9.37300E-2, +9.25300E-2, +9.13300E-2, +9.01200E-2, +8.89100E-2, +8.76800E-2, +8.64500E-2, +8.52200E-2, +8.39800E-2, +8.27300E-2, +8.14700E-2, +8.02100E-2, +7.89500E-2, +7.76700E-2, +7.64000E-2, +7.51100E-2, +7.38200E-2, +7.25300E-2, +7.12300E-2, +6.99200E-2, +6.86100E-2, +6.72900E-2, +6.59700E-2, +6.46500E-2, +6.33100E-2, +6.19800E-2, +6.06400E-2, +5.92900E-2, +5.79400E-2, +5.65800E-2, +5.52300E-2, +5.38600E-2, +5.24900E-2, +5.11200E-2]) # W/m-K mu_dyn = numpy.array([+7.86100E+1, +5.01300E+1, +3.48600E+1, +2.58300E+1, +2.00400E+1, +1.60800E+1, +1.32200E+1, +1.10500E+1, +9.35600E+0, +7.99400E+0, +6.87900E+0, +5.95600E+0, +5.18400E+0, +4.53500E+0, +3.98600E+0, +3.52100E+0, +3.12600E+0, +2.78800E+0, +2.49900E+0, +2.25000E+0, +2.03500E+0, +1.84900E+0, +1.68700E+0, +1.54500E+0, +1.41900E+0, +1.30900E+0, +1.21000E+0, +1.12200E+0, +1.04300E+0, +9.72000E-1, +9.08000E-1, +8.49000E-1, +7.96000E-1, +7.48000E-1, +7.05000E-1, +6.65000E-1, +6.28000E-1, +5.95000E-1, +5.64000E-1, +5.36000E-1, +5.11000E-1, +4.87000E-1, +4.65000E-1, +4.45000E-1, +4.26000E-1, +4.09000E-1, +3.93000E-1, +3.77000E-1, +3.63000E-1, +3.50000E-1, +3.37000E-1, +3.25000E-1, +3.14000E-1, +3.03000E-1, +2.93000E-1, +2.84000E-1, +2.75000E-1, +2.66000E-1, +2.58000E-1, +2.51000E-1, +2.44000E-1, +2.38000E-1, +2.32000E-1, +2.26000E-1, +2.20000E-1, +2.15000E-1, +2.09000E-1, +2.04000E-1, +1.99000E-1, +1.94000E-1, +1.89000E-1, +1.85000E-1, +1.82000E-1])/1000. # Pa-s psat = numpy.array([+0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0])*1e5 # Pa Tmin = numpy.min(T) Tmax = numpy.max(T) TminPsat= Tmax Name = "XLT" Desc = "SylthermXLT" class HC50(LiquidData): """ Heat transfer fluid Dynalene HC-50 Source: Dynalene """ T = numpy.array([+2.23150E+2,+2.33150E+2,+2.43150E+2,+2.53150E+2,+2.63150E+2,+2.73150E+2,+2.83150E+2,+2.93150E+2,+3.03150E+2,+3.13150E+2,+3.23150E+2,+3.33150E+2,+3.43150E+2,+3.53150E+2,+3.63150E+2,+3.73150E+2,+3.83150E+2,+3.93150E+2,+4.03150E+2,+4.13150E+2,+4.23150E+2,+4.33150E+2,+4.43150E+2,+4.53150E+2,+4.63150E+2,+4.73150E+2,+4.83150E+2]) # Kelvin rho = numpy.array([+1.37800E+3,+1.37300E+3,+1.36700E+3,+1.36200E+3,+1.35600E+3,+1.35100E+3,+1.34500E+3,+1.34000E+3,+1.33400E+3,+1.32800E+3,+1.32300E+3,+1.31700E+3,+1.31200E+3,+1.30600E+3,+1.30100E+3,+1.29500E+3,+1.29000E+3,+1.28400E+3,+1.27900E+3,+1.27300E+3,+1.26700E+3,+1.26200E+3,+1.25600E+3,+1.25100E+3,+1.24500E+3,+1.24000E+3,+1.23400E+3]) # kg/m3 c_p = numpy.array([+2.56300E+3,+2.58300E+3,+2.60200E+3,+2.62200E+3,+2.64200E+3,+2.66100E+3,+2.68100E+3,+2.70100E+3,+2.72000E+3,+2.74000E+3,+2.76000E+3,+2.78000E+3,+2.79900E+3,+2.81900E+3,+2.83900E+3,+2.85800E+3,+2.87800E+3,+2.89800E+3,+2.91700E+3,+2.93700E+3,+2.95700E+3,+2.97700E+3,+2.99600E+3,+3.01600E+3,+3.03600E+3,+3.05500E+3,+3.07500E+3]) # J/kg-K lam = numpy.array([+4.35000E+2,+4.45000E+2,+4.55000E+2,+4.65000E+2,+4.75000E+2,+4.85000E+2,+4.95000E+2,+5.05000E+2,+5.15000E+2,+5.25000E+2,+5.35000E+2,+5.45000E+2,+5.55000E+2,+5.65000E+2,+5.75000E+2,+5.85000E+2,+5.95000E+2,+6.05000E+2,+6.15000E+2,+6.25000E+2,+6.35000E+2,+6.45000E+2,+6.55000E+2,+6.65000E+2,+6.75000E+2,+6.85000E+2,+6.94500E+2])/1e3 # W/m-K mu_dyn = numpy.array([+3.84000E-2,+2.04000E-2,+1.25000E-2,+8.40000E-3,+5.99000E-3,+4.70000E-3,+3.80000E-3,+3.20000E-3,+2.70000E-3,+2.40000E-3,+2.40000E-3,+1.80000E-3,+1.60000E-3,+1.50000E-3,+1.30000E-3,+1.20000E-3,+1.10000E-3,+1.00000E-3,+9.40000E-4,+8.70000E-4,+8.10000E-4,+7.60000E-4,+7.10000E-4,+6.60000E-4,+6.20000E-4,+5.80000E-4,+5.50000E-4]) # Pa-s psat = numpy.array([+0.00000E+0,+0.00000E+0,+0.00000E+0,+0.00000E+0,+0.00000E+0,+0.00000E+0,+0.00000E+0,+1.58579E+3,+1.93053E+3,+3.10264E+3,+5.58475E+3,+9.85950E+3,+1.64785E+4,+2.60622E+4,+3.93691E+4,+5.72954E+4,+8.06687E+4,+1.11695E+5,+1.50995E+5,+2.00637E+5,+2.63380E+5,+3.41290E+5,+4.36438E+5,+5.53649E+5,+6.95681E+5,+8.67360E+5,+1.07282E+6]) # Pa Tmin = numpy.min(T) Tmax = numpy.max(T) TminPsat= 20+273.15 Name = "HC50" Desc = "Dynalene "+Name class HC40(LiquidData): """ Heat transfer fluid Dynalene HC-40 Source: Dynalene """ T = numpy.array([+2.33150E+2,+2.43150E+2,+2.53150E+2,+2.63150E+2,+2.73150E+2,+2.83150E+2,+2.93150E+2,+3.03150E+2,+3.13150E+2,+3.23150E+2,+3.33150E+2,+3.43150E+2,+3.53150E+2,+3.63150E+2,+3.73150E+2,+3.83150E+2,+3.93150E+2,+4.03150E+2,+4.13150E+2,+4.23150E+2,+4.33150E+2,+4.38150E+2,+4.43150E+2,+4.53150E+2,+4.63150E+2,+4.73150E+2]) # Kelvin rho = numpy.array([+1.34800E+3,+1.34300E+3,+1.33700E+3,+1.33200E+3,+1.32600E+3,+1.32100E+3,+1.31500E+3,+1.30900E+3,+1.30400E+3,+1.29800E+3,+1.29300E+3,+1.28700E+3,+1.28100E+3,+1.27600E+3,+1.27000E+3,+1.26500E+3,+1.25900E+3,+1.25300E+3,+1.24800E+3,+1.24200E+3,+1.23700E+3,+1.23400E+3,+1.23100E+3,+1.22500E+3,+1.22000E+3,+1.21400E+3]) # kg/m3 c_p = numpy.array([+2.80000E+3,+2.82000E+3,+2.84000E+3,+2.87000E+3,+2.89000E+3,+2.91000E+3,+2.93000E+3,+2.96000E+3,+2.98000E+3,+3.00000E+3,+3.03000E+3,+3.05000E+3,+3.07000E+3,+3.09000E+3,+3.12000E+3,+3.14000E+3,+3.16000E+3,+3.19000E+3,+3.21000E+3,+3.23000E+3,+3.25000E+3,+3.27000E+3,+3.28000E+3,+3.30000E+3,+3.32000E+3,+3.35000E+3]) # J/kg-K lam = numpy.array([+4.49000E+2,+4.59000E+2,+4.69000E+2,+4.79000E+2,+4.89000E+2,+4.99000E+2,+5.09000E+2,+5.19000E+2,+5.29000E+2,+5.39000E+2,+5.49000E+2,+5.59000E+2,+5.69000E+2,+5.79000E+2,+5.89000E+2,+5.99000E+2,+6.09000E+2,+6.19000E+2,+6.29000E+2,+6.39000E+2,+6.49000E+2,+6.54000E+2,+6.59000E+2,+6.69000E+2,+6.79000E+2,+6.89000E+2])/1e3 # W/m-K mu_dyn = numpy.array([+1.49000E-2,+9.20000E-3,+6.50000E-3,+4.90000E-3,+3.90000E-3,+3.20000E-3,+2.70000E-3,+2.30000E-3,+1.96000E-3,+1.70000E-3,+1.50000E-3,+1.40000E-3,+1.20000E-3,+1.10000E-3,+9.90000E-4,+9.10000E-4,+8.30000E-4,+7.70000E-4,+7.10000E-4,+6.60000E-4,+6.10000E-4,+5.90000E-4,+5.70000E-4,+5.30000E-4,+5.00000E-4,+4.70000E-4]) # Pa-s psat = numpy.array([+0.00000E+0,+0.00000E+0,+0.00000E+0,+0.00000E+0,+0.00000E+0,+0.00000E+0,+1.51685E+3,+2.20632E+3,+3.79212E+3,+6.68791E+3,+1.15142E+4,+1.87537E+4,+2.92338E+4,+4.37817E+4,+6.35007E+4,+8.96318E+4,+1.23416E+5,+1.66853E+5,+2.22701E+5,+2.92338E+5,+3.79212E+5,+4.85391E+5,+6.16391E+5,+7.74971E+5,+9.65955E+5,+1.19417E+6]) # Pa Tmin = numpy.min(T) Tmax = numpy.max(T) TminPsat= 20+273.15 Name = "HC40" Desc = "Dynalene "+Name class HC30(LiquidData): """ Heat transfer fluid Dynalene HC-30 Source: Dynalene """ T = numpy.array([+2.43150E+2,+2.53150E+2,+2.63150E+2,+2.73150E+2,+2.83150E+2,+2.93150E+2,+3.03150E+2,+3.13150E+2,+3.23150E+2,+3.33150E+2,+3.43150E+2,+3.53150E+2,+3.63150E+2,+3.73150E+2,+3.83150E+2,+3.93150E+2,+4.03150E+2,+4.13150E+2,+4.23150E+2,+4.33150E+2,+4.43150E+2,+4.53150E+2,+4.63150E+2,+4.73150E+2,+4.83150E+2]) # Kelvin rho = numpy.array([+1.30000E+3,+1.29500E+3,+1.29000E+3,+1.28500E+3,+1.28000E+3,+1.27500E+3,+1.27000E+3,+1.26500E+3,+1.26000E+3,+1.25500E+3,+1.25000E+3,+1.24400E+3,+1.23900E+3,+1.23400E+3,+1.22900E+3,+1.22400E+3,+1.21900E+3,+1.21400E+3,+1.20900E+3,+1.20400E+3,+1.19900E+3,+1.19300E+3,+1.18800E+3,+1.18300E+3,+1.17800E+3]) # kg/m3 c_p = numpy.array([+2.96100E+3,+2.98400E+3,+3.00700E+3,+3.03100E+3,+3.05400E+3,+3.07700E+3,+3.10000E+3,+3.12300E+3,+3.14600E+3,+3.16900E+3,+3.19200E+3,+3.21500E+3,+3.23800E+3,+3.26200E+3,+3.28500E+3,+3.30800E+3,+3.33100E+3,+3.35400E+3,+3.37700E+3,+3.40000E+3,+3.42300E+3,+3.44600E+3,+3.46900E+3,+3.49300E+3,+3.51600E+3]) # J/kg-K lam = numpy.array([+4.69000E+2,+4.79000E+2,+4.89000E+2,+4.99000E+2,+5.09000E+2,+5.19000E+2,+5.29000E+2,+5.39000E+2,+5.49000E+2,+5.59000E+2,+5.69000E+2,+5.79000E+2,+5.89000E+2,+5.99000E+2,+6.09000E+2,+6.19000E+2,+6.29000E+2,+6.39000E+2,+6.49000E+2,+6.59000E+2,+6.69000E+2,+6.79000E+2,+6.89000E+2,+6.99000E+2,+7.09000E+2])/1e3 # W/m-K mu_dyn = numpy.array([+7.00000E-3,+5.50000E-3,+4.50000E-3,+3.70000E-3,+3.00000E-3,+2.50000E-3,+2.20000E-3,+1.90000E-3,+1.60000E-3,+1.40000E-3,+1.30000E-3,+1.10000E-3,+9.90000E-4,+8.90000E-4,+8.00000E-4,+7.30000E-4,+6.70000E-4,+6.10000E-4,+5.70000E-4,+5.20000E-4,+4.80000E-4,+4.50000E-4,+4.20000E-4,+3.90000E-4,+3.70000E-4]) # Pa-s psat = numpy.array([+0.00000E+0,+0.00000E+0,+0.00000E+0,+0.00000E+0,+0.00000E+0,+1.79264E+3,+2.41317E+3,+3.99896E+3,+7.17055E+3,+1.24795E+4,+2.06153E+4,+3.23364E+4,+4.86770E+4,+7.10160E+4,+9.99740E+4,+1.37895E+5,+1.86158E+5,+2.47522E+5,+3.24743E+5,+4.20580E+5,+5.39170E+5,+6.83960E+5,+8.59087E+5,+1.07145E+6,+1.32517E+6]) # Pa Tmin = numpy.min(T) Tmax = numpy.max(T) TminPsat= 20+273.15 Name = "HC30" Desc = "Dynalene "+Name class HC20(LiquidData): """ Heat transfer fluid Dynalene HC-20 Source: Dynalene """ T = numpy.array([+2.53150E+2,+2.63150E+2,+2.73150E+2,+2.83150E+2,+2.93150E+2,+3.03150E+2,+3.13150E+2,+3.23150E+2,+3.33150E+2,+3.43150E+2,+3.53150E+2,+3.63150E+2,+3.73150E+2,+3.83150E+2,+3.93150E+2,+4.03150E+2,+4.13150E+2,+4.23150E+2,+4.33150E+2,+4.43150E+2,+4.53150E+2,+4.63150E+2,+4.73150E+2,+4.83150E+2]) # Kelvin rho = numpy.array([+1.25800E+3,+1.25300E+3,+1.24800E+3,+1.24200E+3,+1.23700E+3,+1.23200E+3,+1.22700E+3,+1.22200E+3,+1.21600E+3,+1.21100E+3,+1.20600E+3,+1.20100E+3,+1.19600E+3,+1.19100E+3,+1.18500E+3,+1.18000E+3,+1.17500E+3,+1.17000E+3,+1.16500E+3,+1.15900E+3,+1.15400E+3,+1.14900E+3,+1.14400E+3,+1.13900E+3]) # kg/m3 c_p = numpy.array([+3.11700E+3,+3.14100E+3,+3.16400E+3,+3.18800E+3,+3.21200E+3,+3.23500E+3,+3.25900E+3,+3.28200E+3,+3.30600E+3,+3.33000E+3,+3.35300E+3,+3.37700E+3,+3.40000E+3,+3.42400E+3,+3.44800E+3,+3.47100E+3,+3.49500E+3,+3.51800E+3,+3.54200E+3,+3.56600E+3,+3.58900E+3,+3.61300E+3,+3.63600E+3,+3.66000E+3]) # J/kg-K lam = numpy.array([+4.83000E+2,+4.93000E+2,+5.03000E+2,+5.13000E+2,+5.23000E+2,+5.33000E+2,+5.43000E+2,+5.53000E+2,+5.63000E+2,+5.73000E+2,+5.83000E+2,+5.93000E+2,+6.03000E+2,+6.13000E+2,+6.23000E+2,+6.33000E+2,+6.43000E+2,+6.53000E+2,+6.63000E+2,+6.73000E+2,+6.83000E+2,+6.93000E+2,+7.03000E+2,+7.13000E+2])/1e3 # W/m-K mu_dyn = numpy.array([+4.50000E-3,+3.60000E-3,+3.00000E-3,+2.50000E-3,+2.10000E-3,+1.80000E-3,+1.60000E-3,+1.40000E-3,+1.20000E-3,+1.10000E-3,+9.50000E-4,+8.50000E-4,+7.70000E-4,+7.00000E-4,+6.30000E-4,+5.80000E-4,+5.40000E-4,+4.90000E-4,+4.60000E-4,+4.30000E-4,+4.00000E-4,+3.70000E-4,+3.50000E-4,+3.30000E-4]) # Pa-s psat = numpy.array([+0.00000E+0,+0.00000E+0,+0.00000E+0,+0.00000E+0,+2.06843E+3,+2.75790E+3,+4.55054E+3,+7.99792E+3,+1.37206E+4,+2.24769E+4,+3.52322E+4,+5.29517E+4,+7.72213E+4,+1.08937E+5,+1.50306E+5,+2.04085E+5,+2.71653E+5,+3.57148E+5,+4.62638E+5,+5.93639E+5,+7.52907E+5,+9.46650E+5,+1.18038E+6,+1.45962E+6]) # Pa Tmin = numpy.min(T) Tmax = numpy.max(T) TminPsat= 20+273.15 Name = "HC20" Desc = "Dynalene "+Name class HC10(LiquidData): """ Heat transfer fluid Dynalene HC-10 Source: Dynalene """ T = numpy.array([+2.63150E+2,+2.73150E+2,+2.83150E+2,+2.93150E+2,+3.03150E+2,+3.13150E+2,+3.23150E+2,+3.33150E+2,+3.43150E+2,+3.53150E+2,+3.63150E+2,+3.73150E+2,+3.83150E+2,+3.93150E+2,+4.03150E+2,+4.13150E+2,+4.23150E+2,+4.33150E+2,+4.43150E+2,+4.53150E+2,+4.63150E+2,+4.73150E+2,+4.83150E+2,+4.91150E+2]) # Kelvin rho = numpy.array([+1.20400E+3,+1.19900E+3,+1.19500E+3,+1.19000E+3,+1.18600E+3,+1.18100E+3,+1.17700E+3,+1.17200E+3,+1.16700E+3,+1.16300E+3,+1.15800E+3,+1.15400E+3,+1.14900E+3,+1.14500E+3,+1.14000E+3,+1.13600E+3,+1.13100E+3,+1.12700E+3,+1.12200E+3,+1.11800E+3,+1.11300E+3,+1.10900E+3,+1.10400E+3,+1.10100E+3]) # kg/m3 c_p = numpy.array([+3.24600E+3,+3.27100E+3,+3.29600E+3,+3.32000E+3,+3.34500E+3,+3.37000E+3,+3.39500E+3,+3.42000E+3,+3.44400E+3,+3.46900E+3,+3.49400E+3,+3.51900E+3,+3.54400E+3,+3.56800E+3,+3.59300E+3,+3.61800E+3,+3.64300E+3,+3.66800E+3,+3.69200E+3,+3.71700E+3,+3.74200E+3,+3.76700E+3,+3.79200E+3,+3.81100E+3]) # J/kg-K lam = numpy.array([+4.94000E+2,+5.04000E+2,+5.14000E+2,+5.24000E+2,+5.34000E+2,+5.44000E+2,+5.54000E+2,+5.64000E+2,+5.74000E+2,+5.84000E+2,+5.94000E+2,+6.04000E+2,+6.14000E+2,+6.24000E+2,+6.34000E+2,+6.44000E+2,+6.54000E+2,+6.64000E+2,+6.74000E+2,+6.84000E+2,+6.94000E+2,+7.04000E+2,+7.14000E+2,+7.22000E+2])/1e3 # W/m-K mu_dyn = numpy.array([+3.00000E-3,+2.50000E-3,+2.10000E-3,+1.80000E-3,+1.50000E-3,+1.30000E-3,+1.20000E-3,+1.00000E-3,+9.10000E-4,+8.10000E-4,+7.30000E-4,+6.60000E-4,+6.00000E-4,+5.50000E-4,+5.10000E-4,+4.70000E-4,+4.30000E-4,+4.00000E-4,+3.70000E-4,+3.50000E-4,+3.30000E-4,+3.10000E-4,+2.90000E-4,+2.80000E-4]) # Pa-s psat = numpy.array([+0.00000E+0,+0.00000E+0,+0.00000E+0,+2.27527E+3,+2.89580E+3,+4.75738E+3,+8.54950E+3,+1.48927E+4,+2.46143E+4,+3.87485E+4,+5.83986E+4,+8.48055E+4,+1.19969E+5,+1.65474E+5,+2.23390E+5,+2.97164E+5,+3.90243E+5,+5.05386E+5,+6.47418E+5,+8.20476E+5,+1.03146E+6,+1.28587E+6,+1.58993E+6,+1.87468E+6]) # Pa Tmin = numpy.min(T) Tmax = numpy.max(T) TminPsat= 20+273.15 Name = "HC10" Desc = "Dynalene "+Name class AS10(LiquidData): """ Heat transfer fluid Aspen Temper -10 by Aspen Petroleum Source: SecCool Software """ T = numpy.array([2.65000E+02, 2.70000E+02, 2.75000E+02, 2.80000E+02, 2.85000E+02, 2.90000E+02, 2.95000E+02, 3.00000E+02]) # Kelvin rho = numpy.array([1.09160E+03, 1.09060E+03, 1.08960E+03, 1.08860E+03, 1.08760E+03, 1.08660E+03, 1.08560E+03, 1.08460E+03]) # kg/m3 c_p = numpy.array([3.52460E+03, 3.53540E+03, 3.54550E+03, 3.55500E+03, 3.56380E+03, 3.57190E+03, 3.57940E+03, 3.58620E+03]) # J/kg-K lam = numpy.array([5.02200E-01, 5.09600E-01, 5.17000E-01, 5.24400E-01, 5.31800E-01, 5.39200E-01, 5.46700E-01, 5.54100E-01]) # W/m-K mu_dyn = numpy.array([3.83600E-03, 3.16000E-03, 2.61300E-03, 2.17700E-03, 1.83700E-03, 1.57700E-03, 1.38200E-03, 1.23500E-03]) # Pa-s psat = numpy.zeros(T.shape) # Pa Tmin = numpy.min(T) Tmax = numpy.max(T) TminPsat= Tmax Name = "AS10" Desc = "Aspen Temper -10" class AS20(LiquidData): """ Heat transfer fluid Aspen Temper -20 by Aspen Petroleum Source: SecCool Software """ T = numpy.array([2.55000E+02, 2.60000E+02, 2.65000E+02, 2.70000E+02, 2.75000E+02, 2.80000E+02, 2.85000E+02, 2.90000E+02, 2.95000E+02, 3.00000E+02]) # Kelvin rho = numpy.array([1.15050E+03, 1.14970E+03, 1.14870E+03, 1.14770E+03, 1.14660E+03, 1.14540E+03, 1.14420E+03, 1.14290E+03, 1.14150E+03, 1.14000E+03]) # kg/m3 c_p = numpy.array([3.20660E+03, 3.22280E+03, 3.23840E+03, 3.25340E+03, 3.26780E+03, 3.28150E+03, 3.29470E+03, 3.30720E+03, 3.31920E+03, 3.33050E+03]) # J/kg-K lam = numpy.array([4.56400E-01, 4.63100E-01, 4.69800E-01, 4.76500E-01, 4.83200E-01, 4.90000E-01, 4.96700E-01, 5.03400E-01, 5.10100E-01, 5.16800E-01]) # W/m-K mu_dyn = numpy.array([7.43800E-03, 5.91400E-03, 4.74900E-03, 3.85900E-03, 3.17900E-03, 2.65900E-03, 2.26100E-03, 1.95800E-03, 1.72500E-03, 1.54800E-03]) # Pa-s psat = numpy.zeros(T.shape) # Pa Tmin = numpy.min(T) Tmax = numpy.max(T) TminPsat= Tmax Name = "AS20" Desc = "Aspen Temper -20" class AS30(LiquidData): """ Heat transfer fluid Aspen Temper -30 by Aspen Petroleum Source: SecCool Software """ T = numpy.array([2.45000E+02, 2.50000E+02, 2.55000E+02, 2.60000E+02, 2.65000E+02, 2.70000E+02, 2.75000E+02, 2.80000E+02, 2.85000E+02, 2.90000E+02, 2.95000E+02, 3.00000E+02]) # Kelvin rho = numpy.array([1.19140E+03, 1.19030E+03, 1.18910E+03, 1.18770E+03, 1.18630E+03, 1.18480E+03, 1.18330E+03, 1.18170E+03, 1.18010E+03, 1.17840E+03, 1.17680E+03, 1.17510E+03]) # kg/m3 c_p = numpy.array([2.96950E+03, 2.99130E+03, 3.01190E+03, 3.03100E+03, 3.04890E+03, 3.06540E+03, 3.08050E+03, 3.09430E+03, 3.10670E+03, 3.11770E+03, 3.12750E+03, 3.13580E+03]) # J/kg-K lam = numpy.array([4.25000E-01, 4.31300E-01, 4.37600E-01, 4.43900E-01, 4.50200E-01, 4.56400E-01, 4.62700E-01, 4.69000E-01, 4.75300E-01, 4.81600E-01, 4.87800E-01, 4.94100E-01]) # W/m-K mu_dyn = numpy.array([1.56400E-02, 1.19300E-02, 9.17800E-03, 7.14000E-03, 5.62900E-03, 4.50900E-03, 3.67900E-03, 3.06400E-03, 2.60800E-03, 2.27000E-03, 2.01900E-03, 1.83400E-03]) # Pa-s psat = numpy.zeros(T.shape) # Pa Tmin = numpy.min(T) Tmax = numpy.max(T) TminPsat= Tmax Name = "AS30" Desc = "Aspen Temper -30" class AS40(LiquidData): """ Heat transfer fluid Aspen Temper -40 by Aspen Petroleum Source: SecCool Software """ T = numpy.array([2.35000E+02, 2.40000E+02, 2.45000E+02, 2.50000E+02, 2.55000E+02, 2.60000E+02, 2.65000E+02, 2.70000E+02, 2.75000E+02, 2.80000E+02, 2.85000E+02, 2.90000E+02, 2.95000E+02, 3.00000E+02]) # Kelvin rho = numpy.array([1.22670E+03, 1.22560E+03, 1.22420E+03, 1.22280E+03, 1.22120E+03, 1.21960E+03, 1.21780E+03, 1.21600E+03, 1.21410E+03, 1.21220E+03, 1.21020E+03, 1.20820E+03, 1.20620E+03, 1.20420E+03]) # kg/m3 c_p = numpy.array([2.83450E+03, 2.85970E+03, 2.88300E+03, 2.90430E+03, 2.92370E+03, 2.94120E+03, 2.95670E+03, 2.97030E+03, 2.98200E+03, 2.99170E+03, 2.99950E+03, 3.00530E+03, 3.00920E+03, 3.01120E+03]) # J/kg-K lam = numpy.array([4.01400E-01, 4.06900E-01, 4.12400E-01, 4.17900E-01, 4.23400E-01, 4.28900E-01, 4.34400E-01, 4.39900E-01, 4.45400E-01, 4.50900E-01, 4.56400E-01, 4.61800E-01, 4.67300E-01, 4.72800E-01]) # W/m-K mu_dyn = numpy.array([4.43400E-02, 3.01000E-02, 2.10800E-02, 1.52600E-02, 1.14300E-02, 8.84100E-03, 7.03900E-03, 5.74200E-03, 4.77600E-03, 4.03200E-03, 3.44300E-03, 2.96300E-03, 2.56600E-03, 2.23100E-03]) # Pa-s psat = numpy.zeros(T.shape) # Pa Tmin = numpy.min(T) Tmax = numpy.max(T) TminPsat= Tmax Name = "AS40" Desc = "Aspen Temper -40" class AS55(LiquidData): """ Heat transfer fluid Aspen Temper -55 by Aspen Petroleum Source: SecCool Software """ T = numpy.array([2.20000E+02, 2.25000E+02, 2.30000E+02, 2.35000E+02, 2.40000E+02, 2.45000E+02, 2.50000E+02, 2.55000E+02, 2.60000E+02, 2.65000E+02, 2.70000E+02, 2.75000E+02, 2.80000E+02, 2.85000E+02, 2.90000E+02, 2.95000E+02, 3.00000E+02]) # Kelvin rho = numpy.array([1.26880E+03, 1.26780E+03, 1.26650E+03, 1.26510E+03, 1.26350E+03, 1.26180E+03, 1.25990E+03, 1.25790E+03, 1.25580E+03, 1.25350E+03, 1.25120E+03, 1.24890E+03, 1.24640E+03, 1.24400E+03, 1.24150E+03, 1.23900E+03, 1.23650E+03]) # kg/m3 c_p = numpy.array([2.64790E+03, 2.67190E+03, 2.69470E+03, 2.71630E+03, 2.73660E+03, 2.75570E+03, 2.77350E+03, 2.79010E+03, 2.80540E+03, 2.81950E+03, 2.83240E+03, 2.84400E+03, 2.85440E+03, 2.86350E+03, 2.87140E+03, 2.87800E+03, 2.88340E+03]) # J/kg-K lam = numpy.array([3.82400E-01, 3.85900E-01, 3.89600E-01, 3.93300E-01, 3.97200E-01, 4.01200E-01, 4.05300E-01, 4.09500E-01, 4.13900E-01, 4.18300E-01, 4.22900E-01, 4.27500E-01, 4.32300E-01, 4.37200E-01, 4.42300E-01, 4.47400E-01, 4.52600E-01]) # W/m-K mu_dyn = numpy.array([2.93600E-01, 1.62700E-01, 9.44200E-02, 5.79500E-02, 3.78300E-02, 2.62200E-02, 1.91500E-02, 1.45600E-02, 1.14000E-02, 9.10600E-03, 7.36900E-03, 6.01200E-03, 4.93000E-03, 4.05600E-03, 3.34300E-03, 2.75900E-03, 2.27800E-03]) # Pa-s psat = numpy.zeros(T.shape) # Pa Tmin = numpy.min(T) Tmax = numpy.max(T) TminPsat= Tmax Name = "AS55" Desc = "Aspen Temper -55" class ZS10(LiquidData): """ Heat transfer fluid Zitrec S -10 by Arteco Source: SecCool Software """ T = numpy.array([2.65000E+02, 2.70000E+02, 2.75000E+02, 2.80000E+02, 2.85000E+02, 2.90000E+02, 2.95000E+02, 3.00000E+02, 3.05000E+02, 3.10000E+02, 3.15000E+02, 3.20000E+02, 3.25000E+02, 3.30000E+02, 3.35000E+02, 3.40000E+02, 3.45000E+02, 3.50000E+02, 3.55000E+02, 3.60000E+02]) # Kelvin rho = numpy.array([1.10250E+03, 1.10020E+03, 1.09790E+03, 1.09550E+03, 1.09320E+03, 1.09090E+03, 1.08860E+03, 1.08630E+03, 1.08390E+03, 1.08160E+03, 1.07930E+03, 1.07700E+03, 1.07470E+03, 1.07230E+03, 1.07000E+03, 1.06770E+03, 1.06540E+03, 1.06300E+03, 1.06070E+03, 1.05840E+03]) # kg/m3 c_p = numpy.array([3.54260E+03, 3.55520E+03, 3.56720E+03, 3.57880E+03, 3.59000E+03, 3.60070E+03, 3.61090E+03, 3.62060E+03, 3.62990E+03, 3.63870E+03, 3.64710E+03, 3.65500E+03, 3.66240E+03, 3.66940E+03, 3.67590E+03, 3.68190E+03, 3.68750E+03, 3.69260E+03, 3.69720E+03, 3.70140E+03]) # J/kg-K lam = numpy.array([4.99700E-01, 5.06300E-01, 5.13000E-01, 5.19600E-01, 5.26200E-01, 5.32800E-01, 5.39400E-01, 5.45900E-01, 5.52500E-01, 5.59000E-01, 5.65500E-01, 5.72000E-01, 5.78500E-01, 5.84900E-01, 5.91400E-01, 5.97800E-01, 6.04300E-01, 6.10700E-01, 6.17100E-01, 6.23400E-01]) # W/m-K mu_dyn = numpy.array([4.51900E-03, 3.75000E-03, 3.14500E-03, 2.66500E-03, 2.28200E-03, 1.97200E-03, 1.72000E-03, 1.51300E-03, 1.34200E-03, 1.20000E-03, 1.08100E-03, 9.80000E-04, 8.94000E-04, 8.21000E-04, 7.58000E-04, 7.03000E-04, 6.56000E-04, 6.14000E-04, 5.77000E-04, 5.44000E-04]) # Pa-s psat = numpy.zeros(T.shape) # Pa Tmin = numpy.min(T) Tmax = numpy.max(T) TminPsat= Tmax Name = "ZS10" Desc = "Zitrec S -10" class ZS25(LiquidData): """ Heat transfer fluid Zitrec S -25 by Arteco Source: SecCool Software """ T = numpy.array([2.50000E+02, 2.55000E+02, 2.60000E+02, 2.65000E+02, 2.70000E+02, 2.75000E+02, 2.80000E+02, 2.85000E+02, 2.90000E+02, 2.95000E+02, 3.00000E+02, 3.05000E+02, 3.10000E+02, 3.15000E+02, 3.20000E+02, 3.25000E+02, 3.30000E+02, 3.35000E+02, 3.40000E+02, 3.45000E+02, 3.50000E+02, 3.55000E+02, 3.60000E+02]) # Kelvin rho = numpy.array([1.20620E+03, 1.20360E+03, 1.20090E+03, 1.19820E+03, 1.19560E+03, 1.19290E+03, 1.19030E+03, 1.18760E+03, 1.18490E+03, 1.18230E+03, 1.17960E+03, 1.17690E+03, 1.17430E+03, 1.17160E+03, 1.16890E+03, 1.16630E+03, 1.16360E+03, 1.16100E+03, 1.15830E+03, 1.15560E+03, 1.15300E+03, 1.15030E+03, 1.14760E+03]) # kg/m3 c_p = numpy.array([3.17680E+03, 3.17880E+03, 3.18090E+03, 3.18290E+03, 3.18500E+03, 3.18710E+03, 3.18920E+03, 3.19130E+03, 3.19340E+03, 3.19550E+03, 3.19760E+03, 3.19980E+03, 3.20200E+03, 3.20410E+03, 3.20630E+03, 3.20850E+03, 3.21070E+03, 3.21290E+03, 3.21520E+03, 3.21740E+03, 3.21970E+03, 3.22200E+03, 3.22420E+03]) # J/kg-K lam = numpy.array([4.43000E-01, 4.49600E-01, 4.56200E-01, 4.62700E-01, 4.69200E-01, 4.75600E-01, 4.81900E-01, 4.88200E-01, 4.94400E-01, 5.00600E-01, 5.06700E-01, 5.12700E-01, 5.18700E-01, 5.24600E-01, 5.30400E-01, 5.36200E-01, 5.42000E-01, 5.47700E-01, 5.53300E-01, 5.58800E-01, 5.64300E-01, 5.69800E-01, 5.75200E-01]) # W/m-K mu_dyn = numpy.array([1.06800E-02, 8.37400E-03, 6.68600E-03, 5.42800E-03, 4.47800E-03, 3.74900E-03, 3.18300E-03, 2.73800E-03, 2.38400E-03, 2.10000E-03, 1.86800E-03, 1.67800E-03, 1.52000E-03, 1.38800E-03, 1.27500E-03, 1.17900E-03, 1.09500E-03, 1.02100E-03, 9.55000E-04, 8.95000E-04, 8.40000E-04, 7.89000E-04, 7.40000E-04]) # Pa-s psat = numpy.zeros(T.shape) # Pa Tmin = numpy.min(T) Tmax = numpy.max(T) TminPsat= Tmax Name = "ZS25" Desc = "Zitrec S -25" class ZS40(LiquidData): """ Heat transfer fluid Zitrec S -40 by Arteco Source: SecCool Software """ T = numpy.array([2.35000E+02, 2.40000E+02, 2.45000E+02, 2.50000E+02, 2.55000E+02, 2.60000E+02, 2.65000E+02, 2.70000E+02, 2.75000E+02, 2.80000E+02, 2.85000E+02, 2.90000E+02, 2.95000E+02, 3.00000E+02, 3.05000E+02, 3.10000E+02, 3.15000E+02, 3.20000E+02, 3.25000E+02, 3.30000E+02, 3.35000E+02, 3.40000E+02, 3.45000E+02, 3.50000E+02, 3.55000E+02, 3.60000E+02]) # Kelvin rho = numpy.array([1.28360E+03, 1.28080E+03, 1.27800E+03, 1.27510E+03, 1.27230E+03, 1.26940E+03, 1.26660E+03, 1.26380E+03, 1.26090E+03, 1.25810E+03, 1.25530E+03, 1.25240E+03, 1.24960E+03, 1.24680E+03, 1.24390E+03, 1.24110E+03, 1.23820E+03, 1.23540E+03, 1.23260E+03, 1.22970E+03, 1.22690E+03, 1.22410E+03, 1.22120E+03, 1.21840E+03, 1.21550E+03, 1.21270E+03]) # kg/m3 c_p = numpy.array([2.69640E+03, 2.70500E+03, 2.71320E+03, 2.72100E+03, 2.72850E+03, 2.73570E+03, 2.74260E+03, 2.74940E+03, 2.75600E+03, 2.76250E+03, 2.76900E+03, 2.77540E+03, 2.78190E+03, 2.78850E+03, 2.79530E+03, 2.80220E+03, 2.80930E+03, 2.81670E+03, 2.82440E+03, 2.83250E+03, 2.84100E+03, 2.85000E+03, 2.85950E+03, 2.86950E+03, 2.88010E+03, 2.89140E+03]) # J/kg-K lam = numpy.array([4.15100E-01, 4.20500E-01, 4.25800E-01, 4.31200E-01, 4.36500E-01, 4.41800E-01, 4.47200E-01, 4.52500E-01, 4.57800E-01, 4.63100E-01, 4.68400E-01, 4.73600E-01, 4.78900E-01, 4.84200E-01, 4.89400E-01, 4.94700E-01, 4.99900E-01, 5.05200E-01, 5.10400E-01, 5.15600E-01, 5.20800E-01, 5.26000E-01, 5.31200E-01, 5.36400E-01, 5.41600E-01, 5.46800E-01]) # W/m-K mu_dyn = numpy.array([3.10200E-02, 2.28600E-02, 1.72100E-02, 1.32300E-02, 1.03600E-02, 8.26100E-03, 6.70400E-03, 5.53000E-03, 4.63200E-03, 3.93600E-03, 3.38900E-03, 2.95500E-03, 2.60700E-03, 2.32300E-03, 2.09100E-03, 1.89800E-03, 1.73500E-03, 1.59700E-03, 1.47900E-03, 1.37500E-03, 1.28400E-03, 1.20200E-03, 1.12700E-03, 1.05800E-03, 9.93000E-04, 9.30000E-04]) # Pa-s psat = numpy.zeros(T.shape) # Pa Tmin = numpy.min(T) Tmax = numpy.max(T) TminPsat= Tmax Name = "ZS40" Desc = "Zitrec S -40" class ZS45(LiquidData): """ Heat transfer fluid Zitrec S -45 by Arteco Source: SecCool Software """ T = numpy.array([2.30000E+02, 2.35000E+02, 2.40000E+02, 2.45000E+02, 2.50000E+02, 2.55000E+02, 2.60000E+02, 2.65000E+02, 2.70000E+02, 2.75000E+02, 2.80000E+02, 2.85000E+02, 2.90000E+02, 2.95000E+02, 3.00000E+02, 3.05000E+02, 3.10000E+02, 3.15000E+02, 3.20000E+02, 3.25000E+02, 3.30000E+02, 3.35000E+02, 3.40000E+02, 3.45000E+02, 3.50000E+02, 3.55000E+02, 3.60000E+02]) # Kelvin rho = numpy.array([1.30590E+03, 1.30320E+03, 1.30040E+03, 1.29760E+03, 1.29490E+03, 1.29210E+03, 1.28940E+03, 1.28660E+03, 1.28380E+03, 1.28110E+03, 1.27830E+03, 1.27550E+03, 1.27280E+03, 1.27000E+03, 1.26730E+03, 1.26450E+03, 1.26170E+03, 1.25900E+03, 1.25620E+03, 1.25340E+03, 1.25070E+03, 1.24790E+03, 1.24520E+03, 1.24240E+03, 1.23960E+03, 1.23690E+03, 1.23410E+03]) # kg/m3 c_p = numpy.array([2.55240E+03, 2.56350E+03, 2.57450E+03, 2.58550E+03, 2.59650E+03, 2.60760E+03, 2.61860E+03, 2.62960E+03, 2.64070E+03, 2.65170E+03, 2.66270E+03, 2.67370E+03, 2.68480E+03, 2.69580E+03, 2.70680E+03, 2.71790E+03, 2.72890E+03, 2.73990E+03, 2.75090E+03, 2.76200E+03, 2.77300E+03, 2.78400E+03, 2.79510E+03, 2.80610E+03, 2.81710E+03, 2.82810E+03, 2.83920E+03]) # J/kg-K lam = numpy.array([4.06200E-01, 4.11100E-01, 4.15900E-01, 4.20900E-01, 4.25800E-01, 4.30700E-01, 4.35700E-01, 4.40600E-01, 4.45600E-01, 4.50600E-01, 4.55700E-01, 4.60700E-01, 4.65800E-01, 4.70900E-01, 4.76000E-01, 4.81100E-01, 4.86200E-01, 4.91400E-01, 4.96600E-01, 5.01700E-01, 5.07000E-01, 5.12200E-01, 5.17400E-01, 5.22700E-01, 5.28000E-01, 5.33300E-01, 5.38600E-01]) # W/m-K mu_dyn = numpy.array([4.97400E-02, 3.53200E-02, 2.57000E-02, 1.91400E-02, 1.45700E-02, 1.13300E-02, 8.99200E-03, 7.27000E-03, 5.98200E-03, 5.00500E-03, 4.25200E-03, 3.66500E-03, 3.20000E-03, 2.82800E-03, 2.52700E-03, 2.28000E-03, 2.07500E-03, 1.90300E-03, 1.75600E-03, 1.62900E-03, 1.51800E-03, 1.41800E-03, 1.32800E-03, 1.24400E-03, 1.16500E-03, 1.08900E-03, 1.01600E-03]) # Pa-s psat = numpy.zeros(T.shape) # Pa Tmin = numpy.min(T) Tmax = numpy.max(T) TminPsat= Tmax Name = "ZS45" Desc = "Zitrec S -45" class ZS55(LiquidData): """ Heat transfer fluid Zitrec S -55 by Arteco Source: SecCool Software """ T = numpy.array([2.20000E+02, 2.25000E+02, 2.30000E+02, 2.35000E+02, 2.40000E+02, 2.45000E+02, 2.50000E+02, 2.55000E+02, 2.60000E+02, 2.65000E+02, 2.70000E+02, 2.75000E+02, 2.80000E+02, 2.85000E+02, 2.90000E+02, 2.95000E+02, 3.00000E+02, 3.05000E+02, 3.10000E+02, 3.15000E+02, 3.20000E+02, 3.25000E+02, 3.30000E+02, 3.35000E+02, 3.40000E+02, 3.45000E+02, 3.50000E+02, 3.55000E+02, 3.60000E+02]) # Kelvin rho = numpy.array([1.35580E+03, 1.35280E+03, 1.34980E+03, 1.34680E+03, 1.34380E+03, 1.34070E+03, 1.33770E+03, 1.33470E+03, 1.33170E+03, 1.32870E+03, 1.32560E+03, 1.32260E+03, 1.31960E+03, 1.31660E+03, 1.31350E+03, 1.31050E+03, 1.30750E+03, 1.30450E+03, 1.30150E+03, 1.29840E+03, 1.29540E+03, 1.29240E+03, 1.28940E+03, 1.28630E+03, 1.28330E+03, 1.28030E+03, 1.27730E+03, 1.27430E+03, 1.27120E+03]) # kg/m3 c_p = numpy.array([2.43970E+03, 2.44650E+03, 2.45350E+03, 2.46070E+03, 2.46810E+03, 2.47580E+03, 2.48380E+03, 2.49190E+03, 2.50030E+03, 2.50900E+03, 2.51780E+03, 2.52700E+03, 2.53630E+03, 2.54590E+03, 2.55570E+03, 2.56580E+03, 2.57610E+03, 2.58660E+03, 2.59740E+03, 2.60840E+03, 2.61970E+03, 2.63120E+03, 2.64290E+03, 2.65480E+03, 2.66700E+03, 2.67950E+03, 2.69210E+03, 2.70500E+03, 2.71820E+03]) # J/kg-K lam = numpy.array([3.93100E-01, 3.97000E-01, 4.01000E-01, 4.05100E-01, 4.09100E-01, 4.13200E-01, 4.17300E-01, 4.21400E-01, 4.25600E-01, 4.29700E-01, 4.33900E-01, 4.38200E-01, 4.42400E-01, 4.46700E-01, 4.51000E-01, 4.55400E-01, 4.59700E-01, 4.64100E-01, 4.68500E-01, 4.73000E-01, 4.77500E-01, 4.82000E-01, 4.86500E-01, 4.91000E-01, 4.95600E-01, 5.00200E-01, 5.04800E-01, 5.09500E-01, 5.14200E-01]) # W/m-K mu_dyn = numpy.array([1.44300E-01, 9.52000E-02, 6.46500E-02, 4.51300E-02, 3.23400E-02, 2.37700E-02, 1.78900E-02, 1.37800E-02, 1.08400E-02, 8.69800E-03, 7.11600E-03, 5.92500E-03, 5.01500E-03, 4.31100E-03, 3.75700E-03, 3.31700E-03, 2.96200E-03, 2.67300E-03, 2.43300E-03, 2.23300E-03, 2.06300E-03, 1.91500E-03, 1.78600E-03, 1.67000E-03, 1.56500E-03, 1.46600E-03, 1.37300E-03, 1.28300E-03, 1.19400E-03]) # Pa-s psat = numpy.zeros(T.shape) # Pa Tmin = numpy.min(T) Tmax = numpy.max(T) TminPsat= Tmax Name = "ZS55" Desc = "Zitrec S -55" #class SylthermXLT(LiquidData): # """ # Heat transfer fluid Syltherm XLT by Dow Chemicals # Source: Dow Chemicals data sheet # """ # T = numpy.array([-1.00000E+2, -9.50000E+1, -9.00000E+1, -8.50000E+1, -8.00000E+1, -7.50000E+1, -7.00000E+1, -6.50000E+1, -6.00000E+1, -5.50000E+1, -5.00000E+1, -4.50000E+1, -4.00000E+1, -3.50000E+1, -3.00000E+1, -2.50000E+1, -2.00000E+1, -1.50000E+1, -1.00000E+1, -5.00000E+0, +0.00000E+0, +5.00000E+0, +1.00000E+1, +1.50000E+1, +2.00000E+1, +2.50000E+1, +3.00000E+1, +3.50000E+1, +4.00000E+1, +4.50000E+1, +5.00000E+1, +5.50000E+1, +6.00000E+1, +6.50000E+1, +7.00000E+1, +7.50000E+1, +8.00000E+1, +8.50000E+1, +9.00000E+1, +9.50000E+1, +1.00000E+2, +1.05000E+2, +1.10000E+2, +1.15000E+2, +1.20000E+2, +1.25000E+2, +1.30000E+2, +1.35000E+2, +1.40000E+2, +1.45000E+2, +1.50000E+2, +1.55000E+2, +1.60000E+2, +1.65000E+2, +1.70000E+2, +1.75000E+2, +1.80000E+2, +1.85000E+2, +1.90000E+2, +1.95000E+2, +2.00000E+2, +2.05000E+2, +2.10000E+2, +2.15000E+2, +2.20000E+2, +2.25000E+2, +2.30000E+2, +2.35000E+2, +2.40000E+2, +2.45000E+2, +2.50000E+2, +2.55000E+2, +2.60000E+2])+273.15 # Kelvin # rho = numpy.array([+9.78500E+2, +9.73400E+2, +9.68300E+2, +9.63100E+2, +9.58000E+2, +9.52900E+2, +9.47700E+2, +9.42600E+2, +9.37500E+2, +9.32300E+2, +9.27200E+2, +9.22000E+2, +9.16900E+2, +9.11800E+2, +9.06600E+2, +9.01500E+2, +8.96400E+2, +8.91200E+2, +8.86100E+2, +8.81000E+2, +8.75800E+2, +8.70700E+2, +8.65500E+2, +8.60400E+2, +8.55300E+2, +8.50100E+2, +8.45000E+2, +8.39900E+2, +8.34700E+2, +8.29600E+2, +8.24500E+2, +8.19300E+2, +8.14200E+2, +8.09100E+2, +8.03900E+2, +7.98800E+2, +7.93600E+2, +7.88500E+2, +7.83400E+2, +7.78200E+2, +7.73100E+2, +7.68000E+2, +7.62800E+2, +7.57700E+2, +7.52600E+2, +7.47400E+2, +7.42300E+2, +7.37200E+2, +7.32000E+2, +7.26900E+2, +7.21700E+2, +7.16600E+2, +7.11500E+2, +7.06300E+2, +7.01200E+2, +6.96100E+2, +6.90900E+2, +6.85800E+2, +6.80700E+2, +6.75500E+2, +6.70400E+2, +6.65300E+2, +6.60100E+2, +6.55000E+2, +6.49800E+2, +6.44700E+2, +6.39600E+2, +6.34400E+2, +6.29300E+2, +6.24200E+2, +6.19000E+2, +6.13900E+2, +6.08800E+2]) # kg/m3 # c_p = numpy.array([+1.52000E+0, +1.53000E+0, +1.54100E+0, +1.55100E+0, +1.56200E+0, +1.57200E+0, +1.58300E+0, +1.59300E+0, +1.60400E+0, +1.61400E+0, +1.62500E+0, +1.63500E+0, +1.64600E+0, +1.65600E+0, +1.66700E+0, +1.67700E+0, +1.68800E+0, +1.69800E+0, +1.70900E+0, +1.71900E+0, +1.73000E+0, +1.74000E+0, +1.75100E+0, +1.76100E+0, +1.77200E+0, +1.78200E+0, +1.79300E+0, +1.80300E+0, +1.81400E+0, +1.82400E+0, +1.83500E+0, +1.84500E+0, +1.85600E+0, +1.86600E+0, +1.87700E+0, +1.88700E+0, +1.89800E+0, +1.90800E+0, +1.91900E+0, +1.92900E+0, +1.94000E+0, +1.95000E+0, +1.96100E+0, +1.97100E+0, +1.98200E+0, +1.99200E+0, +2.00300E+0, +2.01300E+0, +2.02400E+0, +2.03400E+0, +2.04500E+0, +2.05500E+0, +2.06600E+0, +2.07600E+0, +2.08700E+0, +2.09700E+0, +2.10800E+0, +2.11800E+0, +2.12900E+0, +2.13900E+0, +2.15000E+0, +2.16000E+0, +2.17100E+0, +2.18100E+0, +2.19200E+0, +2.20200E+0, +2.21300E+0, +2.22300E+0, +2.23400E+0, +2.24400E+0, +2.25500E+0, +2.26500E+0, +2.27600E+0])*1e3 # J/kg-K # lam = numpy.array([+1.34100E-1, +1.33200E-1, +1.32400E-1, +1.31500E-1, +1.30600E-1, +1.29700E-1, +1.28800E-1, +1.27900E-1, +1.26900E-1, +1.26000E-1, +1.25000E-1, +1.24100E-1, +1.23100E-1, +1.22100E-1, +1.21100E-1, +1.20100E-1, +1.19100E-1, +1.18100E-1, +1.17100E-1, +1.16100E-1, +1.15000E-1, +1.14000E-1, +1.12900E-1, +1.11900E-1, +1.10800E-1, +1.09700E-1, +1.08600E-1, +1.07500E-1, +1.06400E-1, +1.05300E-1, +1.04200E-1, +1.03000E-1, +1.01900E-1, +1.00800E-1, +9.96000E-2, +9.84400E-2, +9.72800E-2, +9.61000E-2, +9.49200E-2, +9.37300E-2, +9.25300E-2, +9.13300E-2, +9.01200E-2, +8.89100E-2, +8.76800E-2, +8.64500E-2, +8.52200E-2, +8.39800E-2, +8.27300E-2, +8.14700E-2, +8.02100E-2, +7.89500E-2, +7.76700E-2, +7.64000E-2, +7.51100E-2, +7.38200E-2, +7.25300E-2, +7.12300E-2, +6.99200E-2, +6.86100E-2, +6.72900E-2, +6.59700E-2, +6.46500E-2, +6.33100E-2, +6.19800E-2, +6.06400E-2, +5.92900E-2, +5.79400E-2, +5.65800E-2, +5.52300E-2, +5.38600E-2, +5.24900E-2, +5.11200E-2]) # W/m-K # mu_dyn = numpy.array([+7.86100E+1, +5.01300E+1, +3.48600E+1, +2.58300E+1, +2.00400E+1, +1.60800E+1, +1.32200E+1, +1.10500E+1, +9.35600E+0, +7.99400E+0, +6.87900E+0, +5.95600E+0, +5.18400E+0, +4.53500E+0, +3.98600E+0, +3.52100E+0, +3.12600E+0, +2.78800E+0, +2.49900E+0, +2.25000E+0, +2.03500E+0, +1.84900E+0, +1.68700E+0, +1.54500E+0, +1.41900E+0, +1.30900E+0, +1.21000E+0, +1.12200E+0, +1.04300E+0, +9.72000E-1, +9.08000E-1, +8.49000E-1, +7.96000E-1, +7.48000E-1, +7.05000E-1, +6.65000E-1, +6.28000E-1, +5.95000E-1, +5.64000E-1, +5.36000E-1, +5.11000E-1, +4.87000E-1, +4.65000E-1, +4.45000E-1, +4.26000E-1, +4.09000E-1, +3.93000E-1, +3.77000E-1, +3.63000E-1, +3.50000E-1, +3.37000E-1, +3.25000E-1, +3.14000E-1, +3.03000E-1, +2.93000E-1, +2.84000E-1, +2.75000E-1, +2.66000E-1, +2.58000E-1, +2.51000E-1, +2.44000E-1, +2.38000E-1, +2.32000E-1, +2.26000E-1, +2.20000E-1, +2.15000E-1, +2.09000E-1, +2.04000E-1, +1.99000E-1, +1.94000E-1, +1.89000E-1, +1.85000E-1, +1.82000E-1])/1000. # Pa-s # psat = numpy.array([+0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0, +0.00000E+0])*1e5 # Pa # Tmin = numpy.min(T) # Tmax = numpy.max(T) # TminPsat= Tmax # Name = "XLT" # Desc = "SylthermXLT" # output #dataObj = Therminol72() #for i in range(len(dataObj.T)): # print str(dataObj.T[i])+", "+str(numpy.log(dataObj.mu_dyn[i])) class SolutionData(LiquidData): """ A base class that defines all the variables needed in order to make a proper fit for solution data. """ Name = None # Name of the current fluid Desc = None # Name of the current fluid Tmin = None # Minimum temperature in K TminPsat = None # Minimum saturation temperature in K Tmax = None # Maximum temperature in K xmin = None # Minimum concentration in weight fraction xmax = None # Minimum concentration in weight fraction Tbase = None # Base temperature for data fit in K xbase = None # Base concentration for data fit in weight fraction # Data points x = None # Concentration data points in weight fraction T = None # Temperature for data points in K rho = None # Density in kg/m3 c_p = None # Heat capacity in J/(kg.K) lam = None # Thermal conductivity in W/(m.K) mu_dyn = None # Dynamic viscosity in Pa.s psat = None # Saturation pressure in Pa Tfreeze = None # Freezing temperature in K
133.008913
1,071
0.612868
15,812
74,618
2.885656
0.097774
0.015955
0.037345
0.039055
0.561979
0.468616
0.448299
0.444245
0.406417
0.394538
0
0.510415
0.128186
74,618
560
1,072
133.246429
0.190983
0.1518
0
0.345714
0
0
0.006094
0
0
0
0
0
0
1
0.025714
false
0
0.002857
0.025714
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
1
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
5
18337bd2ec8d9af71743d0aaee8d700175777dcf
183
py
Python
systeminfo/main.py
Slaporter/comp30670-assignment2
9688bc0c84b3e97ba56623ba6961a0f27b6a75a9
[ "BSD-3-Clause" ]
null
null
null
systeminfo/main.py
Slaporter/comp30670-assignment2
9688bc0c84b3e97ba56623ba6961a0f27b6a75a9
[ "BSD-3-Clause" ]
null
null
null
systeminfo/main.py
Slaporter/comp30670-assignment2
9688bc0c84b3e97ba56623ba6961a0f27b6a75a9
[ "BSD-3-Clause" ]
null
null
null
''' Created on 25 Jan 2018 @author: Slaporter ''' import platform def get_platform_info(): return (platform.platform()) if __name__ == '__main__': get_platform_info()
14.076923
32
0.677596
22
183
5.090909
0.727273
0.196429
0.267857
0
0
0
0
0
0
0
0
0.040816
0.196721
183
13
33
14.076923
0.721088
0.229508
0
0
0
0
0.059701
0
0
0
0
0
0
1
0.2
true
0
0.2
0.2
0.6
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
1
1
0
0
5
1862bbcb7fca803bcf122777aeefae54fb15d546
152
py
Python
main.py
AshishKapoor/learning-fastapi
303268b85d4825b4b93f07d098a74d39f57192cb
[ "MIT" ]
null
null
null
main.py
AshishKapoor/learning-fastapi
303268b85d4825b4b93f07d098a74d39f57192cb
[ "MIT" ]
null
null
null
main.py
AshishKapoor/learning-fastapi
303268b85d4825b4b93f07d098a74d39f57192cb
[ "MIT" ]
null
null
null
from imp import reload from operator import truediv import uvicorn if __name__ == "__main__": uvicorn.run("app.api:app", port="8000", reload=True)
21.714286
56
0.736842
22
152
4.727273
0.727273
0
0
0
0
0
0
0
0
0
0
0.030769
0.144737
152
6
57
25.333333
0.769231
0
0
0
0
0
0.151316
0
0
0
0
0
0
1
0
true
0
0.6
0
0.6
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
187a101d0172d6ce6bea730b1f1f0d870935e907
481
py
Python
tests/test_inverse.py
d21d3q/thermalprinter
a502fe8a7b7ab5a0773e92a37e6539f73b34b950
[ "MIT" ]
28
2016-08-31T15:50:38.000Z
2022-03-24T15:19:17.000Z
tests/test_inverse.py
d21d3q/thermalprinter
a502fe8a7b7ab5a0773e92a37e6539f73b34b950
[ "MIT" ]
11
2016-09-28T15:46:46.000Z
2021-03-09T16:37:13.000Z
tests/test_inverse.py
d21d3q/thermalprinter
a502fe8a7b7ab5a0773e92a37e6539f73b34b950
[ "MIT" ]
10
2017-03-02T19:08:15.000Z
2021-02-19T16:11:06.000Z
# coding: utf-8 def test_default_value(printer): assert printer._inverse is False def test_changing_no_value(printer): printer.inverse() assert printer._inverse is False def test_changing_state_on(printer): printer.inverse(True) assert printer._inverse is True def test_changing_state_off(printer): printer.inverse(False) assert printer._inverse is False def test_reset_value(printer): printer.reset() assert printer._inverse is False
18.5
37
0.754678
66
481
5.227273
0.287879
0.324638
0.289855
0.318841
0.42029
0.342029
0.342029
0.243478
0
0
0
0.002513
0.172557
481
25
38
19.24
0.864322
0.027027
0
0.285714
0
0
0
0
0
0
0
0
0.357143
1
0.357143
false
0
0
0
0.357143
1
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
1
0
5
187a6f0611f614062b3b6e7a9bdfcf1ce307cf0b
332
py
Python
app/main/errors.py
kennjr/Pitch
6f431f73ed9e90999ff9bd546ee0490d1943fc74
[ "MIT" ]
null
null
null
app/main/errors.py
kennjr/Pitch
6f431f73ed9e90999ff9bd546ee0490d1943fc74
[ "MIT" ]
null
null
null
app/main/errors.py
kennjr/Pitch
6f431f73ed9e90999ff9bd546ee0490d1943fc74
[ "MIT" ]
null
null
null
from flask import render_template from urllib import error # @app.errorhandler(404) from app.main import main @main.app_errorhandler(404) def page_not_found(error): return render_template('404_page.html'), 404 @main.app_errorhandler(error.HTTPError) def http_error(error): return render_template('404_page.html'), 404
19.529412
48
0.78012
49
332
5.081633
0.387755
0.168675
0.144578
0.200803
0.313253
0.313253
0.313253
0.313253
0
0
0
0.061644
0.120482
332
16
49
20.75
0.791096
0.066265
0
0.222222
0
0
0.084416
0
0
0
0
0
0
1
0.222222
false
0
0.333333
0.222222
0.777778
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
1
1
1
0
0
5
a10fa0da552167ce71ece704eb015ed28f0a164b
1,693
py
Python
haziris/examples/google_timeline_grouping.py
haziris/haziris-python
c078b6bc73187ba1cfa24b3dbcf7979a6d17e9c2
[ "BSD-3-Clause" ]
1
2020-08-27T06:25:58.000Z
2020-08-27T06:25:58.000Z
haziris/examples/google_timeline_grouping.py
haziris/haziris-python
c078b6bc73187ba1cfa24b3dbcf7979a6d17e9c2
[ "BSD-3-Clause" ]
null
null
null
haziris/examples/google_timeline_grouping.py
haziris/haziris-python
c078b6bc73187ba1cfa24b3dbcf7979a6d17e9c2
[ "BSD-3-Clause" ]
null
null
null
import pandas as pd import haziris as hz df = pd.DataFrame([ ['President' , 'George Washington', '1789-04-30 00:00:00', '1797-03-04 00:00:00' ], ['President' , 'John Adams' , '1797-03-04 00:00:00', '1801-03-04 00:00:00' ], ['President' , 'Thomas Jefferson' , '1801-03-04 00:00:00', '1809-03-04 00:00:00' ], ['Vice President' , 'John Adams' , '1789-04-21 00:00:00', '1797-03-04 00:00:00' ], ['Vice President' , 'Thomas Jefferson' , '1797-03-04 00:00:00', '1801-03-04 00:00:00' ], ['Vice President' , 'Aaron Burr' , '1801-03-04 00:00:00', '1805-03-04 00:00:00' ], ['Vice President' , 'George Clinton' , '1805-03-04 00:00:00', '1812-04-20 00:00:00' ], ['Secretary of State', 'John Jay' , '1789-09-26 00:00:00', '1790-03-22 00:00:00' ], ['Secretary of State', 'Thomas Jefferson' , '1790-03-22 00:00:00', '1793-12-31 00:00:00' ], ['Secretary of State', 'Edmund Randolph' , '1794-01-02 00:00:00', '1795-08-20 00:00:00' ], ['Secretary of State', 'Timothy Pickering', '1795-08-20 00:00:00', '1800-05-12 00:00:00' ], ['Secretary of State', 'Charles Lee' , '1800-05-13 00:00:00', '1800-06-05 00:00:00' ], ['Secretary of State', 'John Marshall' , '1800-06-13 00:00:00', '1801-03-04 00:00:00' ], ['Secretary of State', 'Levi Lincoln' , '1801-03-05 00:00:00', '1801-05-01 00:00:00' ], ['Secretary of State', 'James Madison' , '1801-05-02 00:00:00', '1809-03-03 00:00:00' ] ], columns = ['Position', 'Name', 'Start', 'End'] ) options = { 'timeline': { 'showRowLabels': False } } hz.google_timeline_chart( df, "google_timeline_grouping.html", options )
54.612903
95
0.576491
275
1,693
3.534545
0.272727
0.246914
0.185185
0.098765
0.506173
0.489712
0.273663
0.119342
0.119342
0.057613
0
0.312268
0.205552
1,693
30
96
56.433333
0.410409
0
0
0
0
0
0.629061
0.017129
0
0
0
0
0
1
0
false
0
0.074074
0
0.074074
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
a132837bca49c2f935b365e9f1057ac4607c0c1f
6,148
py
Python
im/ib/ib_sql_writer_backend.py
ajmal017/amp
8de7e3b88be87605ec3bad03c139ac64eb460e5c
[ "BSD-3-Clause" ]
null
null
null
im/ib/ib_sql_writer_backend.py
ajmal017/amp
8de7e3b88be87605ec3bad03c139ac64eb460e5c
[ "BSD-3-Clause" ]
null
null
null
im/ib/ib_sql_writer_backend.py
ajmal017/amp
8de7e3b88be87605ec3bad03c139ac64eb460e5c
[ "BSD-3-Clause" ]
null
null
null
import pandas as pd import psycopg2.extras as pextra import im.common.data.types as icdtyp import im.common.sql_writer_backend as icsqlw class IbSqlWriterBackend(icsqlw.AbstractSqlWriterBackend): """ Manager of CRUD operations on a database defined in db.sql. """ FREQ_ATTR_MAPPING = { icdtyp.Frequency.Daily: { "table_name": "IbDailyData", "datetime_field_name": "date", }, icdtyp.Frequency.Minutely: { "table_name": "IbMinuteData", "datetime_field_name": "datetime", }, icdtyp.Frequency.Tick: { "table_name": "IbTickData", "datetime_field_name": "datetime", }, } def insert_bulk_daily_data( self, df: pd.DataFrame, ) -> None: """ Insert daily data for a particular TradeSymbol entry in bulk. :param df: a dataframe from s3 """ with self.conn: with self.conn.cursor() as curs: pextra.execute_values( curs, "INSERT INTO IbDailyData " "(trade_symbol_id, date, open, high, low, close, volume, average, barCount) " "VALUES %s ON CONFLICT DO NOTHING", df.to_dict("records"), template="(%(trade_symbol_id)s, %(date)s, %(open)s," " %(high)s, %(low)s, %(close)s, %(volume)s, %(average)s, %(barCount)s)", ) def insert_daily_data( self, trade_symbol_id: int, date: str, open_val: float, high_val: float, low_val: float, close_val: float, volume_val: int, average_val: float, bar_count_val: int, ) -> None: """ Insert daily data for a particular TradeSymbol entry. :param trade_symbol_id: id of TradeSymbol :param date: date string :param open_val: open price :param high_val: high price :param low_val: low price :param close_val: close price :param volume_val: volume :param average_val: average :param bar_count_val: bar count """ with self.conn: with self.conn.cursor() as curs: curs.execute( "INSERT INTO IbDailyData " "(trade_symbol_id, date, open, high, low, close, volume, average, barCount) " "VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s) ON CONFLICT DO NOTHING", [ trade_symbol_id, date, open_val, high_val, low_val, close_val, volume_val, average_val, bar_count_val, ], ) def insert_bulk_minute_data( self, df: pd.DataFrame, ) -> None: """ Insert minute data for a particular TradeSymbol entry in bulk. :param df: a dataframe from s3 """ with self.conn: with self.conn.cursor() as curs: pextra.execute_values( curs, "INSERT INTO IbMinuteData " "(trade_symbol_id, datetime, open, high, low, close, " "volume, average, barCount) " "VALUES %s ON CONFLICT DO NOTHING", df.to_dict("records"), template="(%(trade_symbol_id)s, %(datetime)s, %(open)s," " %(high)s, %(low)s, %(close)s, %(volume)s, %(average)s, %(barCount)s)", ) def insert_minute_data( self, trade_symbol_id: int, date_time: str, open_val: float, high_val: float, low_val: float, close_val: float, volume_val: int, average_val: float, bar_count_val: int, ) -> None: """ Insert minute data for a particular TradeSymbol entry. :param trade_symbol_id: id of TradeSymbol :param date_time: date and time string :param open_val: open price :param high_val: high price :param low_val: low price :param close_val: close price :param volume_val: volume :param average_val: average :param bar_count_val: bar count """ with self.conn: with self.conn.cursor() as curs: curs.execute( "INSERT INTO IbMinuteData " "(trade_symbol_id, datetime, open, high, low, close, " "volume, average, barCount) " "VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s) ON CONFLICT DO NOTHING", [ trade_symbol_id, date_time, open_val, high_val, low_val, close_val, volume_val, average_val, bar_count_val, ], ) def insert_tick_data( self, trade_symbol_id: int, date_time: str, price_val: float, size_val: int, ) -> None: """ Insert tick data for a particular TradeSymbol entry. :param trade_symbol_id: id of TradeSymbol :param date_time: date and time string :param price_val: price of the transaction :param size_val: size of the transaction """ with self.conn: with self.conn.cursor() as curs: curs.execute( "INSERT INTO IbTickData " "(trade_symbol_id, datetime, price, size) " "VALUES (%s, %s, %s, %s) ON CONFLICT DO NOTHING", [ trade_symbol_id, date_time, price_val, size_val, ], )
32.702128
97
0.479506
628
6,148
4.501592
0.154459
0.013442
0.073576
0.018394
0.775734
0.773612
0.773612
0.74885
0.74885
0.710294
0
0.000857
0.430709
6,148
187
98
32.877005
0.806857
0.182498
0
0.687023
0
0.030534
0.231767
0.00893
0
0
0
0
0
1
0.038168
false
0
0.030534
0
0.083969
0
0
0
0
null
0
0
0
0
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
a18842cf6aace755bde8ae3b061708b05c03405e
256
py
Python
server/data_fixer.py
Peace-Data/Peace-Data
758a09ba386cdb25bf4e6532534cf8e332366133
[ "MIT" ]
null
null
null
server/data_fixer.py
Peace-Data/Peace-Data
758a09ba386cdb25bf4e6532534cf8e332366133
[ "MIT" ]
null
null
null
server/data_fixer.py
Peace-Data/Peace-Data
758a09ba386cdb25bf4e6532534cf8e332366133
[ "MIT" ]
null
null
null
import pandas as pd import numpy as np class DataFixer: def __init__(self): pass def get_fix(self, data): self.data = data self.data = pd.get_dummies(self.data) return self.data
12.8
45
0.535156
32
256
4.09375
0.53125
0.305344
0.183206
0
0
0
0
0
0
0
0
0
0.398438
256
19
46
13.473684
0.850649
0
0
0
0
0
0
0
0
0
0
0
0
1
0.222222
false
0.111111
0.222222
0
0.666667
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
1
0
0
5
a1e5970f32798ddbe4170795df50442dcbcdba33
219
py
Python
filter_plugins/collections.py
GParedesDevo/ansible-redis
e3d80ea8f094d2833cf8a31d3ab2b86c0c375350
[ "MIT" ]
3
2019-12-27T03:35:54.000Z
2021-06-20T14:08:44.000Z
filter_plugins/collections.py
GParedesDevo/ansible-redis
e3d80ea8f094d2833cf8a31d3ab2b86c0c375350
[ "MIT" ]
2
2021-06-21T13:13:31.000Z
2021-07-02T07:51:28.000Z
filter_plugins/collections.py
GParedesDevo/ansible-redis
e3d80ea8f094d2833cf8a31d3ab2b86c0c375350
[ "MIT" ]
3
2020-02-26T18:45:19.000Z
2021-06-20T14:08:46.000Z
def arraypermute(collection, key): return [ str(i) + str(j) for i in collection for j in key ] class FilterModule(object): def filters(self): return { 'arraypermute': arraypermute }
24.333333
63
0.611872
26
219
5.153846
0.576923
0
0
0
0
0
0
0
0
0
0
0
0.287671
219
9
64
24.333333
0.858974
0
0
0
0
0
0.054545
0
0
0
0
0
0
1
0.285714
false
0
0
0.285714
0.714286
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
5
62959df03ae5d00e6559ee16679e1e160d2e8cbc
781
py
Python
ohmystars/tests.py
wolfg1969/oh-my-stars
dbf51044a4dd5964ac4534b161624d0e3284afe3
[ "MIT" ]
76
2015-08-04T09:47:18.000Z
2022-03-08T01:40:32.000Z
ohmystars/tests.py
wolfg1969/oh-my-stars
dbf51044a4dd5964ac4534b161624d0e3284afe3
[ "MIT" ]
9
2018-01-17T00:56:55.000Z
2021-06-01T21:59:32.000Z
ohmystars/tests.py
seanbreckenridge/oh-my-stars
f4fce9757905839b3a86caf9b5d45b3b544d65a4
[ "MIT" ]
7
2016-08-18T05:26:17.000Z
2020-09-23T04:55:35.000Z
import unittest from index import update_inverted_index __author__ = 'guoyong' class IndexTest(unittest.TestCase): def setUp(self): self.index = { 'python': [] } def test_update_inverted_index_empty(self): update_inverted_index(self.index, 'python', 1, 2, 3) self.assertEqual([1, 2, 3], self.index.get('python')) def test_update_inverted_index_duplicate_item(self): update_inverted_index(self.index, 'python', 1, 2, 3) update_inverted_index(self.index, 'python', 3) self.assertEqual([1, 2, 3], self.index.get('python')) def test_update_inverted_index_sorted(self): update_inverted_index(self.index, 'python', 3, 1, 2) self.assertEqual([1, 2, 3], self.index.get('python'))
27.892857
61
0.65685
103
781
4.718447
0.242718
0.230453
0.312757
0.1893
0.716049
0.716049
0.650206
0.5
0.5
0.425926
0
0.030794
0.209987
781
27
62
28.925926
0.756888
0
0
0.277778
0
0
0.070513
0
0
0
0
0
0.166667
1
0.222222
false
0
0.111111
0
0.388889
0
0
0
0
null
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
5
62bacac50076f8d20933041b257e6eecd0be0253
129
py
Python
problems/permutations/solution-1.py
MleMoe/LeetCode-1
14f275ba3c8079b820808da17c4952fcf9c8253c
[ "MIT" ]
2
2021-03-25T01:58:55.000Z
2021-08-06T12:47:13.000Z
problems/permutations/solution-1.py
MleMoe/LeetCode-1
14f275ba3c8079b820808da17c4952fcf9c8253c
[ "MIT" ]
3
2019-08-27T13:25:42.000Z
2021-08-28T17:49:34.000Z
problems/permutations/solution-1.py
MleMoe/LeetCode-1
14f275ba3c8079b820808da17c4952fcf9c8253c
[ "MIT" ]
1
2021-08-14T08:49:39.000Z
2021-08-14T08:49:39.000Z
import itertools class Solution: def permute(self, nums: [int]) -> [[int]]: return list(itertools.permutations(nums))
32.25
49
0.674419
15
129
5.8
0.8
0
0
0
0
0
0
0
0
0
0
0
0.178295
129
4
49
32.25
0.820755
0
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.25
0.25
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
5
62dcfa49ce53e9bfedc5780c8391a0c929e58a1b
353
py
Python
app/models/__init__.py
abhisuri97/mhealth
2d74c9c8298d097f86090e3365652d858c682ffa
[ "MIT" ]
null
null
null
app/models/__init__.py
abhisuri97/mhealth
2d74c9c8298d097f86090e3365652d858c682ffa
[ "MIT" ]
null
null
null
app/models/__init__.py
abhisuri97/mhealth
2d74c9c8298d097f86090e3365652d858c682ffa
[ "MIT" ]
null
null
null
""" These imports enable us to make all defined models members of the models module (as opposed to just their python files) """ from .user import * # noqa from .miscellaneous import * # noqa from .exercise import * # noqa from .resource import * # noqa from .medication import * # noqa from .nutrition import * # noqa from .plan import * # noqa
27.153846
72
0.711048
49
353
5.122449
0.591837
0.278884
0.334661
0
0
0
0
0
0
0
0
0
0.206799
353
12
73
29.416667
0.896429
0.439093
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
1a16364f62a9ae3732679356bc352cebdb61a0f9
99
py
Python
app/admin/__init__.py
lp1225/-001
0aad3f7bc2112fd90629a2759ab8651a3c467546
[ "MIT" ]
1
2018-12-13T14:42:36.000Z
2018-12-13T14:42:36.000Z
app/admin/__init__.py
lp1225/-001
0aad3f7bc2112fd90629a2759ab8651a3c467546
[ "MIT" ]
null
null
null
app/admin/__init__.py
lp1225/-001
0aad3f7bc2112fd90629a2759ab8651a3c467546
[ "MIT" ]
null
null
null
#encoding: utf-8 from flask import Blueprint admin = Blueprint('admin', '__name__') # import views
19.8
38
0.747475
13
99
5.384615
0.769231
0.4
0
0
0
0
0
0
0
0
0
0.011628
0.131313
99
5
39
19.8
0.802326
0.282828
0
0
0
0
0.185714
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
1
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
1
0
5
1a217432bd644fe4d02d96a2c822e4f530023553
366
py
Python
aes_cipher/__init__.py
ebellocchia/aes_cipher
aac378f4073b85b9439bf5db080cfe070e9b393e
[ "MIT" ]
1
2021-09-15T02:45:45.000Z
2021-09-15T02:45:45.000Z
aes_cipher/__init__.py
ebellocchia/aes_cipher
aac378f4073b85b9439bf5db080cfe070e9b393e
[ "MIT" ]
null
null
null
aes_cipher/__init__.py
ebellocchia/aes_cipher
aac378f4073b85b9439bf5db080cfe070e9b393e
[ "MIT" ]
null
null
null
# # Imports # from aes_cipher._version import __version__ from aes_cipher.data_ex import DataDecryptError, DataHmacError from aes_cipher.data_decrypter import DataDecrypter from aes_cipher.data_encrypter import DataEncrypter from aes_cipher.file_decrypter import FileDecrypter from aes_cipher.file_encrypter import FileEncrypter from aes_cipher.logger import Logger
33.272727
62
0.879781
49
366
6.22449
0.367347
0.160656
0.298361
0.167213
0
0
0
0
0
0
0
0
0.090164
366
10
63
36.6
0.915916
0.019126
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
1a25e1d7b6445d5f8cc24d0801ec18c1655d4b96
60
py
Python
petstagram/core/clean_up.py
ZhivkoZhelyazkov/Petstagram
0e7ade5175f517f8935d4be0cb8f71cd31a06cf9
[ "MIT" ]
null
null
null
petstagram/core/clean_up.py
ZhivkoZhelyazkov/Petstagram
0e7ade5175f517f8935d4be0cb8f71cd31a06cf9
[ "MIT" ]
null
null
null
petstagram/core/clean_up.py
ZhivkoZhelyazkov/Petstagram
0e7ade5175f517f8935d4be0cb8f71cd31a06cf9
[ "MIT" ]
null
null
null
import os def clean_up_files(path): os.remove(path)
7.5
25
0.683333
10
60
3.9
0.8
0
0
0
0
0
0
0
0
0
0
0
0.216667
60
7
26
8.571429
0.829787
0
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0.333333
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
1
0
1
0
0
5
1a29b6c04b1d8c7894db10e5d1db43e7ca848746
119
py
Python
snaps/admin.py
rosekairu/SnapGram
06581f90de573b0f89277424964a9e48226a5173
[ "MIT" ]
null
null
null
snaps/admin.py
rosekairu/SnapGram
06581f90de573b0f89277424964a9e48226a5173
[ "MIT" ]
6
2021-03-30T13:54:19.000Z
2021-09-22T19:22:59.000Z
snaps/admin.py
rosekairu/SnapGram
06581f90de573b0f89277424964a9e48226a5173
[ "MIT" ]
null
null
null
from django.contrib import admin from.models import Profile # Register your models here. admin.site.register(Profile)
19.833333
32
0.815126
17
119
5.705882
0.647059
0
0
0
0
0
0
0
0
0
0
0
0.117647
119
6
33
19.833333
0.92381
0.218487
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.666667
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
a7e1d4934bcadb4b86348347f7c17a057c479702
1,489
py
Python
14/main.py
effie-0/Advent-of-Code-2018
3b9c6421a1ec8ee487dd0f5f0f202f95f1bd1a69
[ "MIT" ]
null
null
null
14/main.py
effie-0/Advent-of-Code-2018
3b9c6421a1ec8ee487dd0f5f0f202f95f1bd1a69
[ "MIT" ]
null
null
null
14/main.py
effie-0/Advent-of-Code-2018
3b9c6421a1ec8ee487dd0f5f0f202f95f1bd1a69
[ "MIT" ]
null
null
null
# 12.14 import re if __name__ == '__main__': input_num = 990941 recipe_list = [3, 7] recipe_str = "37" worker1 = 0 worker2 = 1 while len(recipe_list) < (input_num + 10): _sum = recipe_list[worker1] + recipe_list[worker2] new_r1 = int(_sum / 10) new_r2 = int(_sum % 10) if new_r1 != 0: recipe_list.append(new_r1) recipe_str += str(new_r1) recipe_list.append(new_r2) recipe_str += str(new_r2) worker1 += recipe_list[worker1] + 1 worker1 = worker1 % len(recipe_list) worker2 += recipe_list[worker2] + 1 worker2 = worker2 % len(recipe_list) print(recipe_list[input_num:input_num + 10]) match_obj = re.search(r'990941', recipe_str) if match_obj: print(match_obj) else: while not match_obj: _sum = recipe_list[worker1] + recipe_list[worker2] new_r1 = int(_sum / 10) new_r2 = int(_sum % 10) if new_r1 != 0: recipe_list.append(new_r1) recipe_str += str(new_r1) recipe_list.append(new_r2) recipe_str += str(new_r2) worker1 += recipe_list[worker1] + 1 worker1 = worker1 % len(recipe_list) worker2 += recipe_list[worker2] + 1 worker2 = worker2 % len(recipe_list) match_obj = re.search(r'990941', recipe_str[-12:]) print(len(recipe_str) - 12 + match_obj.span()[0])
32.369565
62
0.566823
195
1,489
3.994872
0.189744
0.243902
0.130937
0.097561
0.726573
0.726573
0.726573
0.726573
0.644416
0.644416
0
0.086481
0.324379
1,489
45
63
33.088889
0.687873
0.003358
0
0.6
0
0
0.014855
0
0
0
0
0
0
1
0
false
0
0.025
0
0.025
0.075
0
0
0
null
1
0
0
0
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
a7f6a9b3f613d268ca44959aa3cfb370a3ec72f3
22
py
Python
src/django-nonrel/django/forms/extras/__init__.py
adamjmcgrath/glancydesign
826ede7c639879d5b79ee730eb5e91422768cb02
[ "BSD-3-Clause" ]
790
2015-01-03T02:13:39.000Z
2020-05-10T19:53:57.000Z
django/forms/extras/__init__.py
mradziej/django
5d38965743a369981c9a738a298f467f854a2919
[ "BSD-3-Clause" ]
1,361
2015-01-08T23:09:40.000Z
2020-04-14T00:03:04.000Z
django/forms/extras/__init__.py
mradziej/django
5d38965743a369981c9a738a298f467f854a2919
[ "BSD-3-Clause" ]
155
2015-01-08T22:59:31.000Z
2020-04-08T08:01:53.000Z
from widgets import *
11
21
0.772727
3
22
5.666667
1
0
0
0
0
0
0
0
0
0
0
0
0.181818
22
1
22
22
0.944444
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
c5060830e2c5deb6dbc6c0671c91d4f28fe44457
49,029
py
Python
methcomp/glucose.py
wptmdoorn/methcomp
6d024d873dc816a8835b21ec0375e0554dc86194
[ "MIT" ]
3
2020-09-26T23:45:43.000Z
2021-04-29T09:20:31.000Z
methcomp/glucose.py
wptmdoorn/methcomp
6d024d873dc816a8835b21ec0375e0554dc86194
[ "MIT" ]
23
2020-10-19T11:08:21.000Z
2021-06-29T19:21:02.000Z
methcomp/glucose.py
wptmdoorn/methcomp
6d024d873dc816a8835b21ec0375e0554dc86194
[ "MIT" ]
6
2019-12-10T09:01:27.000Z
2021-05-05T11:30:09.000Z
# -*- coding: utf-8 -*- import matplotlib import matplotlib.pyplot as plt import numpy as np from shapely.geometry import Point, Polygon try: import importlib.resources as pkg_resources from importlib.resources import path def path_func(pkg, file): with path(pkg, file) as p: return p except ImportError: # Try backported to PY<37 `importlib_resources`. import importlib_resources as pkg_resources # type: ignore def path_func(pkg, file): return pkg_resources.files(pkg).joinpath(file) __all__ = ["clarke", "parkes", "seg", "clarkezones", "parkeszones", "segscores"] class _Clarke(object): """Internal class for drawing a Clarke-Error grid plotting""" def __init__( self, reference, test, units, x_title, y_title, graph_title, xlim, ylim, color_grid, color_gridlabels, color_points, grid, percentage, point_kws, grid_kws, ): # variables assignment self.reference: np.array = np.asarray(reference) self.test: np.array = np.asarray(test) self.units = units self.graph_title: str = graph_title self.x_title: str = x_title self.y_title: str = y_title self.xlim: list = xlim self.ylim: list = ylim self.color_grid: str = color_grid self.color_gridlabels: str = color_gridlabels self.color_points: str = color_points self.grid: bool = grid self.percentage: bool = percentage self.point_kws = {} if point_kws is None else point_kws.copy() self.grid_kws = {} if grid_kws is None else grid_kws.copy() self._check_params() self._derive_params() def _check_params(self): if len(self.reference) != len(self.test): raise ValueError("Length of reference and test values are not equal") if self.units not in ["mmol", "mg/dl", "mgdl"]: raise ValueError( "The provided units should be one of the following: " "mmol, mgdl or mg/dl." ) if any( [ x is not None and not isinstance(x, str) for x in [self.x_title, self.y_title] ] ): raise ValueError("Axes labels arguments should be provided as a str.") def _derive_params(self): if self.x_title is None: _unit = "mmol/L" if "mmol" else "mg/dL" self.x_title = "Reference glucose concentration ({})".format(_unit) if self.y_title is None: _unit = "mmol/L" if "mmol" else "mg/dL" self.y_title = "Predicted glucose concentration ({})".format(_unit) self.xlim = self.xlim or [0, 400] self.ylim = self.ylim or [0, 400] def _calc_error_zone(self): # ref, pred ref = self.reference pred = self.test # calculate conversion factor if needed n = 18 if self.units == "mmol" else 1 # we initialize an array with ones # this in fact very smart because all the non-matching values will automatically # end up in zone B (which is 1)! _zones = np.ones(len(ref)) # absolute relative error = abs(bias)/reference*100 bias = pred - ref are = abs(bias) / ref * 100 eq1 = (7 / 5) * (ref - 130 / n) eq2 = ref + 110 / n # zone E: (ref <= 70 and test >= 180) or (ref >=180 and test <=70) zone_e = ((ref <= 70 / n) & (pred >= 180 / n)) | ( (ref >= 180 / n) & (pred <= 70 / n) ) _zones[zone_e] = 4 # zone D: ref < 70 and (test > 70 and test < 180) or # ref > 240 and (test > 70 and test < 180) test_d = (pred >= 70 / n) & ( pred < 180 / n ) # error corrected >=70 instead of >70 zone_d = ((ref < 70 / n) & test_d) | ((ref > 240 / n) & test_d) _zones[zone_d] = 3 # zone C: (ref >= 130 and ref <= 180 and test < eq1) or # (ref > 70 and ref > 180 and ref > eq2) zone_c = ((ref >= 130 / n) & (ref <= 180 / n) & (pred < eq1)) | ( (ref > 70 / n) & (pred > 180 / n) & (pred > eq2) ) _zones[zone_c] = 2 # zone A: are <= 20 or (ref < 58.3 and test < 70) zone_a = (are <= 20) | ((ref < 70 / n) & (pred < 70 / n)) _zones[zone_a] = 0 return [int(i) for i in _zones] def plot(self, ax): _gridlines = [ ([0, 400], [0, 400], ":"), ([0, 175 / 3], [70, 70], "-"), ([175 / 3, 400 / 1.2], [70, 400], "-"), ([70, 70], [84, 400], "-"), ([0, 70], [180, 180], "-"), ([70, 290], [180, 400], "-"), ([70, 70], [0, 56], "-"), ([70, 400], [56, 320], "-"), ([180, 180], [0, 70], "-"), ([180, 400], [70, 70], "-"), ([240, 240], [70, 180], "-"), ([240, 400], [180, 180], "-"), ([130, 180], [0, 70], "-"), ] colors = ["#196600", "#7FFF00", "#FF7B00", "#FF5700", "#FF0000"] _gridlabels = [ (30, 15, "A", colors[0]), (370, 260, "B", colors[1]), (280, 370, "B", colors[1]), (160, 370, "C", colors[2]), (160, 15, "C", colors[2]), (30, 140, "D", colors[3]), (370, 120, "D", colors[3]), (30, 370, "E", colors[4]), (370, 15, "E", colors[4]), ] # calculate conversion factor if needed n = 18 if self.units == "mmol" else 1 # plot individual points if self.color_points == "auto": ax.scatter( self.reference, self.test, marker="o", alpha=0.6, c=[colors[i] for i in self._calc_error_zone()], s=8, **self.point_kws ) else: ax.scatter( self.reference, self.test, marker="o", color=self.color_points, alpha=0.6, s=8, **self.point_kws ) # plot grid lines if self.grid: for g in _gridlines: ax.plot( np.array(g[0]) / n, np.array(g[1]) / n, g[2], color=self.color_grid, **self.grid_kws ) if self.percentage: zones = [["A", "B", "C", "D", "E"][i] for i in self._calc_error_zone()] for label in _gridlabels: ax.text( label[0] / n, label[1] / n, label[2], fontsize=12, fontweight="bold", color=label[3] if self.color_gridlabels == "auto" else self.color_gridlabels, ) ax.text( label[0] / n + (8 / n), label[1] / n + (8 / n), "{:.1f}".format((zones.count(label[2]) / len(zones)) * 100), fontsize=9, fontweight="bold", color=label[3] if self.color_gridlabels == "auto" else self.color_gridlabels, ) else: for label in _gridlabels: ax.text( label[0] / n, label[1] / n, label[2], fontsize=12, fontweight="bold", color=label[3] if self.color_gridlabels == "auto" else self.color_gridlabels, ) # limits and ticks ax.set_xlim(self.xlim[0] / n, self.xlim[1] / n) ax.set_ylim(self.ylim[0] / n, self.ylim[1] / n) # graph labels ax.set_ylabel(self.y_title) ax.set_xlabel(self.x_title) if self.graph_title is not None: ax.set_title(self.graph_title) def clarke( reference, test, units, x_label=None, y_label=None, title=None, xlim=None, ylim=None, color_grid="#000000", color_gridlabels="auto", color_points="auto", grid=True, percentage=False, point_kws=None, grid_kws=None, square=False, ax=None, ): """Provide a glucose error grid analyses as designed by Clarke. This is an Axis-level function which will draw the Clarke-error grid plot. onto the current active Axis object unless ``ax`` is provided. Parameters ---------- reference, test : array, or list Glucose values obtained from the reference and predicted methods, preferably provided in a np.array. units : str The SI units which the glucose values are provided in. Options: 'mmol', 'mgdl' or 'mg/dl'. x_label : str, optional The label which is added to the X-axis. If None is provided, a standard label will be added. y_label : str, optional The label which is added to the Y-axis. If None is provided, a standard label will be added. title : str, optional Title of the Clarke error grid plot. If None is provided, no title will be plotted. xlim : list, optional Minimum and maximum limits for X-axis. Should be provided as list or tuple. If not set, matplotlib will decide its own bounds. ylim : list, optional Minimum and maximum limits for Y-axis. Should be provided as list or tuple. If not set, matplotlib will decide its own bounds. color_grid : str, optional Color of the Clarke error grid lines. color_gridlabels : str, optional Color of the gridlabels (A, B, C, ..) that will be plotted. If set to 'auto', it will plot the points according to their zones. color_points : str, optional Color of the individual differences that will be plotted. If set to 'auto', it will plot the points according to their zones. grid : bool, optional Enable the grid lines of the Parkes error. Defaults to True. percentage : bool, optional If True, percentage of the zones will be depicted in the plot. point_kws : dict of key, value mappings, optional Additional keyword arguments for `plt.scatter`. grid_kws : dict of key, value mappings, optional Additional keyword arguments for the grid with `plt.plot`. square : bool, optional If True, set the Axes aspect to "equal" so each cell will be square-shaped. ax : matplotlib Axes, optional Axes in which to draw the plot, otherwise use the currently-active Axes. Returns ------- ax : matplotlib Axes Axes object with the Clarke-error grid plot. See Also ------- Clarke, W. L., Cox, D., et al. Diabetes Care, vol. 10, no. 5, 1987, pp. 622–628. """ plotter: _Clarke = _Clarke( reference, test, units, x_label, y_label, title, xlim, ylim, color_grid, color_gridlabels, color_points, grid, percentage, point_kws, grid_kws, ) # Draw the plot and return the Axes if ax is None: ax = plt.gca() if square: ax.set_aspect("equal") plotter.plot(ax) return ax def clarkezones(reference, test, units, numeric=False): """Provides the error zones as depicted by the Clarke error grid analysis for each point in the reference and test datasets. Parameters ---------- reference, test : array, or list Glucose values obtained from the reference and predicted methods, preferably provided in a np.array. units : str The SI units which the glucose values are provided in. Options: 'mmol', 'mgdl' or 'mg/dl'. numeric : bool, optional If this is set to true, returns integers (0 to 4) instead of characters for each of the zones. Returns ------- clarkezones : list Returns a list depecting the zones for each of the reference and test values. """ # obtain zones from a Clarke reference object _zones = _Clarke( reference, test, units, None, None, None, None, None, "#000000", "auto", "auto", True, False, None, None, )._calc_error_zone() if numeric: return _zones else: labels = ["A", "B", "C", "D", "E"] return [labels[i] for i in _zones] class _Parkes(object): """Internal class for drawing a Parkes consensus error grid plot""" def __init__( self, type, reference, test, units, x_title, y_title, graph_title, xlim, ylim, color_grid, color_gridlabels, color_points, grid, percentage, point_kws, grid_kws, ): # variables assignment self.type: int = type self.reference: np.array = np.asarray(reference) self.test: np.array = np.asarray(test) self.units = units self.graph_title: str = graph_title self.x_title: str = x_title self.y_title: str = y_title self.xlim: list = xlim self.ylim: list = ylim self.color_grid: str = color_grid self.color_gridlabels: str = color_gridlabels self.color_points: str = color_points self.grid: bool = grid self.percentage: bool = percentage self.point_kws = {} if point_kws is None else point_kws.copy() self.grid_kws = {} if grid_kws is None else grid_kws.copy() self._check_params() self._derive_params() def _check_params(self): if self.type != 1 and self.type != 2: raise ValueError("Type of Diabetes should either be 1 or 2.") if len(self.reference) != len(self.test): raise ValueError("Length of reference and test values are not equal") if self.units not in ["mmol", "mg/dl", "mgdl"]: raise ValueError( "The provided units should be one of the following:" " mmol, mgdl or mg/dl." ) if any( [ x is not None and not isinstance(x, str) for x in [self.x_title, self.y_title] ] ): raise ValueError("Axes labels arguments should be provided as a str.") def _derive_params(self): if self.x_title is None: _unit = "mmol/L" if "mmol" else "mg/dL" self.x_title = "Reference glucose concentration ({})".format(_unit) if self.y_title is None: _unit = "mmol/L" if "mmol" else "mg/dL" self.y_title = "Predicted glucose concentration ({})".format(_unit) def _coef(self, x, y, xend, yend): if xend == x: raise ValueError("Vertical line - function inapplicable") return (yend - y) / (xend - x) def _endy(self, startx, starty, maxx, coef): return (maxx - startx) * coef + starty def _endx(self, startx, starty, maxy, coef): return (maxy - starty) / coef + startx def _calc_error_zone(self): # ref, pred ref = self.reference pred = self.test # calculate conversion factor if needed n = 18 if self.units == "mmol" else 1 maxX = max(max(ref) + 20 / n, 550 / n) maxY = max([*(np.array(pred) + 20 / n), maxX, 550 / n]) # we initialize an array with ones # this in fact very smart because all the non-matching values will automatically # end up in zone A (which is zero) _zones = np.zeros(len(ref)) if self.type == 1: ce = self._coef(35, 155, 50, 550) cdu = self._coef(80, 215, 125, 550) cdl = self._coef(250, 40, 550, 150) ccu = self._coef(70, 110, 260, 550) ccl = self._coef(260, 130, 550, 250) cbu = self._coef(280, 380, 430, 550) cbl = self._coef(385, 300, 550, 450) limitE1 = Polygon( [ (x, y) for x, y in zip( [0, 35 / n, self._endx(35 / n, 155 / n, maxY, ce), 0, 0], [150 / n, 155 / n, maxY, maxY, 150 / n], ) ] ) limitD1L = Polygon( [ (x, y) for x, y in zip( [250 / n, 250 / n, maxX, maxX, 250 / n], [0, 40 / n, self._endy(410 / n, 110 / n, maxX, cdl), 0, 0], ) ] ) limitD1U = Polygon( [ (x, y) for x, y in zip( [ 0, 25 / n, 50 / n, 80 / n, self._endx(80 / n, 215 / n, maxY, cdu), 0, 0, ], [100 / n, 100 / n, 125 / n, 215 / n, maxY, maxY, 100 / n], ) ] ) limitC1L = Polygon( [ (x, y) for x, y in zip( [120 / n, 120 / n, 260 / n, maxX, maxX, 120 / n], [ 0, 30 / n, 130 / n, self._endy(260 / n, 130 / n, maxX, ccl), 0, 0, ], ) ] ) limitC1U = Polygon( [ (x, y) for x, y in zip( [ 0, 30 / n, 50 / n, 70 / n, self._endx(70 / n, 110 / n, maxY, ccu), 0, 0, ], [60 / n, 60 / n, 80 / n, 110 / n, maxY, maxY, 60 / n], ) ] ) limitB1L = Polygon( [ (x, y) for x, y in zip( [50 / n, 50 / n, 170 / n, 385 / n, maxX, maxX, 50 / n], [ 0, 30 / n, 145 / n, 300 / n, self._endy(385 / n, 300 / n, maxX, cbl), 0, 0, ], ) ] ) limitB1U = Polygon( [ (x, y) for x, y in zip( [ 0, 30 / n, 140 / n, 280 / n, self._endx(280 / n, 380 / n, maxY, cbu), 0, 0, ], [50 / n, 50 / n, 170 / n, 380 / n, maxY, maxY, 50 / n], ) ] ) for i, points in enumerate(zip(ref, pred)): for f, r in zip( [ limitB1L, limitB1U, limitC1L, limitC1U, limitD1L, limitD1U, limitE1, ], [1, 1, 2, 2, 3, 3, 4], ): if f.contains(Point(points[0], points[1])): _zones[i] = r return [int(i) for i in _zones] elif self.type == 2: ce = self._coef(35, 200, 50, 550) cdu = self._coef(35, 90, 125, 550) cdl = self._coef(410, 110, 550, 160) ccu = self._coef(30, 60, 280, 550) ccl = self._coef(260, 130, 550, 250) cbu = self._coef(230, 330, 440, 550) cbl = self._coef(330, 230, 550, 450) limitE2 = Polygon( [ (x, y) for x, y in zip( [ 0, 35 / n, self._endx(35 / n, 200 / n, maxY, ce), 0, 0, ], # x limits E upper [200 / n, 200 / n, maxY, maxY, 200 / n], ) ] ) # y limits E upper limitD2L = Polygon( [ (x, y) for x, y in zip( [ 250 / n, 250 / n, 410 / n, maxX, maxX, 250 / n, ], # x limits D lower [ 0, 40 / n, 110 / n, self._endy(410 / n, 110 / n, maxX, cdl), 0, 0, ], ) ] ) # y limits D lower limitD2U = Polygon( [ (x, y) for x, y in zip( [ 0, 25 / n, 35 / n, self._endx(35 / n, 90 / n, maxY, cdu), 0, 0, ], # x limits D upper [80 / n, 80 / n, 90 / n, maxY, maxY, 80 / n], ) ] ) # y limits D upper limitC2L = Polygon( [ (x, y) for x, y in zip( [90 / n, 260 / n, maxX, maxX, 90 / n], # x limits C lower [0, 130 / n, self._endy(260 / n, 130 / n, maxX, ccl), 0, 0], ) ] ) # y limits C lower limitC2U = Polygon( [ (x, y) for x, y in zip( [ 0, 30 / n, self._endx(30 / n, 60 / n, maxY, ccu), 0, 0, ], # x limits C upper [60 / n, 60 / n, maxY, maxY, 60 / n], ) ] ) # y limits C upper limitB2L = Polygon( [ (x, y) for x, y in zip( [ 50 / n, 50 / n, 90 / n, 330 / n, maxX, maxX, 50 / n, ], # x limits B lower [ 0, 30 / n, 80 / n, 230 / n, self._endy(330 / n, 230 / n, maxX, cbl), 0, 0, ], ) ] ) # y limits B lower limitB2U = Polygon( [ (x, y) for x, y in zip( [ 0, 30 / n, 230 / n, self._endx(230 / n, 330 / n, maxY, cbu), 0, 0, ], # x limits B upper [50 / n, 50 / n, 330 / n, maxY, maxY, 50 / n], ) ] ) # y limits B upper for i, points in enumerate(zip(ref, pred)): for f, r in zip( [ limitB2L, limitB2U, limitC2L, limitC2U, limitD2L, limitD2U, limitE2, ], [1, 1, 2, 2, 3, 3, 4], ): if f.contains(Point(points[0], points[1])): _zones[i] = r return [int(i) for i in _zones] def plot(self, ax): # ref, pred ref = self.reference pred = self.test # calculate conversion factor if needed n = 18 if self.units == "mmol" else 1 maxX = self.xlim or max(max(ref) + 20 / n, 550 / n) maxY = self.ylim or max([*(np.array(pred) + 20 / n), maxX, 550 / n]) if self.type == 1: ce = self._coef(35, 155, 50, 550) cdu = self._coef(80, 215, 125, 550) cdl = self._coef(250, 40, 550, 150) ccu = self._coef(70, 110, 260, 550) ccl = self._coef(260, 130, 550, 250) cbu = self._coef(280, 380, 430, 550) cbl = self._coef(385, 300, 550, 450) _gridlines = [ ([0, min(maxX, maxY)], [0, min(maxX, maxY)], ":"), ([0, 30 / n], [50 / n, 50 / n], "-"), ([30 / n, 140 / n], [50 / n, 170 / n], "-"), ([140 / n, 280 / n], [170 / n, 380 / n], "-"), ( [280 / n, self._endx(280 / n, 380 / n, maxY, cbu)], [380 / n, maxY], "-", ), ([50 / n, 50 / n], [0 / n, 30 / n], "-"), ([50 / n, 170 / n], [30 / n, 145 / n], "-"), ([170 / n, 385 / n], [145 / n, 300 / n], "-"), ( [385 / n, maxX], [300 / n, self._endy(385 / n, 300 / n, maxX, cbl)], "-", ), ([0 / n, 30 / n], [60 / n, 60 / n], "-"), ([30 / n, 50 / n], [60 / n, 80 / n], "-"), ([50 / n, 70 / n], [80 / n, 110 / n], "-"), ( [70 / n, self._endx(70 / n, 110 / n, maxY, ccu)], [110 / n, maxY], "-", ), ([120 / n, 120 / n], [0 / n, 30 / n], "-"), ([120 / n, 260 / n], [30 / n, 130 / n], "-"), ( [260 / n, maxX], [130 / n, self._endy(260 / n, 130 / n, maxX, ccl)], "-", ), ([0 / n, 25 / n], [100 / n, 100 / n], "-"), ([25 / n, 50 / n], [100 / n, 125 / n], "-"), ([50 / n, 80 / n], [125 / n, 215 / n], "-"), ( [80 / n, self._endx(80 / n, 215 / n, maxY, cdu)], [215 / n, maxY], "-", ), ([250 / n, 250 / n], [0 / n, 40 / n], "-"), ( [250 / n, maxX], [40 / n, self._endy(410 / n, 110 / n, maxX, cdl)], "-", ), ([0 / n, 35 / n], [150 / n, 155 / n], "-"), ([35 / n, self._endx(35 / n, 155 / n, maxY, ce)], [155 / n, maxY], "-"), ] elif self.type == 2: ce = self._coef(35, 200, 50, 550) cdu = self._coef(35, 90, 125, 550) cdl = self._coef(410, 110, 550, 160) ccu = self._coef(30, 60, 280, 550) ccl = self._coef(260, 130, 550, 250) cbu = self._coef(230, 330, 440, 550) cbl = self._coef(330, 230, 550, 450) _gridlines = [ ([0, min(maxX, maxY)], [0, min(maxX, maxY)], ":"), ([0, 30 / n], [50 / n, 50 / n], "-"), ([30 / n, 230 / n], [50 / n, 330 / n], "-"), ( [230 / n, self._endx(230 / n, 330 / n, maxY, cbu)], [330 / n, maxY], "-", ), ([50 / n, 50 / n], [0 / n, 30 / n], "-"), ([50 / n, 90 / n], [30 / n, 80 / n], "-"), ([90 / n, 330 / n], [80 / n, 230 / n], "-"), ( [330 / n, maxX], [230 / n, self._endy(330 / n, 230 / n, maxX, cbl)], "-", ), ([0 / n, 30 / n], [60 / n, 60 / n], "-"), ([30 / n, self._endx(30 / n, 60 / n, maxY, ccu)], [60 / n, maxY], "-"), ([90 / n, 260 / n], [0 / n, 130 / n], "-"), ( [260 / n, maxX], [130 / n, self._endy(260 / n, 130 / n, maxX, ccl)], "-", ), ([0 / n, 25 / n], [80 / n, 80 / n], "-"), ([25 / n, 35 / n], [80 / n, 90 / n], "-"), ([35 / n, self._endx(35 / n, 90 / n, maxY, cdu)], [90 / n, maxY], "-"), ([250 / n, 250 / n], [0 / n, 40 / n], "-"), ([250 / n, 410 / n], [40 / n, 110 / n], "-"), ( [410 / n, maxX], [110 / n, self._endy(410 / n, 110 / n, maxX, cdl)], "-", ), ([0 / n, 35 / n], [200 / n, 200 / n], "-"), ([35 / n, self._endx(35 / n, 200 / n, maxY, ce)], [200 / n, maxY], "-"), ] colors = ["#196600", "#7FFF00", "#FF7B00", "#FF5700", "#FF0000"] _gridlabels = [ (600, 600, "A", colors[0]), (360, 600, "B", colors[1]), (600, 355, "B", colors[1]), (165, 600, "C", colors[2]), (600, 215, "C", colors[2]), (600, 50, "D", colors[3]), (75, 600, "D", colors[3]), (5, 600, "E", colors[4]), ] # plot individual points if self.color_points == "auto": ax.scatter( self.reference, self.test, marker="o", alpha=0.6, c=[colors[i] for i in self._calc_error_zone()], s=8, **self.point_kws ) else: ax.scatter( self.reference, self.test, marker="o", color=self.color_points, alpha=0.6, s=8, **self.point_kws ) # plot grid lines if self.grid: for g in _gridlines: ax.plot( np.array(g[0]), np.array(g[1]), g[2], color=self.color_grid, **self.grid_kws ) if self.percentage: zones = [["A", "B", "C", "D", "E"][i] for i in self._calc_error_zone()] for label in _gridlabels: ax.text( label[0] / n, label[1] / n, label[2], fontsize=12, fontweight="bold", color=label[3] if self.color_gridlabels == "auto" else self.color_gridlabels, ) ax.text( label[0] / n + (18 / n), label[1] / n + (18 / n), "{:.1f}".format((zones.count(label[2]) / len(zones)) * 100), fontsize=9, fontweight="bold", color=label[3] if self.color_gridlabels == "auto" else self.color_gridlabels, ) else: for label in _gridlabels: ax.text( label[0] / n, label[1] / n, label[2], fontsize=12, fontweight="bold", color=label[3] if self.color_gridlabels == "auto" else self.color_gridlabels, ) # limits and ticks _ticks = [ 70, 100, 150, 180, 240, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950, 1000, ] ax.set_xticks([round(x / n, 1) for x in _ticks]) ax.set_yticks([round(x / n, 1) for x in _ticks]) ax.set_xlim(0, maxX) ax.set_ylim(0, maxY) # graph labels ax.set_ylabel(self.y_title) ax.set_xlabel(self.x_title) if self.graph_title is not None: ax.set_title(self.graph_title) def parkes( type, reference, test, units, x_label=None, y_label=None, title=None, xlim=None, ylim=None, color_grid="#000000", color_gridlabels="auto", color_points="auto", grid=True, percentage=False, point_kws=None, grid_kws=None, square=False, ax=None, ): """Provide a glucose error grid analyses as designed by Parkes. This is an Axis-level function which will draw the Parke-error grid plot. onto the current active Axis object unless ``ax`` is provided. Parameters ---------- type : int Parkes error grid differ for each type of diabetes. This should be either 1 or 2 corresponding to the type of diabetes. reference, test : array, or list Glucose values obtained from the reference and predicted methods, preferably provided in a np.array. units : str The SI units which the glucose values are provided in. Options: 'mmol', 'mgdl' or 'mg/dl'. x_label : str, optional The label which is added to the X-axis. If None is provided, a standard label will be added. y_label : str, optional The label which is added to the Y-axis. If None is provided, a standard label will be added. title : str, optional Title of the Parkes-error grid plot. If None is provided, no title will be plotted. xlim : list, optional Minimum and maximum limits for X-axis. Should be provided as list or tuple. If not set, matplotlib will decide its own bounds. ylim : list, optional Minimum and maximum limits for Y-axis. Should be provided as list or tuple. If not set, matplotlib will decide its own bounds. color_grid : str, optional Color of the Clarke error grid lines. Defaults to #000000 which represents the black color. color_gridlabels : str, optional Color of the grid labels (A, B, C, ..) that will be plotted. Defaults to 'auto' which colors the points according to their relative zones. color_points : str, optional Color of the individual differences that will be plotted. Defaults to 'auto' which colors the points according to their relative zones. grid : bool, optional Enable the grid lines of the Parkes error. Defaults to True. percentage : bool, optional If True, percentage of the zones will be depicted in the plot. square : bool, optional If True, set the Axes aspect to "equal" so each cell will be square-shaped. point_kws : dict of key, value mappings, optional Additional keyword arguments for `plt.scatter`. grid_kws : dict of key, value mappings, optional Additional keyword arguments for the grid with `plt.plot`. ax : matplotlib Axes, optional Axes in which to draw the plot, otherwise use the currently-active Axes. Returns ------- ax : matplotlib Axes Axes object with the Parkes error grid plot. References ---------- [parkes_2000] Parkes, J. L., Slatin S. L. et al. Diabetes Care, vol. 23, no. 8, 2000, pp. 1143-1148. [pfutzner_2013] Pfutzner, A., Klonoff D. C., et al. J Diabetes Sci Technol, vol. 7, no. 5, 2013, pp. 1275-1281. """ plotter: _Parkes = _Parkes( type, reference, test, units, x_label, y_label, title, xlim, ylim, color_grid, color_gridlabels, color_points, grid, percentage, point_kws, grid_kws, ) # Draw the plot and return the Axes if ax is None: ax = plt.gca() if square: ax.set_aspect("equal") plotter.plot(ax) return ax def parkeszones(type, reference, test, units, numeric=False): """Provides the error zones as depicted by the Parkes error grid analysis for each point in the reference and test datasets. Parameters ---------- type : int Parkes error grid differ for each type of diabetes. This should be either 1 or 2 corresponding to the type of diabetes. reference, test : array, or list Glucose values obtained from the reference and predicted methods, preferably provided in a np.array. units : str The SI units which the glucose values are provided in. Options: 'mmol', 'mgdl' or 'mg/dl'. numeric : bool, optional If this is set to true, returns integers (0 to 4) instead of characters for each of the zones. Returns ------- parkeszones : list Returns a list depicting the zones for each of the reference and test values. """ # obtain zones from a Clarke reference object _zones = _Parkes( type, reference, test, units, None, None, None, None, None, True, False, "#000000", "auto", "auto", None, None, )._calc_error_zone() if numeric: return _zones else: labels = ["A", "B", "C", "D", "E"] return [labels[i] for i in _zones] class _SEG(object): """Internal class for drawing a surveillance error grid error grid plot""" def __init__( self, reference, test, units, x_title, y_title, graph_title, xlim, ylim, percentage, point_kws, ): # variables assignment self.reference: np.array = np.asarray(reference) self.test: np.array = np.asarray(test) self.units = units self.graph_title: str = graph_title self.x_title: str = x_title self.y_title: str = y_title self.xlim: list = xlim self.ylim: list = ylim self.percentage: bool = percentage self.point_kws = {} if point_kws is None else point_kws.copy() self._check_params() self._derive_params() def _check_params(self): if len(self.reference) != len(self.test): raise ValueError("Length of reference and test values are not equal") if self.units not in ["mmol", "mg/dl", "mgdl"]: raise ValueError( "The provided units should be one of the following: " "mmol, mgdl or mg/dl." ) if any( [ x is not None and not isinstance(x, str) for x in [self.x_title, self.y_title] ] ): raise ValueError("Axes labels arguments should be provided as a str.") def _derive_params(self): if self.x_title is None: _unit = "mmol/L" if "mmol" else "mg/dL" self.x_title = "Reference glucose concentration ({})".format(_unit) if self.y_title is None: _unit = "mmol/L" if "mmol" else "mg/dL" self.y_title = "Predicted glucose concentration ({})".format(_unit) def _calc_error_score(self): n = 18 if self.units == "mmol" else 1 ref = self.reference * n pred = self.test * n _zones = [] from . import static # temporary fix data = np.loadtxt(pkg_resources.open_text(static, "seg.csv")) _zones = np.array([data.T[int(p), int(t)] for p, t in zip(pred, ref)]) return _zones def plot(self, ax): # ref, pred # ref = self.reference NOT USED # pred = self.test NOT USED from . import static # temporary fix # _data = np.loadtxt(pkg_resources.open_text(static, "seg.csv")) # calculate conversion factor if needed n = 18 if self.units == "mmol" else 1 maxX = self.xlim or 600 maxY = self.ylim or 600 # Define colormaps _colors = [ (0, 165 / 256, 0), (0, 255 / 256, 0), (255 / 256, 255 / 256, 0), (255 / 256, 0, 0), (128 / 256, 0, 0), ] _nodes = [0.0, 0.4375, 1.0625, 2.7500, 4.000] cmap = matplotlib.colors.LinearSegmentedColormap.from_list( "", list(zip([x / 4 for x in _nodes], _colors)) ) # Plot color axes # from . import static # temporary fix # ALREADY DONE grid_path = str(path_func(static, "seg600.png")) cax = ax.imshow( np.flipud(np.array(plt.imread(grid_path))), origin="lower", cmap=cmap, vmin=0, vmax=4, ) # Plot color bar cbar = plt.colorbar( cax, ticks=[0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0], orientation="vertical", fraction=0.15, aspect=6, ) cbar.ax.tick_params(labelsize=8) cbar.ax.yaxis.set_label_position("left") cbar.ax.set_ylabel("Risk score") # Separators for s in [0, 0.5, 1.5, 2.5, 3.5, 4]: cbar.ax.plot( [6, 6.5], [s] * 2, "-", color="black", lw=1, alpha=1, clip_on=False ) # Labels for label in [ (0.25, "None"), (1.0, "Slight"), (2.0, "Moderate"), (3.0, "High"), (3.75, "Extreme"), ]: cbar.ax.text( 6.2, label[0] - 0.008, label[1], ha="left", va="center", rotation=0, fontsize=10, ) if self.percentage: seg_scores = self._calc_error_score() _zones_sub = [[] for _ in range(8)] edges = list(np.arange(0, 4.5, 0.5)) for x in range(len(edges) - 1): _zones_sub[x] = np.array( seg_scores[(seg_scores >= edges[x]) & (seg_scores < edges[x + 1])] ) perc_zones = [(len(x) / len(seg_scores)) * 100 for x in _zones_sub] for i, x in enumerate(perc_zones): cbar.ax.plot( [0, 5], [(i * 0.5) + 0.5] * 2, "--", color="grey", lw=1, alpha=0.6 ) if x > 0: if round(x, 2) == 0: _str = "<0.01%" else: _str = "{:.2f}%".format(x) cbar.ax.text( 2, (i * 0.5) + 0.25, _str, ha="center", va="center", fontsize=9 ) ax.scatter( self.reference * n, self.test * n, marker="o", edgecolors="black", facecolors="white", alpha=0.8, s=8, **self.point_kws ) # limits and ticks _ticks = [0, 90, 180, 270, 360, 450, 540] ax.set_xticks([round(x, 1) for x in _ticks]) ax.set_yticks([round(x, 1) for x in _ticks]) ax.set_xticklabels([round(x / n, 1) for x in _ticks]) ax.set_yticklabels([round(x / n, 1) for x in _ticks]) ax.set_xlim(0, maxX) ax.set_ylim(0, maxY) # graph labels ax.set_ylabel(self.y_title) ax.set_xlabel(self.x_title) if self.graph_title is not None: ax.set_title(self.graph_title) def seg( reference, test, units, x_label=None, y_label=None, title=None, xlim=None, ylim=None, percentage=False, point_kws=None, square=False, ax=None, ): """Provide a glucose error grid analyses as designed by the surveillance error grid. This is an Axis-level function which will draw the surveillance error grid plot. onto the current active Axis object unless ``ax`` is provided. Parameters ---------- reference, test : array, or list Glucose values obtained from the reference and predicted methods, preferably provided in a np.array. units : str The SI units which the glucose values are provided in. Options: 'mmol', 'mgdl' or 'mg/dl'. x_label : str, optional The label which is added to the X-axis. If None is provided, a standard label will be added. y_label : str, optional The label which is added to the Y-axis. If None is provided, a standard label will be added. title : str, optional Title of the plot. If None is provided, no title will be plotted. xlim : list, optional Minimum and maximum limits for X-axis. Should be provided as list or tuple. If not set, matplotlib will decide its own bounds. ylim : list, optional Minimum and maximum limits for Y-axis. Should be provided as list or tuple. If not set, matplotlib will decide its own bounds. percentage : bool, optional If True, percentage of the zones will be depicted in the plot. point_kws : dict of key, value mappings, optional Additional keyword arguments for `plt.scatter`. square : bool, optional If True, set the Axes aspect to "equal" so each cell will be square-shaped. ax : matplotlib Axes, optional Axes in which to draw the plot, otherwise use the currently-active Axes. Returns ------- ax : matplotlib Axes Axes object with the Surveillance error grid plot. References --------- [klonoff_2014] Klonoff, D. C., Lias, C., et al. J Diabetes Sci Technol, vol. 8, no. 4, 2014, pp 658-672. [kovatchev_2014] Kovatchev, B. P., Wakeman, C. A., et al. J Diabetes Sci Technol, vol 8, no. 4, 2014, pp. 673-684. """ plotter: _SEG = _SEG( reference, test, units, x_label, y_label, title, xlim, ylim, percentage, point_kws, ) # Draw the plot and return the Axes if ax is None: ax = plt.gca() if square: ax.set_aspect("equal") plotter.plot(ax) return ax def segscores(reference, test, units): """Provides the raw error values as depicted by the surveillance error grid analysis for each point in the reference and test datasets. Parameters ---------- reference, test : array, or list Glucose values obtained from the reference and predicted methods, preferably provided in a np.array. units : str The SI units which the glucose values are provided in. Options: 'mmol', 'mgdl' or 'mg/dl'. Returns ------- segscores : list Returns a list with a SEG score for each test, reference pair. """ # obtain zones from a Clarke reference object _zones = _SEG( reference, test, units, None, None, None, None, None, None, None )._calc_error_score() return _zones
31.816353
88
0.435824
5,598
49,029
3.737049
0.088424
0.009751
0.003824
0.008031
0.798327
0.764245
0.745363
0.736185
0.722562
0.719073
0
0.074261
0.453711
49,029
1,540
89
31.837013
0.706765
0.227151
0
0.602955
0
0
0.039132
0
0
0
0
0
0
1
0.024007
false
0
0.009234
0.00277
0.051708
0
0
0
0
null
0
0
0
0
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
c510ca6258cb286ace269aa178de380bd82b0c0f
87
py
Python
dyno/debug/__init__.py
mequanta/z-dyno
4ea296b710fcb1a87918644b8d8303e740490714
[ "MIT" ]
null
null
null
dyno/debug/__init__.py
mequanta/z-dyno
4ea296b710fcb1a87918644b8d8303e740490714
[ "MIT" ]
null
null
null
dyno/debug/__init__.py
mequanta/z-dyno
4ea296b710fcb1a87918644b8d8303e740490714
[ "MIT" ]
null
null
null
#from . handlers import DebugHandler from .qdbclientserver import DynoQdbClientServer
21.75
48
0.850575
8
87
9.25
0.75
0
0
0
0
0
0
0
0
0
0
0
0.114943
87
3
49
29
0.961039
0.402299
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
c52b8d9492fbb8787f001b52ab150ed32d5cac19
35
py
Python
labs/hello_world.py
MHSRoboticsCode/2015
410f427439d1641146329bfdd74667054a21a658
[ "MIT" ]
null
null
null
labs/hello_world.py
MHSRoboticsCode/2015
410f427439d1641146329bfdd74667054a21a658
[ "MIT" ]
null
null
null
labs/hello_world.py
MHSRoboticsCode/2015
410f427439d1641146329bfdd74667054a21a658
[ "MIT" ]
null
null
null
# 2015 lab 1 print('Hello World')
8.75
20
0.657143
6
35
3.833333
1
0
0
0
0
0
0
0
0
0
0
0.178571
0.2
35
3
21
11.666667
0.642857
0.285714
0
0
0
0
0.478261
0
0
0
0
0
0
1
0
true
0
0
0
0
1
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
1
0
5
c5506b8cb8987c67ff74a2750c6086bf36fa620f
23
py
Python
10_python_qa_pageobject-master/page_objects/common/Footer.py
turovod/Otus
57433c6944bca155177b07ff361139ff30f7f692
[ "MIT" ]
1
2019-09-18T11:39:07.000Z
2019-09-18T11:39:07.000Z
10_python_qa_pageobject-master/page_objects/common/Footer.py
turovod/Otus
57433c6944bca155177b07ff361139ff30f7f692
[ "MIT" ]
null
null
null
10_python_qa_pageobject-master/page_objects/common/Footer.py
turovod/Otus
57433c6944bca155177b07ff361139ff30f7f692
[ "MIT" ]
null
null
null
class Footer: pass
7.666667
13
0.652174
3
23
5
1
0
0
0
0
0
0
0
0
0
0
0
0.304348
23
2
14
11.5
0.9375
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0.5
0
0
0.5
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
0
0
0
0
0
5
c559d4de79723f982f2482edb5011bbb83a21f40
148
py
Python
deepblocks/optim/__init__.py
blurry-mood/Deep-Learning-Blocks
e81cf9270c21189a90799671d9446af449e826be
[ "MIT" ]
3
2021-09-22T14:27:33.000Z
2021-12-22T09:47:17.000Z
deepblocks/optim/__init__.py
blurry-mood/Deep-Learning-Blocks
e81cf9270c21189a90799671d9446af449e826be
[ "MIT" ]
null
null
null
deepblocks/optim/__init__.py
blurry-mood/Deep-Learning-Blocks
e81cf9270c21189a90799671d9446af449e826be
[ "MIT" ]
null
null
null
""" **Optim** implements weight optimization algorithms. It contains: - SAM algorithm (Sharpness-Aware Minimization). """ from .SAM import SAM
21.142857
56
0.722973
16
148
6.6875
0.875
0
0
0
0
0
0
0
0
0
0
0
0.155405
148
7
57
21.142857
0.856
0.797297
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
3d6a23a0b656dc9d6a6e935cbda869b644f2afea
155
py
Python
imageprovider/abstractimageprovider.py
freekode/wow-bot-cv
1c3bc408cca39fae16962bc138ac3b626db03e38
[ "MIT" ]
1
2021-09-20T05:03:25.000Z
2021-09-20T05:03:25.000Z
imageprovider/abstractimageprovider.py
freekode/wow-bot-opencv
1c3bc408cca39fae16962bc138ac3b626db03e38
[ "MIT" ]
null
null
null
imageprovider/abstractimageprovider.py
freekode/wow-bot-opencv
1c3bc408cca39fae16962bc138ac3b626db03e38
[ "MIT" ]
null
null
null
from abc import ABC, abstractmethod class AbstractImageProvider(ABC): @abstractmethod def get_image_numpy_array(self, coordinates): pass
19.375
49
0.748387
17
155
6.647059
0.823529
0.300885
0
0
0
0
0
0
0
0
0
0
0.193548
155
7
50
22.142857
0.904
0
0
0
0
0
0
0
0
0
0
0
0
1
0.2
false
0.2
0.2
0
0.6
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
1
0
0
5
3d89247fd32c1c9be7841752f6345ca208ffe2fe
170
py
Python
templates/dynamic_import.py
nexssp/language_python
f4cc09752e56a6f53f5854c78a0de30038cc8c58
[ "MIT" ]
2
2019-12-19T10:35:58.000Z
2020-01-15T19:52:32.000Z
templates/dynamic_import.py
nexssp/language_python
f4cc09752e56a6f53f5854c78a0de30038cc8c58
[ "MIT" ]
null
null
null
templates/dynamic_import.py
nexssp/language_python
f4cc09752e56a6f53f5854c78a0de30038cc8c58
[ "MIT" ]
null
null
null
import importlib name = 'test_module' # method 1 module = importlib.import_module('test_module') # method 2 module = __import__(name, fromlist=['']) module.some_func()
17
47
0.741176
22
170
5.363636
0.5
0.169492
0.271186
0
0
0
0
0
0
0
0
0.013423
0.123529
170
9
48
18.888889
0.778523
0.1
0
0
0
0
0.146667
0
0
0
0
0
0
1
0
false
0
0.6
0
0.6
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
5
3dae0f7ca44913a8988167c7f49a91666bb48b27
188
py
Python
docker/test/integration/minifi/validators/SegfaultValidator.py
dtrodrigues/nifi-minifi-cpp
87147e2dffcda6cc6e4e0510a57cc88011fda37f
[ "Apache-2.0", "OpenSSL" ]
113
2016-04-30T15:00:13.000Z
2022-03-26T20:42:58.000Z
docker/test/integration/minifi/validators/SegfaultValidator.py
dtrodrigues/nifi-minifi-cpp
87147e2dffcda6cc6e4e0510a57cc88011fda37f
[ "Apache-2.0", "OpenSSL" ]
688
2016-04-28T17:52:38.000Z
2022-03-29T07:58:05.000Z
docker/test/integration/minifi/validators/SegfaultValidator.py
dtrodrigues/nifi-minifi-cpp
87147e2dffcda6cc6e4e0510a57cc88011fda37f
[ "Apache-2.0", "OpenSSL" ]
104
2016-04-28T15:20:51.000Z
2022-03-01T13:39:20.000Z
from .OutputValidator import OutputValidator class SegfaultValidator(OutputValidator): """ Validate that a file was received. """ def validate(self): return True
18.8
44
0.691489
18
188
7.222222
0.833333
0
0
0
0
0
0
0
0
0
0
0
0.234043
188
9
45
20.888889
0.902778
0.180851
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.25
0.25
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
5
3db5fa2cbe6449696d6758d1c09bd1497ff3d0df
36
py
Python
microservices/auth/run.py
boggda/test_forum
a0331cf5ff28b3a2a3d8e4c06facf496b9ea66a8
[ "MIT" ]
null
null
null
microservices/auth/run.py
boggda/test_forum
a0331cf5ff28b3a2a3d8e4c06facf496b9ea66a8
[ "MIT" ]
null
null
null
microservices/auth/run.py
boggda/test_forum
a0331cf5ff28b3a2a3d8e4c06facf496b9ea66a8
[ "MIT" ]
null
null
null
from src import auth auth.run()
9
21
0.666667
6
36
4
0.833333
0
0
0
0
0
0
0
0
0
0
0
0.25
36
3
22
12
0.888889
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
3dbfd87f534174b07122e0050f270722f14b56bd
216
py
Python
Syntages/Scripts/test_api.py
iliya-dehsarvi/Syntages
9a1be978b7dfdbc76d55ad500892184cfa03dd15
[ "MIT" ]
1
2021-08-22T04:58:58.000Z
2021-08-22T04:58:58.000Z
Syntages/Scripts/test_api.py
iliya-dehsarvi/Syntages
9a1be978b7dfdbc76d55ad500892184cfa03dd15
[ "MIT" ]
null
null
null
Syntages/Scripts/test_api.py
iliya-dehsarvi/Syntages
9a1be978b7dfdbc76d55ad500892184cfa03dd15
[ "MIT" ]
null
null
null
import requests, json response = requests.get('https://www.thecocktaildb.com/api/json/v1/1/filter.php?i=Gin') #print(len(json.loads(response.text)['drinks'])) print(json.dumps(json.loads(response.text), indent=3))
30.857143
87
0.74537
34
216
4.735294
0.705882
0.111801
0.21118
0.26087
0
0
0
0
0
0
0
0.014634
0.050926
216
6
88
36
0.770732
0.217593
0
0
0
0.333333
0.357143
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0.333333
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
5
9a795f250eead14c5b408f59114c5296e9f6ce71
186
py
Python
PyDarkLogic/MainDarkLogic/action.py
BlackWalker01/BlackLogic
5f49956a0d4ee7a10c35e006d340ba58ca692078
[ "MIT" ]
6
2020-04-21T22:25:02.000Z
2021-03-05T17:44:24.000Z
PyDarkLogic/MainDarkLogic/action.py
BlackWalker01/BlackLogic
5f49956a0d4ee7a10c35e006d340ba58ca692078
[ "MIT" ]
1
2020-08-04T22:35:39.000Z
2020-08-09T12:40:46.000Z
PyDarkLogic/MainDarkLogic/action.py
BlackWalker01/BlackLogic
5f49956a0d4ee7a10c35e006d340ba58ca692078
[ "MIT" ]
null
null
null
class Action: def __init__(self, fun, id=None): self._fun = fun self._id = id def fun(self): return self._fun def id(self): return self._id
16.909091
37
0.543011
26
186
3.576923
0.346154
0.225806
0.301075
0
0
0
0
0
0
0
0
0
0.354839
186
10
38
18.6
0.775
0
0
0
0
0
0
0
0
0
0
0
0
1
0.375
false
0
0
0.25
0.75
0
1
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
5
9aa767cd35d485c2409ced5f4c8702527f87f49f
265
py
Python
core/models/__init__.py
samlowe106/Saved-Sorter-For-Reddit
470f3621ae8c4ece7d6eda9de5f1270be6b2e848
[ "MIT" ]
1
2019-08-01T07:29:37.000Z
2019-08-01T07:29:37.000Z
core/models/__init__.py
samlowe106/saved-sorter-for-reddit
470f3621ae8c4ece7d6eda9de5f1270be6b2e848
[ "MIT" ]
2
2019-08-08T22:08:12.000Z
2019-09-15T05:49:35.000Z
core/models/__init__.py
samlowe106/saved-sorter-for-reddit
470f3621ae8c4ece7d6eda9de5f1270be6b2e848
[ "MIT" ]
null
null
null
from .parsers import IParser, ImgurParser, SingleImageParser, FlickrParser, GfycatParser, PARSERS from ..utils.strings import * from .submission_wrapper import SubmissionWrapper from ..utils.urls import * from .submission_source import SubmissionSource, SortOption
44.166667
97
0.837736
28
265
7.857143
0.607143
0.081818
0.181818
0
0
0
0
0
0
0
0
0
0.098113
265
5
98
53
0.920502
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
9aafde42512d57976f472fe8b49ad1143001dc34
1,515
py
Python
google-logo.py
RaviTeja-12/redesigned-chainsaw
b523f2f3d7a186b7cdc23b0163d1aa6cf6e43152
[ "MIT" ]
null
null
null
google-logo.py
RaviTeja-12/redesigned-chainsaw
b523f2f3d7a186b7cdc23b0163d1aa6cf6e43152
[ "MIT" ]
null
null
null
google-logo.py
RaviTeja-12/redesigned-chainsaw
b523f2f3d7a186b7cdc23b0163d1aa6cf6e43152
[ "MIT" ]
null
null
null
import turtle turtle.speed(100) turtle.bgcolor('black') turtle.width(3) turtle.color('#4285F4', '#4285F4') turtle.forward(120) turtle.right(90) turtle.circle(-150, 50) turtle.color('#39A853') turtle.circle(-150, 100) turtle.color('#FBBC05') turtle.circle(-150, 60) turtle.color('#EA4335', '#EA4335') turtle.begin_fill() turtle.circle(-150, 100) turtle.right(90) turtle.forward(50) turtle.right(90) turtle.circle(100, 100) turtle.right(90) turtle.fd(50) turtle.end_fill() turtle.color('#FBBC05') turtle.begin_fill() turtle.right(180) turtle.fd(50) turtle.right(90) turtle.circle(100, 60) turtle.right(90) turtle.fd(50) turtle.right(90) turtle.circle(-150, 60) turtle.end_fill() turtle.right(90) turtle.fd(50) turtle.right(90) turtle.circle(100, 60) turtle.right(90) turtle.fd(50) turtle.color('#39A853') turtle.begin_fill() turtle.right(180) turtle.fd(50) turtle.right(90) turtle.circle(100, 100) turtle.right(90) turtle.fd(50) turtle.right(90) turtle.circle(-150, 100) turtle.end_fill() turtle.right(90) turtle.fd(50) turtle.right(90) turtle.circle(100, 100) turtle.right(90) turtle.fd(50) turtle.color('#4285F4') turtle.begin_fill() turtle.right(180) turtle.fd(50) turtle.right(90) turtle.circle(100, 25) turtle.left(115) turtle.forward(60) turtle.right(90) turtle.fd(50) turtle.right(90) turtle.fd(120) turtle.right(90) turtle.circle(-160, 50) turtle.end_fill() turtle.hideturtle() turtle.penup() turtle.goto(-15, 20) turtle.pendown() turtle.color('gold') turtle.pensize(10) turtle.write("Ravitej") turtle.done()
18.9375
34
0.744554
248
1,515
4.516129
0.169355
0.225893
0.232143
0.339286
0.735714
0.601786
0.549107
0.549107
0.540179
0.540179
0
0.142354
0.063366
1,515
79
35
19.177215
0.646934
0
0
0.708861
0
0
0.052145
0
0
0
0
0
0
1
0
true
0
0.012658
0
0.012658
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
5
9ac8181da0fc8f034520d1d888ba60f0422a78d2
65
py
Python
sigmoid.py
rigovides/multiclass-logistic-regression
6c42de52b922e755188bc5977d891c0cada07145
[ "Apache-2.0" ]
2
2018-02-18T08:03:45.000Z
2019-10-17T10:26:39.000Z
sigmoid.py
rigovides/multiclass-logistic-regression
6c42de52b922e755188bc5977d891c0cada07145
[ "Apache-2.0" ]
null
null
null
sigmoid.py
rigovides/multiclass-logistic-regression
6c42de52b922e755188bc5977d891c0cada07145
[ "Apache-2.0" ]
2
2020-03-30T10:40:06.000Z
2020-11-13T18:59:40.000Z
import numpy as np def sigmoid(z): return 1/(1 + np.exp(-z))
16.25
29
0.615385
13
65
3.076923
0.769231
0
0
0
0
0
0
0
0
0
0
0.039216
0.215385
65
4
29
16.25
0.745098
0
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0.333333
0.333333
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
1
1
0
0
0
5
b124af0dd3e3874875d5e3c1be72adab195afb71
183
py
Python
lib/JumpScale/baselib/vfs/__init__.py
jumpscale7/jumpscale_core7
c3115656214cab1bd32f7a1e092c0bffc84a00cd
[ "Apache-2.0" ]
null
null
null
lib/JumpScale/baselib/vfs/__init__.py
jumpscale7/jumpscale_core7
c3115656214cab1bd32f7a1e092c0bffc84a00cd
[ "Apache-2.0" ]
4
2016-08-25T12:08:39.000Z
2018-04-12T12:36:01.000Z
lib/JumpScale/baselib/vfs/__init__.py
jumpscale7/jumpscale_core7
c3115656214cab1bd32f7a1e092c0bffc84a00cd
[ "Apache-2.0" ]
3
2016-03-08T07:49:34.000Z
2018-10-19T13:56:43.000Z
from JumpScale import j def cb(): from .BackupFactory import BackupFactory return BackupFactory j.base.loader.makeAvailable(j, 'clients') j.clients._register('backup', cb)
18.3
44
0.748634
23
183
5.913043
0.608696
0.117647
0
0
0
0
0
0
0
0
0
0
0.147541
183
9
45
20.333333
0.871795
0
0
0
0
0
0.071038
0
0
0
0
0
0
1
0.166667
true
0
0.333333
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
b1460b9aed9553215b3175d18a603bd6e646153b
450
py
Python
reversion/compat.py
sperrygrove/django-reversion
de5862a60e8fcfc9c14634dd51e004a0420a50b5
[ "BSD-3-Clause" ]
1
2017-10-31T02:37:37.000Z
2017-10-31T02:37:37.000Z
reversion/compat.py
sperrygrove/django-reversion
de5862a60e8fcfc9c14634dd51e004a0420a50b5
[ "BSD-3-Clause" ]
1
2017-10-31T01:56:58.000Z
2017-10-31T01:57:03.000Z
reversion/compat.py
sperrygrove/django-reversion
de5862a60e8fcfc9c14634dd51e004a0420a50b5
[ "BSD-3-Clause" ]
1
2020-01-08T20:18:17.000Z
2020-01-08T20:18:17.000Z
import django def remote_field(field): # remote_field is new in Django 1.9 return field.remote_field if hasattr(field, 'remote_field') else field.rel def remote_model(field): # remote_field is new in Django 1.9 return field.remote_field.model if hasattr(field, 'remote_field') else field.rel.to def is_authenticated(user): if django.VERSION < (1, 10): return user.is_authenticated() return user.is_authenticated
25
87
0.728889
69
450
4.594203
0.304348
0.242902
0.302839
0.113565
0.567823
0.567823
0.567823
0.567823
0.334385
0.334385
0
0.019074
0.184444
450
17
88
26.470588
0.844687
0.148889
0
0
0
0
0.063158
0
0
0
0
0
0
1
0.333333
false
0
0.111111
0.222222
0.888889
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
5
b14db3ffe4cd76fe5d8da684f3a34ce3e9906d65
1,793
py
Python
userInteraction/interfaces/IFinanceInteraction.py
tylertjburns/ledgerkeeper
cd69e9f48f35a973d08e450dfffdfea46bdc3802
[ "MIT" ]
null
null
null
userInteraction/interfaces/IFinanceInteraction.py
tylertjburns/ledgerkeeper
cd69e9f48f35a973d08e450dfffdfea46bdc3802
[ "MIT" ]
null
null
null
userInteraction/interfaces/IFinanceInteraction.py
tylertjburns/ledgerkeeper
cd69e9f48f35a973d08e450dfffdfea46bdc3802
[ "MIT" ]
null
null
null
from ledgerkeeper.mongoData.account import Account from abc import ABC, abstractmethod class IFinanceInteraction(ABC): # region Account UI @abstractmethod def request_bank_total(self): pass @abstractmethod def select_account(self, statusList=None): pass @abstractmethod def select_collection(self): pass @abstractmethod def get_add_new_account_input(self): pass @abstractmethod def get_record_expense_input(self, accountManager): pass @abstractmethod def get_add_bucket_to_account_input(self): pass @abstractmethod def get_move_funds_input(self, account:Account): pass @abstractmethod def get_add_waterfall_funds_input(self, account: Account): pass @abstractmethod def get_delete_bucket_from_account_input(self, account:Account): pass @abstractmethod def get_update_bucket_priority_input(self, account:Account): pass @abstractmethod def get_print_full_waterfall_input(self): pass @abstractmethod def get_add_open_balance_input(self): pass @abstractmethod def get_delete_open_balance_input(self, account:Account): pass # endregion # region Ledger UI @abstractmethod def get_add_ledger_manually_input(self): pass @abstractmethod def get_split_transaction_input(self, currentAmount: float): pass @abstractmethod def get_enter_ledger_from_income_transaction_input(self): pass @abstractmethod def get_enter_ledger_from_expense_transaction_input(self): pass # endregion # region Printing @abstractmethod def pretty_print_items(self, items, title=None): pass # endregion
22.135802
68
0.697156
198
1,793
5.984848
0.267677
0.258228
0.265823
0.263291
0.478481
0.420253
0.300422
0.167089
0.087764
0
0
0
0.245957
1,793
81
69
22.135802
0.876479
0.044618
0
0.631579
0
0
0
0
0
0
0
0
0
1
0.315789
false
0.315789
0.035088
0
0.368421
0.035088
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
0
0
0
5
b16b9232e173ae480558d2b4807a8fe301de5813
35
py
Python
apimock/__main__.py
MrUPGrade/api-mock
cffac2edd12e8191957458b6c5fc33f824a6454d
[ "MIT" ]
2
2018-03-10T16:01:58.000Z
2018-03-12T15:51:29.000Z
apimock/__main__.py
MrUPGrade/api-mock
cffac2edd12e8191957458b6c5fc33f824a6454d
[ "MIT" ]
null
null
null
apimock/__main__.py
MrUPGrade/api-mock
cffac2edd12e8191957458b6c5fc33f824a6454d
[ "MIT" ]
null
null
null
from apimock.cli import cli cli()
8.75
27
0.742857
6
35
4.333333
0.666667
0
0
0
0
0
0
0
0
0
0
0
0.171429
35
3
28
11.666667
0.896552
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
b17e36bd545dabd1896c29203d9587e9f75a3646
32
py
Python
gincco/methods/__init__.py
paulmorio/gincco
faffab019d8d64b32428ab1c956641c3f72ec43b
[ "MIT" ]
7
2021-01-14T10:15:25.000Z
2021-01-21T17:38:02.000Z
gincco/methods/__init__.py
paulmorio/gincco
faffab019d8d64b32428ab1c956641c3f72ec43b
[ "MIT" ]
null
null
null
gincco/methods/__init__.py
paulmorio/gincco
faffab019d8d64b32428ab1c956641c3f72ec43b
[ "MIT" ]
null
null
null
# pcomplexnet.methods init file
16
31
0.8125
4
32
6.5
1
0
0
0
0
0
0
0
0
0
0
0
0.125
32
1
32
32
0.928571
0.90625
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
5
4908bb47f5dec05de4d30ae59457343e7a0ef287
319
py
Python
wagtail/admin/models.py
wlcrs/wagtail
8afbc6c3eccef9eb0f09ed56c54cd36779451882
[ "BSD-3-Clause" ]
3
2019-05-14T13:43:08.000Z
2021-11-09T11:27:18.000Z
wagtail/admin/models.py
denza/wagtail
3939397850f2c73d3f960cea5cc9c2cfae2d005d
[ "BSD-3-Clause" ]
163
2019-06-14T20:45:06.000Z
2022-03-23T01:41:07.000Z
wagtail/admin/models.py
denza/wagtail
3939397850f2c73d3f960cea5cc9c2cfae2d005d
[ "BSD-3-Clause" ]
1
2021-05-11T00:05:26.000Z
2021-05-11T00:05:26.000Z
# The edit_handlers module extends Page with some additional attributes required by # wagtailadmin (namely, base_form_class and get_edit_handler). Importing this within # wagtailadmin.models ensures that this happens in advance of running wagtailadmin's # system checks. from wagtail.admin import edit_handlers # NOQA
53.166667
84
0.827586
45
319
5.733333
0.866667
0.093023
0
0
0
0
0
0
0
0
0
0
0.131661
319
5
85
63.8
0.931408
0.836991
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
494bfc701dcefb39304a1ef297f6e9ce6cdb2445
122
py
Python
umu-python/app/service/tosca/vo/tgif/service.py
suomitek/cubeai
cc4c0f5f445a552d239910da63944307c1f06e37
[ "Apache-2.0" ]
null
null
null
umu-python/app/service/tosca/vo/tgif/service.py
suomitek/cubeai
cc4c0f5f445a552d239910da63944307c1f06e37
[ "Apache-2.0" ]
null
null
null
umu-python/app/service/tosca/vo/tgif/service.py
suomitek/cubeai
cc4c0f5f445a552d239910da63944307c1f06e37
[ "Apache-2.0" ]
null
null
null
class Service(dict): def __init__(self, calls, provides): dict.__init__(self, calls=calls, provides=provides)
30.5
59
0.704918
15
122
5.2
0.533333
0.205128
0.333333
0
0
0
0
0
0
0
0
0
0.172131
122
3
60
40.666667
0.772277
0
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0
0
0.666667
0
1
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
5
494fd6c9f9fb7d924ec2eb0656241c426b7285e0
22
py
Python
gamepie-ios/__init__.py
JadedTuna/gamepie
d49ba3597457bca0b43eb8fc5218683c5e6eef59
[ "Zlib" ]
4
2017-04-23T20:47:53.000Z
2021-05-09T07:08:58.000Z
gamepie-pc/__init__.py
JadedTuna/gamepie
d49ba3597457bca0b43eb8fc5218683c5e6eef59
[ "Zlib" ]
null
null
null
gamepie-pc/__init__.py
JadedTuna/gamepie
d49ba3597457bca0b43eb8fc5218683c5e6eef59
[ "Zlib" ]
1
2015-05-19T18:58:45.000Z
2015-05-19T18:58:45.000Z
from gamepie import *
11
21
0.772727
3
22
5.666667
1
0
0
0
0
0
0
0
0
0
0
0
0.181818
22
1
22
22
0.944444
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
4961852565595c73c2fbd84c4a1bc313d48ba141
120
py
Python
stores/apps/users/admin.py
diassor/CollectorCity-Market-Place
892ad220b8cf1c0fc7433f625213fe61729522b2
[ "Apache-2.0" ]
135
2015-03-19T13:28:18.000Z
2022-03-27T06:41:42.000Z
stores/apps/users/admin.py
dfcoding/CollectorCity-Market-Place
e59acec3d600c049323397b17cae14fdcaaaec07
[ "Apache-2.0" ]
null
null
null
stores/apps/users/admin.py
dfcoding/CollectorCity-Market-Place
e59acec3d600c049323397b17cae14fdcaaaec07
[ "Apache-2.0" ]
83
2015-01-30T01:00:15.000Z
2022-03-08T17:25:10.000Z
from models import * from django.contrib import admin admin.site.register(Profile) admin.site.register(EmailVerify)
13.333333
32
0.8
16
120
6
0.625
0.1875
0.354167
0
0
0
0
0
0
0
0
0
0.116667
120
8
33
15
0.90566
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
4988ed34f3a4ff086f5d3bb23424b3785acc8ad6
23
py
Python
ohno/test/error.py
AnkitmB125/ohno
1d3e10e50fb782c6270e5b28fc582641e2e4be69
[ "MIT" ]
1
2020-07-30T02:02:41.000Z
2020-07-30T02:02:41.000Z
ohno/test/error.py
AnkitmB125/ohno
1d3e10e50fb782c6270e5b28fc582641e2e4be69
[ "MIT" ]
1
2021-12-13T19:54:39.000Z
2021-12-13T19:54:39.000Z
ohno/test/error.py
AnkitmB125/ohno
1d3e10e50fb782c6270e5b28fc582641e2e4be69
[ "MIT" ]
null
null
null
print("hello") printf()
11.5
14
0.695652
3
23
5.333333
1
0
0
0
0
0
0
0
0
0
0
0
0.043478
23
2
15
11.5
0.727273
0
0
0
0
0
0.208333
0
0
0
0
0
0
1
0
true
0
0
0
0
1
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
1
0
5
498a1de37eb73f6405e6cb9e83f72a07d1297a1a
23
py
Python
itamar.py
itamar-marom/test-repo
443e105eabc889577e35f6f640b234a5e790f2e9
[ "Apache-2.0" ]
null
null
null
itamar.py
itamar-marom/test-repo
443e105eabc889577e35f6f640b234a5e790f2e9
[ "Apache-2.0" ]
null
null
null
itamar.py
itamar-marom/test-repo
443e105eabc889577e35f6f640b234a5e790f2e9
[ "Apache-2.0" ]
null
null
null
print("Fuck ypu bitch")
23
23
0.73913
4
23
4.25
1
0
0
0
0
0
0
0
0
0
0
0
0.086957
23
1
23
23
0.809524
0
0
0
0
0
0.583333
0
0
0
0
0
0
1
0
true
0
0
0
0
1
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
1
0
5
b8c5e3b080bad351c6f864457369590f3a3c79f4
131
py
Python
ENCODN/TOOLS/COMMUNICATION/TELECOM/DECABIT/DECABIT_FRAME.py
akshitadixit/ENCODN
7b4ecaba10314f9f59f53e9b479016b21f8b632b
[ "RSA-MD" ]
6
2020-10-07T13:09:38.000Z
2021-01-16T17:16:51.000Z
ENCODN/TOOLS/COMMUNICATION/TELECOM/DECABIT/DECABIT_FRAME.py
akshitadixit/ENCODN
7b4ecaba10314f9f59f53e9b479016b21f8b632b
[ "RSA-MD" ]
27
2020-10-09T09:14:23.000Z
2021-01-22T07:16:43.000Z
ENCODN/TOOLS/COMMUNICATION/TELECOM/DECABIT/DECABIT_FRAME.py
DSC-IIIT-Kalyani/ENCODN
62752ac7e368b294ec9613a1f73cb3f1f7c878f5
[ "RSA-MD" ]
14
2020-10-07T14:25:59.000Z
2021-02-21T16:54:37.000Z
from tkinter import * from tkinter import ttk def DECABIT_FRAME(master=None): s = ttk.Style(master) s.theme_use('awdark')
18.714286
32
0.717557
20
131
4.6
0.7
0.23913
0.369565
0
0
0
0
0
0
0
0
0
0.175573
131
7
33
18.714286
0.851852
0
0
0
0
0
0.047619
0
0
0
0
0
0
1
0.2
false
0
0.4
0
0.6
0
1
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
5
b8ff86d0789f2985d30122efe69b5d32bf3538f8
399
py
Python
myclang/ops.py
FindDefinition/myclang
3fa641f3b4fa87e0d3b1d840288e61442293036a
[ "Apache-2.0" ]
null
null
null
myclang/ops.py
FindDefinition/myclang
3fa641f3b4fa87e0d3b1d840288e61442293036a
[ "Apache-2.0" ]
null
null
null
myclang/ops.py
FindDefinition/myclang
3fa641f3b4fa87e0d3b1d840288e61442293036a
[ "Apache-2.0" ]
null
null
null
from .betterenums import NodeKind from . import constants def nkind_is_decl(nkind: NodeKind): K = nkind.value return ((K >= constants.CXCURSOR_FIRST_DECL and K <= constants.CXCURSOR_LAST_DECL) or (K >= constants.CXCURSOR_FIRST_EXTRA_DECL and K <= constants.CXCURSOR_LAST_EXTRA_DECL) or (K >= constants.CXCURSOREX_FIRST_DECL and K <= constants.CXCURSOREX_LAST_DECL))
44.333333
101
0.736842
54
399
5.148148
0.351852
0.215827
0.258993
0.183453
0.305755
0.208633
0
0
0
0
0
0
0.177945
399
8
102
49.875
0.847561
0
0
0
0
0
0
0
0
0
0
0
0
1
0.142857
false
0
0.285714
0
0.571429
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
5
77323fb43d713d868d1f0935b5bac69129a4a303
36
py
Python
doodad/easy_sweep/__init__.py
charlesjsun/doodad
eb30cfc668054ab84f58536eb777a1a56258030a
[ "MIT" ]
36
2021-10-29T21:23:11.000Z
2022-03-30T15:38:13.000Z
doodad/easy_sweep/__init__.py
charlesjsun/doodad
eb30cfc668054ab84f58536eb777a1a56258030a
[ "MIT" ]
1
2020-03-11T14:41:43.000Z
2020-03-11T14:41:43.000Z
doodad/easy_sweep/__init__.py
charlesjsun/doodad
eb30cfc668054ab84f58536eb777a1a56258030a
[ "MIT" ]
10
2018-06-25T21:07:14.000Z
2021-07-19T18:46:17.000Z
from .launcher import DoodadSweeper
18
35
0.861111
4
36
7.75
1
0
0
0
0
0
0
0
0
0
0
0
0.111111
36
1
36
36
0.96875
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
77406e31c24d484db632a16a9756fc569723c96f
549
py
Python
digihel/wagtail_hooks.py
HotStew/digihel
3a53f6542b41c64c818fa34cc0709cdbfb8055db
[ "MIT" ]
21
2016-08-22T10:15:24.000Z
2022-03-23T08:10:48.000Z
digihel/wagtail_hooks.py
HotStew/digihel
3a53f6542b41c64c818fa34cc0709cdbfb8055db
[ "MIT" ]
101
2016-08-08T07:52:44.000Z
2021-06-17T20:18:59.000Z
digihel/wagtail_hooks.py
HotStew/digihel
3a53f6542b41c64c818fa34cc0709cdbfb8055db
[ "MIT" ]
16
2016-08-02T11:45:26.000Z
2021-02-18T11:27:34.000Z
from wagtail.core import hooks def allow_blindly(tag): return tag # See: http://docs.wagtail.io/en/v1.6/reference/hooks.html#construct-whitelister-element-rules @hooks.register('construct_whitelister_element_rules') def whitelister_element_rules(): rules = {} # Tables rules.update(dict.fromkeys(['table', 'thead', 'tbody', 'tfoot', 'tr', 'th', 'td'], allow_blindly)) # Divs, spans, code and anchors rules.update(dict.fromkeys(['div', 'span', 'a', 'code', 'pre', 'blockquote', 'section'], allow_blindly)) return rules
34.3125
108
0.692168
71
549
5.239437
0.647887
0.096774
0.185484
0.172043
0
0
0
0
0
0
0
0.004211
0.134791
549
15
109
36.6
0.778947
0.233151
0
0
0
0
0.223558
0.084135
0
0
0
0
0
1
0.222222
false
0
0.111111
0.111111
0.555556
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
5
7749960b1542d05ab18427eede88f6061266cdc9
945
py
Python
feature_raster/Transformers/CommonIndex.py
hectorpatino/feature_raster
34ec69e0e9fbfc697865f76d1c97627ba338bf7e
[ "BSD-3-Clause" ]
null
null
null
feature_raster/Transformers/CommonIndex.py
hectorpatino/feature_raster
34ec69e0e9fbfc697865f76d1c97627ba338bf7e
[ "BSD-3-Clause" ]
null
null
null
feature_raster/Transformers/CommonIndex.py
hectorpatino/feature_raster
34ec69e0e9fbfc697865f76d1c97627ba338bf7e
[ "BSD-3-Clause" ]
null
null
null
from sklearn.base import BaseEstimator, TransformerMixin import numpy as np # to avoid the warning o generating a RuntimeWarning np.seterr(divide='ignore', invalid='ignore') def normalize_difference_indexes_minus_plus(band_1, band_2): """ Uses the general formula of all normalize difference indexes where the numerator is a substraction and the denominator is and adition Parameters __________ band_1: numpy array band_2: numpy array """ numerator = np.subtract(band_2, band_1, dtype=np.float64) denominator = np.add(band_1, band_2, dtype=np.float64) index = np.where(band_2 + band_1 == 0., 0., numerator / denominator) return index class CommonIndex(BaseEstimator, TransformerMixin): def __init__(self): pass def fit(self): return self def transform(self, x): # TODO x must be a dataframe return x
24.230769
68
0.669841
122
945
4.959016
0.516393
0.041322
0.08595
0.033058
0
0
0
0
0
0
0
0.022825
0.258201
945
38
69
24.868421
0.840228
0.291005
0
0
0
0
0.019078
0
0
0
0
0.026316
0
1
0.235294
false
0.058824
0.117647
0.117647
0.588235
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
1
0
1
0
1
1
0
0
5
774a16b7b5f3c4aec1573eae8d74b13eda1fff2f
2,519
py
Python
src/bpp/models/sloty/wydawnictwo_ciagle.py
iplweb/django-bpp
85f183a99d8d5027ae4772efac1e4a9f21675849
[ "BSD-3-Clause" ]
1
2017-04-27T19:50:02.000Z
2017-04-27T19:50:02.000Z
src/bpp/models/sloty/wydawnictwo_ciagle.py
mpasternak/django-bpp
434338821d5ad1aaee598f6327151aba0af66f5e
[ "BSD-3-Clause" ]
41
2019-11-07T00:07:02.000Z
2022-02-27T22:09:39.000Z
src/bpp/models/sloty/wydawnictwo_ciagle.py
iplweb/bpp
f027415cc3faf1ca79082bf7bacd4be35b1a6fdf
[ "BSD-3-Clause" ]
null
null
null
from decimal import Decimal from .common import SlotMixin class SlotKalkulator_Wydawnictwo_Ciagle_Prog1(SlotMixin): """ Artykuł z czasopisma z listy ministerialnej. Dla roku 2017, 2018: punkty KBN >= 30 """ def punkty_pkd(self, dyscyplina): if self.ma_dyscypline(dyscyplina): return self.original.punkty_kbn def slot_dla_autora_z_dyscypliny(self, dyscyplina): azd = len(self.autorzy_z_dyscypliny(dyscyplina)) if azd == 0: return return Decimal("1") / azd def slot_dla_dyscypliny(self, dyscyplina): if self.ma_dyscypline(dyscyplina): return Decimal("1") class SlotKalkulator_Wydawnictwo_Ciagle_Prog2(SlotMixin): """ Artykuł z czasopisma z listy ministerialnej. Dla roku 2017-2018: punkty KBN 20 lub 25 """ def punkty_pkd(self, dyscyplina): if self.ma_dyscypline(dyscyplina): pierwiastek = self.pierwiastek_k_przez_m(dyscyplina) if pierwiastek is None: return None if self.liczba_k(dyscyplina) == 0: return 0 return self.original.punkty_kbn * max(pierwiastek, Decimal("0.1")) def slot_dla_autora_z_dyscypliny(self, dyscyplina): if not self.ma_dyscypline(dyscyplina): return azd = len(self.autorzy_z_dyscypliny(dyscyplina)) if azd > 0: return self.pierwiastek_k_przez_m(dyscyplina) * 1 / azd def slot_dla_dyscypliny(self, dyscyplina): if not self.ma_dyscypline(dyscyplina): return return self.pierwiastek_k_przez_m(dyscyplina) class SlotKalkulator_Wydawnictwo_Ciagle_Prog3(SlotMixin): """ Artykuł z czasopisma z listy ministerialnej. Dla roku 2017-2018: punkty KBN poniżej 20 lub 5 """ def punkty_pkd(self, dyscyplina): if self.ma_dyscypline(dyscyplina): k_przez_m = self.k_przez_m(dyscyplina) if k_przez_m is None: return if self.liczba_k(dyscyplina) == 0: return 0 return self.original.punkty_kbn * max(k_przez_m, Decimal("0.1")) def slot_dla_autora_z_dyscypliny(self, dyscyplina): if not self.ma_dyscypline(dyscyplina): return return self.jeden_przez_wszyscy() def slot_dla_dyscypliny(self, dyscyplina): if not self.ma_dyscypline(dyscyplina): return return self.jeden_przez_wszyscy() * len(self.autorzy_z_dyscypliny(dyscyplina))
29.635294
86
0.651052
306
2,519
5.130719
0.186275
0.09172
0.081529
0.132484
0.80828
0.781529
0.738854
0.700637
0.650318
0.622293
0
0.026645
0.269948
2,519
84
87
29.988095
0.82708
0.104407
0
0.58
0
0
0.00364
0
0
0
0
0
0
1
0.18
false
0
0.04
0
0.56
0
0
0
0
null
0
0
0
1
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
62169a70f059f8e0e971691fd019e05875a5b347
104
py
Python
backend/application/user/__init__.py
vitor-kato/ACMEVita-API
f2efee5e40649e450ca9d845990b93098a61efd5
[ "MIT" ]
null
null
null
backend/application/user/__init__.py
vitor-kato/ACMEVita-API
f2efee5e40649e450ca9d845990b93098a61efd5
[ "MIT" ]
null
null
null
backend/application/user/__init__.py
vitor-kato/ACMEVita-API
f2efee5e40649e450ca9d845990b93098a61efd5
[ "MIT" ]
null
null
null
from flask import Blueprint from . import auth, models, schemas user_bp = Blueprint("user", __name__)
17.333333
37
0.759615
14
104
5.285714
0.714286
0
0
0
0
0
0
0
0
0
0
0
0.153846
104
5
38
20.8
0.840909
0
0
0
0
0
0.038462
0
0
0
0
0
0
1
0
false
0
0.666667
0
0.666667
0.666667
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
1
0
5
621cc1f44ff166a433a055b86fc047762448e52f
64
py
Python
pyfilter/filters/__init__.py
merz9b/pyfilter
437e3fa872595df7bbde67b641770fbeaf825e7a
[ "MIT" ]
null
null
null
pyfilter/filters/__init__.py
merz9b/pyfilter
437e3fa872595df7bbde67b641770fbeaf825e7a
[ "MIT" ]
null
null
null
pyfilter/filters/__init__.py
merz9b/pyfilter
437e3fa872595df7bbde67b641770fbeaf825e7a
[ "MIT" ]
null
null
null
from .apf import APF from .sisr import SISR from .ukf import UKF
21.333333
22
0.78125
12
64
4.166667
0.416667
0
0
0
0
0
0
0
0
0
0
0
0.171875
64
3
23
21.333333
0.943396
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
62285dfb085f3214e69786d5ad21f72b805805b4
9,918
py
Python
DQM/EcalMonitorClient/python/TimingClient_cfi.py
ckamtsikis/cmssw
ea19fe642bb7537cbf58451dcf73aa5fd1b66250
[ "Apache-2.0" ]
852
2015-01-11T21:03:51.000Z
2022-03-25T21:14:00.000Z
DQM/EcalMonitorClient/python/TimingClient_cfi.py
ckamtsikis/cmssw
ea19fe642bb7537cbf58451dcf73aa5fd1b66250
[ "Apache-2.0" ]
30,371
2015-01-02T00:14:40.000Z
2022-03-31T23:26:05.000Z
DQM/EcalMonitorClient/python/TimingClient_cfi.py
ckamtsikis/cmssw
ea19fe642bb7537cbf58451dcf73aa5fd1b66250
[ "Apache-2.0" ]
3,240
2015-01-02T05:53:18.000Z
2022-03-31T17:24:21.000Z
import FWCore.ParameterSet.Config as cms from DQM.EcalMonitorTasks.TimingTask_cfi import ecalTimingTask from DQM.EcalMonitorClient.IntegrityClient_cfi import ecalIntegrityClient minChannelEntries = 1 minTowerEntries = 3 toleranceMean = 2. toleranceRMS = 6. minChannelEntriesFwd = 8 minTowerEntriesFwd = 24 toleranceMeanFwd = 6. toleranceRMSFwd = 12. tailPopulThreshold = 0.4 timeWindow = 25. ecalTimingClient = cms.untracked.PSet( params = cms.untracked.PSet( minChannelEntries = cms.untracked.int32(minChannelEntries), minTowerEntries = cms.untracked.int32(minTowerEntries), toleranceMean = cms.untracked.double(toleranceMean), toleranceRMS = cms.untracked.double(toleranceRMS), minChannelEntriesFwd = cms.untracked.int32(minChannelEntriesFwd), minTowerEntriesFwd = cms.untracked.int32(minTowerEntriesFwd), toleranceMeanFwd = cms.untracked.double(toleranceMeanFwd), toleranceRMSFwd = cms.untracked.double(toleranceRMSFwd), tailPopulThreshold = cms.untracked.double(tailPopulThreshold) ), sources = cms.untracked.PSet( TimeAllMap = ecalTimingTask.MEs.TimeAllMap, TimeMap = ecalTimingTask.MEs.TimeMap, TimeMapByLS = ecalTimingTask.MEs.TimeMapByLS, ChStatus = ecalIntegrityClient.MEs.ChStatus ), MEs = cms.untracked.PSet( RMSAll = cms.untracked.PSet( path = cms.untracked.string('%(subdet)s/%(prefix)sSummaryClient/%(prefix)sTMT%(suffix)s timing rms 1D summary'), kind = cms.untracked.string('TH1F'), otype = cms.untracked.string('Ecal3P'), xaxis = cms.untracked.PSet( high = cms.untracked.double(10.0), nbins = cms.untracked.int32(100), low = cms.untracked.double(0.0), title = cms.untracked.string('time (ns)') ), btype = cms.untracked.string('User'), description = cms.untracked.string('Distribution of per-channel timing RMS. Channels with entries less than ' + str(minChannelEntries) + ' are not considered.') ), ProjEta = cms.untracked.PSet( path = cms.untracked.string('%(subdet)s/%(prefix)sTimingClient/%(prefix)sTMT timing projection eta%(suffix)s'), kind = cms.untracked.string('TProfile'), yaxis = cms.untracked.PSet( title = cms.untracked.string('time (ns)') ), otype = cms.untracked.string('Ecal3P'), btype = cms.untracked.string('ProjEta'), description = cms.untracked.string('Projection of per-channel mean timing. Channels with entries less than ' + str(minChannelEntries) + ' are not considered.') ), FwdBkwdDiff = cms.untracked.PSet( path = cms.untracked.string('%(subdet)s/%(prefix)sTimingTask/%(prefix)sTMT timing %(prefix)s+ - %(prefix)s-'), kind = cms.untracked.string('TH1F'), otype = cms.untracked.string('Ecal2P'), xaxis = cms.untracked.PSet( high = cms.untracked.double(5.0), nbins = cms.untracked.int32(100), low = cms.untracked.double(-5.0), title = cms.untracked.string('time (ns)') ), btype = cms.untracked.string('User'), description = cms.untracked.string('Forward-backward asymmetry of per-channel mean timing. Channels with entries less than ' + str(minChannelEntries) + ' are not considered.') ), FwdvBkwd = cms.untracked.PSet( kind = cms.untracked.string('TH2F'), yaxis = cms.untracked.PSet( high = cms.untracked.double(timeWindow), nbins = cms.untracked.int32(50), low = cms.untracked.double(-timeWindow), title = cms.untracked.string('time (ns)') ), otype = cms.untracked.string('Ecal2P'), xaxis = cms.untracked.PSet( high = cms.untracked.double(timeWindow), nbins = cms.untracked.int32(50), low = cms.untracked.double(-timeWindow) ), btype = cms.untracked.string('User'), path = cms.untracked.string('%(subdet)s/%(prefix)sTimingTask/%(prefix)sTMT timing %(prefix)s+ vs %(prefix)s-'), description = cms.untracked.string('Forward-backward correlation of per-channel mean timing. Channels with entries less than ' + str(minChannelEntries) + ' are not considered.') ), ProjPhi = cms.untracked.PSet( path = cms.untracked.string('%(subdet)s/%(prefix)sTimingClient/%(prefix)sTMT timing projection phi%(suffix)s'), kind = cms.untracked.string('TProfile'), yaxis = cms.untracked.PSet( title = cms.untracked.string('time (ns)') ), otype = cms.untracked.string('Ecal3P'), btype = cms.untracked.string('ProjPhi'), description = cms.untracked.string('Projection of per-channel mean timing. Channels with entries less than ' + str(minChannelEntries) + ' are not considered.') ), MeanSM = cms.untracked.PSet( kind = cms.untracked.string('TH1F'), yaxis = cms.untracked.PSet( title = cms.untracked.string('time (ns)') ), otype = cms.untracked.string('SM'), xaxis = cms.untracked.PSet( high = cms.untracked.double(timeWindow), nbins = cms.untracked.int32(100), low = cms.untracked.double(-timeWindow) ), btype = cms.untracked.string('User'), path = cms.untracked.string('%(subdet)s/%(prefix)sTimingClient/%(prefix)sTMT timing mean %(sm)s'), description = cms.untracked.string('Distribution of per-channel timing mean. Channels with entries less than ' + str(minChannelEntries) + ' are not considered.') ), RMSMap = cms.untracked.PSet( path = cms.untracked.string('%(subdet)s/%(prefix)sTimingClient/%(prefix)sTMT timing rms %(sm)s'), kind = cms.untracked.string('TH2F'), zaxis = cms.untracked.PSet( title = cms.untracked.string('rms (ns)') ), otype = cms.untracked.string('SM'), btype = cms.untracked.string('Crystal'), description = cms.untracked.string('2D distribution of per-channel timing RMS. Channels with entries less than ' + str(minChannelEntries) + ' are not considered.') ), QualitySummary = cms.untracked.PSet( path = cms.untracked.string('%(subdet)s/%(prefix)sSummaryClient/%(prefix)sTMT%(suffix)s timing quality summary'), kind = cms.untracked.string('TH2F'), otype = cms.untracked.string('Ecal3P'), btype = cms.untracked.string('SuperCrystal'), description = cms.untracked.string('Summary of the timing data quality. A 5x5 tower is red if the mean timing of the tower is off by more than ' + str(toleranceMean) + ' or RMS is greater than ' + str(toleranceRMS) + ' (' + str(toleranceMeanFwd) + ' and ' + str(toleranceRMSFwd) + ' in forward region). Towers with total entries less than ' + str(minTowerEntries) + ' are not subject to this evaluation. Since 5x5 tower timings are calculated with a tighter time-window than per-channel timings, a tower can additionally become red if its the sum of per-channel timing histogram entries is greater than per-tower histogram entries by factor ' + str(1. / (1. - tailPopulThreshold)) + ' (significant fraction of events fall outside the tight time-window).') ), Quality = cms.untracked.PSet( path = cms.untracked.string('%(subdet)s/%(prefix)sTimingClient/%(prefix)sTMT timing quality %(sm)s'), kind = cms.untracked.string('TH2F'), otype = cms.untracked.string('SM'), btype = cms.untracked.string('Crystal'), description = cms.untracked.string('Summary of the timing data quality. A channel is red if its mean timing is off by more than ' + str(toleranceMean) + ' or RMS is greater than ' + str(toleranceRMS) + '. Channels with entries less than ' + str(minChannelEntries) + ' are not considered.') ), MeanAll = cms.untracked.PSet( path = cms.untracked.string('%(subdet)s/%(prefix)sSummaryClient/%(prefix)sTMT%(suffix)s timing mean 1D summary'), kind = cms.untracked.string('TH1F'), otype = cms.untracked.string('Ecal3P'), xaxis = cms.untracked.PSet( high = cms.untracked.double(timeWindow), nbins = cms.untracked.int32(100), low = cms.untracked.double(-timeWindow), title = cms.untracked.string('time (ns)') ), btype = cms.untracked.string('User'), description = cms.untracked.string('Distribution of per-channel timing mean. Channels with entries less than ' + str(minChannelEntries) + ' are not considered.') ), TrendMean = cms.untracked.PSet( path = cms.untracked.string('Ecal/Trends/TimingClient %(prefix)s timing mean'), kind = cms.untracked.string('TProfile'), otype = cms.untracked.string('Ecal2P'), btype = cms.untracked.string('Trend'), description = cms.untracked.string('Trend of timing mean. Plots simple average of all channel timing means at each lumisection.') ), TrendRMS = cms.untracked.PSet( path = cms.untracked.string('Ecal/Trends/TimingClient %(prefix)s timing rms'), kind = cms.untracked.string('TProfile'), otype = cms.untracked.string('Ecal2P'), btype = cms.untracked.string('Trend'), description = cms.untracked.string('Trend of timing rms. Plots simple average of all channel timing rms at each lumisection.') ) ) )
58.686391
767
0.622908
1,057
9,918
5.842952
0.164617
0.235104
0.198187
0.042746
0.716483
0.713245
0.703044
0.667584
0.667584
0.646535
0
0.011499
0.254688
9,918
168
768
59.035714
0.823999
0
0
0.54878
0
0.02439
0.279621
0.055158
0
0
0
0
0
1
0
false
0
0.018293
0
0.018293
0
0
0
0
null
1
1
0
0
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
626011d769f714ac15156f7d57ed0fbeb8351c10
13,011
py
Python
system/t12_api/snapshots.py
masselstine/aptly
3d2ccf1b2a02ea45eb0fa4fa7180b1809cb4590d
[ "MIT" ]
1
2021-09-13T02:34:59.000Z
2021-09-13T02:34:59.000Z
system/t12_api/snapshots.py
masselstine/aptly
3d2ccf1b2a02ea45eb0fa4fa7180b1809cb4590d
[ "MIT" ]
6
2021-06-23T08:40:02.000Z
2021-11-02T09:12:51.000Z
system/t12_api/snapshots.py
masselstine/aptly
3d2ccf1b2a02ea45eb0fa4fa7180b1809cb4590d
[ "MIT" ]
3
2020-10-12T21:25:57.000Z
2021-11-28T17:23:24.000Z
from api_lib import APITest from publish import DefaultSigningOptions class SnapshotsAPITestCreateShowEmpty(APITest): """ GET /api/snapshots/:name, POST /api/snapshots, GET /api/snapshots/:name/packages """ def check(self): snapshot_name = self.random_name() snapshot_desc = {u'Description': u'fun snapshot', u'Name': snapshot_name} # create empty snapshot resp = self.post_task("/api/snapshots", json=snapshot_desc) self.check_equal(resp.json()['State'], 2) self.check_subset(snapshot_desc, self.get("/api/snapshots/" + snapshot_name).json()) self.check_equal(self.get("/api/snapshots/" + snapshot_name).status_code, 200) resp = self.get("/api/snapshots/" + snapshot_name + "/packages") self.check_equal(resp.status_code, 200) self.check_equal(resp.json(), []) self.check_equal(self.get("/api/snapshots/" + self.random_name()).status_code, 404) # create snapshot with duplicate name resp = self.post_task("/api/snapshots", json=snapshot_desc) self.check_equal(resp.json()['State'], 3) class SnapshotsAPITestCreateFromRefs(APITest): """ GET /api/snapshots/:name, POST /api/snapshots, GET /api/snapshots/:name/packages, GET /api/snapshots """ def check(self): snapshot_name = self.random_name() snapshot_desc = {u'Description': u'fun snapshot', u'Name': snapshot_name, u'SourceSnapshots': [self.random_name()]} # creating snapshot from missing source snapshot resp = self.post("/api/snapshots", json=snapshot_desc) self.check_equal(resp.status_code, 404) # create empty snapshot empty_snapshot_name = self.random_name() resp = self.post_task("/api/snapshots", json={"Name": empty_snapshot_name}) self.check_equal(resp.json()['State'], 2) self.check_equal( self.get("/api/snapshots/" + empty_snapshot_name).json()['Description'], "Created as empty" ) # create and upload package to repo to register package in DB repo_name = self.random_name() self.check_equal(self.post("/api/repos", json={"Name": repo_name}).status_code, 201) d = self.random_name() self.check_equal(self.upload("/api/files/" + d, "libboost-program-options-dev_1.49.0.1_i386.deb").status_code, 200) self.check_equal(self.post_task("/api/repos/" + repo_name + "/file/" + d).json()['State'], 2) # create snapshot with empty snapshot as source and package snapshot = snapshot_desc.copy() snapshot['PackageRefs'] = ["Pi386 libboost-program-options-dev 1.49.0.1 918d2f433384e378"] snapshot['SourceSnapshots'] = [empty_snapshot_name] resp = self.post_task("/api/snapshots", json=snapshot) self.check_equal(resp.json()['State'], 2) snapshot.pop('SourceSnapshots') snapshot.pop('PackageRefs') resp = self.get("/api/snapshots/" + snapshot_name) self.check_equal(resp.status_code, 200) self.check_subset(snapshot, resp.json()) self.check_subset(snapshot, self.get("/api/snapshots/" + snapshot_name).json()) resp = self.get("/api/snapshots/" + snapshot_name + "/packages") self.check_equal(resp.status_code, 200) self.check_equal(resp.json(), ["Pi386 libboost-program-options-dev 1.49.0.1 918d2f433384e378"]) # create snapshot with unreferenced package resp = self.post_task("/api/snapshots", json={ "Name": self.random_name(), "PackageRefs": ["Pi386 libboost-program-options-dev 1.49.0.1 918d2f433384e378", "Pamd64 no-such-package 1.2 91"]}) self.check_equal(resp.json()['State'], 3) # list snapshots resp = self.get("/api/snapshots", params={"sort": "time"}) self.check_equal(resp.status_code, 200) self.check_equal([s["Name"] for s in resp.json() if s["Name"] in [empty_snapshot_name, snapshot_name]], [empty_snapshot_name, snapshot_name]) class SnapshotsAPITestCreateFromRepo(APITest): """ POST /api/repos, POST /api/repos/:name/snapshots, GET /api/snapshots/:name """ def check(self): repo_name = self.random_name() snapshot_name = self.random_name() self.check_equal(self.post("/api/repos", json={"Name": repo_name}).status_code, 201) resp = self.post_task("/api/repos/" + repo_name + '/snapshots', json={'Name': snapshot_name}) self.check_equal(resp.json()['State'], 2) self.check_equal([], self.get("/api/snapshots/" + snapshot_name + "/packages", params={"format": "details"}).json()) snapshot_name = self.random_name() d = self.random_name() self.check_equal(self.upload("/api/files/" + d, "libboost-program-options-dev_1.49.0.1_i386.deb").status_code, 200) self.check_equal(self.post_task("/api/repos/" + repo_name + "/file/" + d).json()['State'], 2) resp = self.post_task("/api/repos/" + repo_name + '/snapshots', json={'Name': snapshot_name}) self.check_equal(resp.json()['State'], 2) self.check_equal(self.get("/api/snapshots/" + snapshot_name).status_code, 200) self.check_subset({u'Architecture': 'i386', u'Package': 'libboost-program-options-dev', u'Version': '1.49.0.1', 'FilesHash': '918d2f433384e378'}, self.get("/api/snapshots/" + snapshot_name + "/packages", params={"format": "details"}).json()[0]) self.check_subset({u'Architecture': 'i386', u'Package': 'libboost-program-options-dev', u'Version': '1.49.0.1', 'FilesHash': '918d2f433384e378'}, self.get("/api/snapshots/" + snapshot_name + "/packages", params={"format": "details", "q": "Version (> 0.6.1-1.4)"}).json()[0]) # duplicate snapshot name resp = self.post_task("/api/repos/" + repo_name + '/snapshots', json={'Name': snapshot_name}) self.check_equal(resp.json()['State'], 3) class SnapshotsAPITestCreateUpdate(APITest): """ POST /api/snapshots, PUT /api/snapshots/:name, GET /api/snapshots/:name """ def check(self): snapshot_name = self.random_name() snapshot_desc = {u'Description': u'fun snapshot', u'Name': snapshot_name} resp = self.post_task("/api/snapshots", json=snapshot_desc) self.check_equal(resp.json()['State'], 2) new_snapshot_name = self.random_name() resp = self.put_task("/api/snapshots/" + snapshot_name, json={'Name': new_snapshot_name, 'Description': 'New description'}) self.check_equal(resp.json()['State'], 2) resp = self.get("/api/snapshots/" + new_snapshot_name) self.check_equal(resp.status_code, 200) self.check_subset({"Name": new_snapshot_name, "Description": "New description"}, resp.json()) # duplicate name resp = self.put_task("/api/snapshots/" + new_snapshot_name, json={'Name': new_snapshot_name, 'Description': 'New description'}) self.check_equal(resp.json()['State'], 3) # missing snapshot resp = self.put("/api/snapshots/" + snapshot_name, json={}) self.check_equal(resp.status_code, 404) class SnapshotsAPITestCreateDelete(APITest): """ POST /api/snapshots, DELETE /api/snapshots/:name, GET /api/snapshots/:name """ def check(self): snapshot_name = self.random_name() snapshot_desc = {u'Description': u'fun snapshot', u'Name': snapshot_name} # deleting unreferenced snapshot resp = self.post_task("/api/snapshots", json=snapshot_desc) self.check_equal(resp.json()['State'], 2) self.check_equal(self.delete_task("/api/snapshots/" + snapshot_name).json()['State'], 2) self.check_equal(self.get("/api/snapshots/" + snapshot_name).status_code, 404) # deleting referenced snapshot snap1, snap2 = self.random_name(), self.random_name() self.check_equal(self.post_task("/api/snapshots", json={"Name": snap1}).json()['State'], 2) self.check_equal( self.post_task( "/api/snapshots", json={"Name": snap2, "SourceSnapshots": [snap1]} ).json()['State'], 2 ) self.check_equal(self.delete_task("/api/snapshots/" + snap1).json()['State'], 3) self.check_equal(self.get("/api/snapshots/" + snap1).status_code, 200) self.check_equal(self.delete_task("/api/snapshots/" + snap1, params={"force": "1"}).json()['State'], 2) self.check_equal(self.get("/api/snapshots/" + snap1).status_code, 404) # deleting published snapshot resp = self.post_task( "/api/publish", json={ "SourceKind": "snapshot", "Distribution": "trusty", "Architectures": ["i386"], "Sources": [{"Name": snap2}], "Signing": DefaultSigningOptions, } ) self.check_equal(resp.json()['State'], 2) self.check_equal(self.delete_task("/api/snapshots/" + snap2).json()['State'], 3) self.check_equal(self.delete_task("/api/snapshots/" + snap2, params={"force": "1"}).json()['State'], 3) class SnapshotsAPITestSearch(APITest): """ POST /api/snapshots, GET /api/snapshots?sort=name, GET /api/snapshots/:name """ def check(self): repo_name = self.random_name() self.check_equal(self.post("/api/repos", json={"Name": repo_name}).status_code, 201) d = self.random_name() snapshot_name = self.random_name() self.check_equal(self.upload("/api/files/" + d, "libboost-program-options-dev_1.49.0.1_i386.deb").status_code, 200) self.check_equal(self.post_task("/api/repos/" + repo_name + "/file/" + d).json()['State'], 2) resp = self.post_task("/api/repos/" + repo_name + '/snapshots', json={'Name': snapshot_name}) self.check_equal(resp.json()['State'], 2) resp = self.get("/api/snapshots/" + snapshot_name + "/packages", params={"q": "libboost-program-options-dev", "format": "details"}) self.check_equal(resp.status_code, 200) self.check_equal(len(resp.json()), 1) self.check_equal(resp.json()[0]["Package"], "libboost-program-options-dev") resp = self.get("/api/snapshots/" + snapshot_name + "/packages") self.check_equal(resp.status_code, 200) self.check_equal(len(resp.json()), 1) self.check_equal(resp.json(), ["Pi386 libboost-program-options-dev 1.49.0.1 918d2f433384e378"]) class SnapshotsAPITestDiff(APITest): """ GET /api/snapshot/:name/diff/:name2 """ def check(self): repos = [self.random_name() for x in xrange(2)] snapshots = [self.random_name() for x in xrange(2)] for repo_name in repos: self.check_equal(self.post("/api/repos", json={"Name": repo_name}).status_code, 201) d = self.random_name() self.check_equal(self.upload("/api/files/" + d, "libboost-program-options-dev_1.49.0.1_i386.deb").status_code, 200) self.check_equal(self.post_task("/api/repos/" + repo_name + "/file/" + d).json()['State'], 2) resp = self.post_task("/api/repos/" + repo_name + '/snapshots', json={'Name': snapshots[0]}) self.check_equal(resp.json()['State'], 2) resp = self.post_task("/api/snapshots", json={'Name': snapshots[1]}) self.check_equal(resp.json()['State'], 2) resp = self.get("/api/snapshots/" + snapshots[0] + "/diff/" + snapshots[1]) self.check_equal(resp.status_code, 200) self.check_equal(resp.json(), [{'Left': 'Pi386 libboost-program-options-dev 1.49.0.1 918d2f433384e378', 'Right': None}]) resp = self.get("/api/snapshots/" + snapshots[1] + "/diff/" + snapshots[0]) self.check_equal(resp.status_code, 200) self.check_equal(resp.json(), [{'Right': 'Pi386 libboost-program-options-dev 1.49.0.1 918d2f433384e378', 'Left': None}]) resp = self.get("/api/snapshots/" + snapshots[0] + "/diff/" + snapshots[0]) self.check_equal(resp.status_code, 200) self.check_equal(resp.json(), []) resp = self.get("/api/snapshots/" + snapshots[1] + "/diff/" + snapshots[1]) self.check_equal(resp.status_code, 200) self.check_equal(resp.json(), [])
45.020761
126
0.595342
1,546
13,011
4.852523
0.078266
0.087577
0.125033
0.088776
0.808851
0.783924
0.771927
0.72594
0.682885
0.641696
0
0.035961
0.243409
13,011
288
127
45.177083
0.726128
0.073937
0
0.552632
0
0
0.209039
0.038907
0
0
0
0
0
1
0.036842
false
0
0.010526
0
0.084211
0
0
0
0
null
0
0
0
1
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
657652ec067611ea73aa46beeaa153e91e409c4d
41
py
Python
php_proxy/setup.py
jt6562/XX-Net
7b78e4820a3c78c3ba3e75b3917129d17f00e9fc
[ "BSD-2-Clause" ]
2
2016-01-16T16:48:22.000Z
2016-06-09T18:22:53.000Z
php_proxy/setup.py
TDUncle/XX-Net
24b2af60dc0abc1c26211813064bb14c1e22bac8
[ "BSD-2-Clause" ]
null
null
null
php_proxy/setup.py
TDUncle/XX-Net
24b2af60dc0abc1c26211813064bb14c1e22bac8
[ "BSD-2-Clause" ]
1
2016-04-01T06:25:17.000Z
2016-04-01T06:25:17.000Z
#!/usr/bin/env python print "setup ok!"
10.25
21
0.658537
7
41
3.857143
1
0
0
0
0
0
0
0
0
0
0
0
0.146341
41
3
22
13.666667
0.771429
0.487805
0
0
0
0
0.45
0
0
0
0
0
0
0
null
null
0
0
null
null
1
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
1
0
5
658d12fca0fed772ab73b1ce8a642d10d22cf5fa
106
py
Python
pyaltitude/team.py
sdizazzo/pyaltitude
9789a633fe8f9093308978b1de543f5adc8070c8
[ "MIT" ]
1
2020-03-17T07:45:11.000Z
2020-03-17T07:45:11.000Z
pyaltitude/team.py
sdizazzo/pyaltitude
9789a633fe8f9093308978b1de543f5adc8070c8
[ "MIT" ]
19
2020-02-14T05:56:22.000Z
2020-08-15T22:04:24.000Z
pyaltitude/team.py
sdizazzo/pyaltitude
9789a633fe8f9093308978b1de543f5adc8070c8
[ "MIT" ]
null
null
null
from . import base import logging logger = logging.getLogger(__name__) class Team(base.Base): pass
11.777778
36
0.735849
14
106
5.285714
0.714286
0
0
0
0
0
0
0
0
0
0
0
0.179245
106
8
37
13.25
0.850575
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0.2
0.4
0
0.6
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
1
0
1
0
0
5
0290b3345a0dec5d898c339ea76fb8ca968f317a
177
py
Python
src/sample/PlayerClass.py
TestowanieAutomatyczneUG/laboratorium-9-Grzeskii
ca62ee6fa6cc7514ab4d286ba908c57e12cad998
[ "MIT" ]
null
null
null
src/sample/PlayerClass.py
TestowanieAutomatyczneUG/laboratorium-9-Grzeskii
ca62ee6fa6cc7514ab4d286ba908c57e12cad998
[ "MIT" ]
null
null
null
src/sample/PlayerClass.py
TestowanieAutomatyczneUG/laboratorium-9-Grzeskii
ca62ee6fa6cc7514ab4d286ba908c57e12cad998
[ "MIT" ]
null
null
null
class Player: def getTime(self): pass def playWavFile(self, file): pass def wavWasPlayed(self): pass def resetWav(self): pass
13.615385
32
0.548023
19
177
5.105263
0.526316
0.247423
0.226804
0
0
0
0
0
0
0
0
0
0.372881
177
13
33
13.615385
0.873874
0
0
0.444444
0
0
0
0
0
0
0
0
0
1
0.444444
false
0.444444
0
0
0.555556
0
1
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
0
0
0
5
02b8f2b96a21ad353333ad782c4cf0aa7ae0011f
41
py
Python
zmqrpc/client/__init__.py
brgirgis/pyzmqrpc3
a93339f98686e7f695f7c8a19dac198e4fc56aab
[ "MIT" ]
null
null
null
zmqrpc/client/__init__.py
brgirgis/pyzmqrpc3
a93339f98686e7f695f7c8a19dac198e4fc56aab
[ "MIT" ]
null
null
null
zmqrpc/client/__init__.py
brgirgis/pyzmqrpc3
a93339f98686e7f695f7c8a19dac198e4fc56aab
[ "MIT" ]
null
null
null
from .ZmqRpcClient import ZmqRpcClient
10.25
38
0.829268
4
41
8.5
0.75
0
0
0
0
0
0
0
0
0
0
0
0.146341
41
3
39
13.666667
0.971429
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
02e61416b7a4031058b818dfd7b7d152c7f06838
11,399
py
Python
devilry/devilry_admin/tests/subject_for_period_admin/test_overview_for_periodadmin.py
devilry/devilry-django
9ae28e462dfa4cfee966ebacbca04ade9627e715
[ "BSD-3-Clause" ]
29
2015-01-18T22:56:23.000Z
2020-11-10T21:28:27.000Z
devilry/devilry_admin/tests/subject_for_period_admin/test_overview_for_periodadmin.py
devilry/devilry-django
9ae28e462dfa4cfee966ebacbca04ade9627e715
[ "BSD-3-Clause" ]
786
2015-01-06T16:10:18.000Z
2022-03-16T11:10:50.000Z
devilry/devilry_admin/tests/subject_for_period_admin/test_overview_for_periodadmin.py
devilry/devilry-django
9ae28e462dfa4cfee966ebacbca04ade9627e715
[ "BSD-3-Clause" ]
15
2015-04-06T06:18:43.000Z
2021-02-24T12:28:30.000Z
from django.conf import settings from django.test import TestCase from cradmin_legacy import cradmin_testhelpers from cradmin_legacy import crinstance from model_bakery import baker from devilry.apps.core.baker_recipes import ACTIVE_PERIOD_START, ACTIVE_PERIOD_END from devilry.devilry_admin.views.subject_for_period_admin import overview_for_periodadmin from devilry.utils import datetimeutils class TestOverview(TestCase, cradmin_testhelpers.TestCaseMixin): viewclass = overview_for_periodadmin.Overview def test_title(self): testsubject = baker.make('core.Subject', short_name='testsubject') mockresponse = self.mock_http200_getrequest_htmls(cradmin_role=testsubject) self.assertEqual('testsubject', mockresponse.selector.one('title').alltext_normalized) def test_h1(self): testsubject = baker.make('core.Subject', long_name='Test Subject') mockresponse = self.mock_http200_getrequest_htmls(cradmin_role=testsubject) self.assertEqual('Test Subject', mockresponse.selector.one('h1').alltext_normalized) def test_period_list_one_period_where_user_is_period_admin(self): testperiod = baker.make('core.Period', long_name='Test period') periodpermissiongroup = baker.make('devilry_account.PeriodPermissionGroup', period=testperiod) testuser = baker.make(settings.AUTH_USER_MODEL) baker.make('devilry_account.PermissionGroupUser', user=testuser, permissiongroup=periodpermissiongroup.permissiongroup) mockresponse = self.mock_http200_getrequest_htmls( cradmin_role=testperiod.parentnode, requestuser = testuser ) self.assertEqual('Test period', mockresponse.selector.one( '.cradmin-legacy-listbuilder-itemvalue-titledescription-title').alltext_normalized) def test_period_list_should_only_see_periods_where_user_is_period_admin(self): testperiod = baker.make('core.Period', long_name='Test period') testperiod2 = baker.make('core.Period', long_name='Test period 2', parentnode=testperiod.parentnode) testperiod3 = baker.make('core.Period', long_name='Test period 3', parentnode=testperiod.parentnode) periodpermissiongroup = baker.make('devilry_account.PeriodPermissionGroup', period=testperiod) periodpermissiongroup2 = baker.make('devilry_account.PeriodPermissionGroup', period=testperiod2) baker.make('devilry_account.PeriodPermissionGroup', period=testperiod3) testuser = baker.make(settings.AUTH_USER_MODEL) baker.make('devilry_account.PermissionGroupUser', user=testuser, permissiongroup=periodpermissiongroup.permissiongroup) baker.make('devilry_account.PermissionGroupUser', user=testuser, permissiongroup=periodpermissiongroup2.permissiongroup) mockresponse = self.mock_http200_getrequest_htmls( cradmin_role=testperiod.parentnode, requestuser=testuser ) periodlist = [x.alltext_normalized for x in mockresponse.selector.list('.cradmin-legacy-listbuilder-itemvalue-titledescription-title') ] self.assertEqual(['Test period 2', 'Test period'], periodlist) def test_periodlist_no_periods(self): testsubject = baker.make('core.Subject') mockresponse = self.mock_http200_getrequest_htmls(cradmin_role=testsubject) self.assertFalse(mockresponse.selector.exists('#devilry_admin_period_overview_periodlist')) def test_periodlist_itemrendering_name(self): testsubject = baker.make('core.Subject') testperiod = baker.make_recipe('devilry.apps.core.period_active', parentnode=testsubject, long_name='Test Period') testuser = baker.make(settings.AUTH_USER_MODEL) periodpermissiongroup = baker.make('devilry_account.PeriodPermissionGroup', period=testperiod) baker.make('devilry_account.PermissionGroupUser', user=testuser, permissiongroup=periodpermissiongroup.permissiongroup) mockresponse = self.mock_http200_getrequest_htmls(cradmin_role=testsubject, requestuser=testuser) self.assertEqual('Test Period', mockresponse.selector.one( '.cradmin-legacy-listbuilder-itemvalue-titledescription-title').alltext_normalized) def test_periodlist_itemrendering_url(self): testsubject = baker.make('core.Subject') testperiod = baker.make_recipe('devilry.apps.core.period_active', parentnode=testsubject, long_name='Test Period') testuser = baker.make(settings.AUTH_USER_MODEL) periodpermissiongroup = baker.make('devilry_account.PeriodPermissionGroup', period=testperiod) baker.make('devilry_account.PermissionGroupUser', user=testuser, permissiongroup=periodpermissiongroup.permissiongroup) mockresponse = self.mock_http200_getrequest_htmls(cradmin_role=testsubject, requestuser=testuser) self.assertEqual(crinstance.reverse_cradmin_url(instanceid='devilry_admin_periodadmin', appname='overview', roleid=testperiod.id), mockresponse.selector.one( '.devilry-admin-period-overview-perioditemframe')['href']) def test_periodlist_itemrendering_start_time(self): testsubject = baker.make('core.Subject') testperiod = baker.make_recipe('devilry.apps.core.period_active', parentnode=testsubject) testuser = baker.make(settings.AUTH_USER_MODEL) periodpermissiongroup = baker.make('devilry_account.PeriodPermissionGroup', period=testperiod) baker.make('devilry_account.PermissionGroupUser', user=testuser, permissiongroup=periodpermissiongroup.permissiongroup) with self.settings(DATETIME_FORMAT=datetimeutils.ISODATETIME_DJANGOFORMAT, USE_L10N=False): mockresponse = self.mock_http200_getrequest_htmls(cradmin_role=testsubject, requestuser=testuser) self.assertEqual(datetimeutils.isoformat_noseconds(ACTIVE_PERIOD_START), mockresponse.selector.one( '.devilry-cradmin-perioditemvalue-start-time-value').alltext_normalized) def test_periodlist_itemrendering_end_time(self): testsubject = baker.make('core.Subject') testperiod = baker.make_recipe('devilry.apps.core.period_active', parentnode=testsubject) testuser = baker.make(settings.AUTH_USER_MODEL) periodpermissiongroup = baker.make('devilry_account.PeriodPermissionGroup', period=testperiod) baker.make('devilry_account.PermissionGroupUser', user=testuser, permissiongroup=periodpermissiongroup.permissiongroup) with self.settings(DATETIME_FORMAT=datetimeutils.ISODATETIME_DJANGOFORMAT, USE_L10N=False): mockresponse = self.mock_http200_getrequest_htmls(cradmin_role=testsubject, requestuser=testuser) self.assertEqual(datetimeutils.isoformat_noseconds(ACTIVE_PERIOD_END), mockresponse.selector.one( '.devilry-cradmin-perioditemvalue-end-time-value').alltext_normalized) def test_periodlist_ordering(self): testsubject = baker.make('core.Subject') testperiod1 = baker.make_recipe('devilry.apps.core.period_active', parentnode=testsubject, long_name='Period 2') testperiod2 = baker.make_recipe('devilry.apps.core.period_old', parentnode=testsubject, long_name='Period 1') testperiod3 = baker.make_recipe('devilry.apps.core.period_future', parentnode=testsubject, long_name='Period 3') testuser = baker.make(settings.AUTH_USER_MODEL) periodpermissiongroup1 = baker.make('devilry_account.PeriodPermissionGroup', period=testperiod1) baker.make('devilry_account.PermissionGroupUser', user=testuser, permissiongroup=periodpermissiongroup1.permissiongroup) periodpermissiongroup2 = baker.make('devilry_account.PeriodPermissionGroup', period=testperiod2) baker.make('devilry_account.PermissionGroupUser', user=testuser, permissiongroup=periodpermissiongroup2.permissiongroup) periodpermissiongroup3 = baker.make('devilry_account.PeriodPermissionGroup', period=testperiod3) baker.make('devilry_account.PermissionGroupUser', user=testuser, permissiongroup=periodpermissiongroup3.permissiongroup) mockresponse = self.mock_http200_getrequest_htmls(cradmin_role=testsubject, requestuser=testuser) periodnames = [ element.alltext_normalized for element in mockresponse.selector.list( '.cradmin-legacy-listbuilder-itemvalue-titledescription-title')] self.assertEqual([ 'Period 3', 'Period 2', 'Period 1', ], periodnames) def test_periodlist_only_periods_in_subject(self): testsubject = baker.make('core.Subject') othersubject = baker.make('core.Subject') testperiod1 = baker.make_recipe('devilry.apps.core.period_active', parentnode=testsubject, long_name='Testsubject Period 1') testperiod2 = baker.make_recipe('devilry.apps.core.period_active', parentnode=othersubject, long_name='Othersubject Period 1') testuser = baker.make(settings.AUTH_USER_MODEL) periodpermissiongroup = baker.make('devilry_account.PeriodPermissionGroup', period=testperiod1) baker.make('devilry_account.PermissionGroupUser', user=testuser, permissiongroup=periodpermissiongroup.permissiongroup) periodpermissiongroup2 = baker.make('devilry_account.PeriodPermissionGroup', period=testperiod2) baker.make('devilry_account.PermissionGroupUser', user=testuser, permissiongroup=periodpermissiongroup2.permissiongroup) mockresponse = self.mock_http200_getrequest_htmls(cradmin_role=testsubject, requestuser=testuser) self.assertEqual( 1, mockresponse.selector.count('.cradmin-legacy-listbuilder-itemvalue-titledescription-title') ) self.assertEqual( 'Testsubject Period 1', mockresponse.selector.one( '.cradmin-legacy-listbuilder-itemvalue-titledescription-title').alltext_normalized )
59.994737
114
0.662602
993
11,399
7.39577
0.119839
0.068627
0.054466
0.078295
0.806509
0.792211
0.747004
0.711737
0.652914
0.645833
0
0.008969
0.256601
11,399
189
115
60.312169
0.857682
0
0
0.543353
0
0
0.192946
0.15311
0
0
0
0
0.069364
1
0.063584
false
0
0.046243
0
0.121387
0
0
0
0
null
0
0
0
1
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
02e799ea067d5e143d4c238194f6d7c648ca2644
300
py
Python
codeScanner/views.py
code-goodbuy/Goodbuy
d23363a46988f65f121a6edb75609fdddaa95cde
[ "Unlicense" ]
2
2019-03-20T20:30:16.000Z
2019-04-10T19:54:32.000Z
codeScanner/views.py
code-goodbuy/Goodbuy
d23363a46988f65f121a6edb75609fdddaa95cde
[ "Unlicense" ]
30
2019-02-22T17:24:13.000Z
2019-05-15T09:29:51.000Z
codeScanner/views.py
code-goodbuy/Goodbuy
d23363a46988f65f121a6edb75609fdddaa95cde
[ "Unlicense" ]
1
2019-04-23T08:59:34.000Z
2019-04-23T08:59:34.000Z
from django.shortcuts import render, redirect from goodbuyDatabase.models import Product, Rating from django.contrib.auth.decorators import login_required from django.contrib.auth.models import User @login_required def scanCode(request): return render(request, "codeScanner/code_scanner.html")
30
59
0.83
39
300
6.307692
0.615385
0.121951
0.138211
0.170732
0
0
0
0
0
0
0
0
0.1
300
9
60
33.333333
0.911111
0
0
0
0
0
0.096667
0.096667
0
0
0
0
0
1
0.142857
false
0
0.571429
0.142857
0.857143
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
1
1
0
0
5
f3028a9d0fb0fa54b3811f303cd66978055f0330
569
py
Python
py_tests/test_form_filters.py
tiesjan/url-shortener
395ffc7b88dfe97c88914e8c4047690185b54ea7
[ "BSD-3-Clause" ]
null
null
null
py_tests/test_form_filters.py
tiesjan/url-shortener
395ffc7b88dfe97c88914e8c4047690185b54ea7
[ "BSD-3-Clause" ]
null
null
null
py_tests/test_form_filters.py
tiesjan/url-shortener
395ffc7b88dfe97c88914e8c4047690185b54ea7
[ "BSD-3-Clause" ]
null
null
null
from url_shortener.form_filters import prepend_http, strip_value def test_prepend_http(): assert prepend_http('example.com/') == 'http://example.com/' assert prepend_http('http://example.com/') == 'http://example.com/' assert prepend_http('https://example.com/') == 'https://example.com/' assert prepend_http('') == '' assert prepend_http(None) is None def test_strip_value(): assert strip_value(' example ') == 'example' assert strip_value('example') == 'example' assert strip_value('') == '' assert strip_value(None) is None
33.470588
73
0.676626
72
569
5.111111
0.25
0.209239
0.230978
0.1875
0.706522
0.451087
0.451087
0.451087
0.244565
0
0
0
0.156415
569
16
74
35.5625
0.766667
0
0
0.166667
0
0
0.247803
0
0
0
0
0
0.75
1
0.166667
true
0
0.083333
0
0.25
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
0
1
0
0
0
0
0
0
5
f3123157a2d0eda10419f4903afb1ef9595d14b2
968
py
Python
out/python/IpfsPinningSDK/models/__init__.py
JenksyGuo/pinning-services-api-codegen
a25ba16b7fcada18953a2b097fc7c91ddb7d6baf
[ "MIT" ]
3
2021-12-15T02:07:07.000Z
2022-03-03T21:49:14.000Z
out/python/IpfsPinningSDK/models/__init__.py
JenksyGuo/pinning-services-api-codegen
a25ba16b7fcada18953a2b097fc7c91ddb7d6baf
[ "MIT" ]
null
null
null
out/python/IpfsPinningSDK/models/__init__.py
JenksyGuo/pinning-services-api-codegen
a25ba16b7fcada18953a2b097fc7c91ddb7d6baf
[ "MIT" ]
null
null
null
# flake8: noqa # import all models into this package # if you have many models here with many references from one model to another this may # raise a RecursionError # to avoid this, import only the models that you directly need like: # from from IpfsPinningSDK.model.pet import Pet # or import this package, but before doing it, use: # import sys # sys.setrecursionlimit(n) from IpfsPinningSDK.model.delegates import Delegates from IpfsPinningSDK.model.failure import Failure from IpfsPinningSDK.model.failure_error import FailureError from IpfsPinningSDK.model.origins import Origins from IpfsPinningSDK.model.pin import Pin from IpfsPinningSDK.model.pin_meta import PinMeta from IpfsPinningSDK.model.pin_results import PinResults from IpfsPinningSDK.model.pin_status import PinStatus from IpfsPinningSDK.model.status import Status from IpfsPinningSDK.model.status_info import StatusInfo from IpfsPinningSDK.model.text_matching_strategy import TextMatchingStrategy
42.086957
86
0.841942
133
968
6.075188
0.451128
0.267327
0.341584
0.128713
0
0
0
0
0
0
0
0.001167
0.114669
968
22
87
44
0.941657
0.366736
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
b827e562e451f244de961fa747c0375c45ee865e
235
py
Python
RecoTauTag/RecoTau/python/CaloTauProducer_cff.py
nistefan/cmssw
ea13af97f7f2117a4f590a5e654e06ecd9825a5b
[ "Apache-2.0" ]
3
2018-08-24T19:10:26.000Z
2019-02-19T11:45:32.000Z
RecoTauTag/RecoTau/python/CaloTauProducer_cff.py
nistefan/cmssw
ea13af97f7f2117a4f590a5e654e06ecd9825a5b
[ "Apache-2.0" ]
3
2018-08-23T13:40:24.000Z
2019-12-05T21:16:03.000Z
RecoTauTag/RecoTau/python/CaloTauProducer_cff.py
nistefan/cmssw
ea13af97f7f2117a4f590a5e654e06ecd9825a5b
[ "Apache-2.0" ]
5
2018-08-21T16:37:52.000Z
2020-01-09T13:33:17.000Z
import FWCore.ParameterSet.Config as cms from RecoTauTag.RecoTau.CaloRecoTauTagInfoProducer_cfi import * from RecoTauTag.RecoTau.CaloRecoTauProducer_cfi import * CaloTau = cms.Sequence(caloRecoTauTagInfoProducer*caloRecoTauProducer)
33.571429
70
0.87234
23
235
8.826087
0.608696
0.137931
0.206897
0
0
0
0
0
0
0
0
0
0.07234
235
6
71
39.166667
0.931193
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.75
0
0.75
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
5
b831fc7b7cc0ce90de0d5c6d6b2424336d379750
194
py
Python
DeNardi-Tornatore/app/android/Tab_Writer/app/src/main/python/main.py
LucaLand/SistemiDigitaliM20-21
e900327cc905d21caae72c42ec027f991b6ac2d9
[ "MIT" ]
9
2021-02-07T22:53:34.000Z
2022-03-14T21:47:30.000Z
DeNardi-Tornatore/app/android/Tab_Writer/app/src/main/python/main.py
LucaLand/SistemiDigitaliM20-21
e900327cc905d21caae72c42ec027f991b6ac2d9
[ "MIT" ]
1
2021-03-21T14:58:45.000Z
2021-03-21T15:01:07.000Z
DeNardi-Tornatore/app/android/Tab_Writer/app/src/main/python/main.py
LucaLand/SistemiDigitaliM20-21
e900327cc905d21caae72c42ec027f991b6ac2d9
[ "MIT" ]
18
2021-02-07T18:30:47.000Z
2022-01-22T16:57:40.000Z
from preprocessing import preprocessing_file from predict import predict_model def main(path): images, frames = preprocessing_file(path) result = predict_model(images, frames) return result
24.25
44
0.819588
25
194
6.2
0.52
0.219355
0
0
0
0
0
0
0
0
0
0
0.123711
194
8
45
24.25
0.911765
0
0
0
0
0
0
0
0
0
0
0
0
1
0.166667
false
0
0.333333
0
0.666667
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
5
b8480d33484e1e1a57331acb57822d0bf996ffda
147
py
Python
crestify/archivers/__init__.py
punto1/crestify
7353979118a0a86b2431d21090444d31215d4cbb
[ "BSD-3-Clause" ]
214
2016-02-26T11:51:32.000Z
2019-08-13T01:33:03.000Z
crestify/archivers/__init__.py
punto1/crestify
7353979118a0a86b2431d21090444d31215d4cbb
[ "BSD-3-Clause" ]
29
2017-04-10T08:15:11.000Z
2019-03-09T08:46:50.000Z
crestify/archivers/__init__.py
dhamaniasad/crestify
7ee095d7a8ccecc902edf3fd143f7051b67ef229
[ "BSD-3-Clause" ]
25
2016-03-22T15:18:29.000Z
2019-07-16T05:48:18.000Z
from archive_service import ArchiveService, ArchiveException from archiveorg import ArchiveOrgService from archivetoday import ArchiveTodayService
36.75
60
0.904762
14
147
9.428571
0.714286
0
0
0
0
0
0
0
0
0
0
0
0.088435
147
3
61
49
0.985075
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
b8b1c7f7dd5dcf0e942be56067846668c55459c3
160
py
Python
gators/encoders/tests/test_base_encoder.py
Aditya-Kapadiya/gators
d7c9967e3a8e304a601b6a92ad834d03d3e36338
[ "Apache-2.0" ]
4
2021-10-29T18:20:52.000Z
2022-03-31T22:53:03.000Z
gators/encoders/tests/test_base_encoder.py
Aditya-Kapadiya/gators
d7c9967e3a8e304a601b6a92ad834d03d3e36338
[ "Apache-2.0" ]
1
2022-01-19T12:16:19.000Z
2022-01-19T12:16:19.000Z
gators/encoders/tests/test_base_encoder.py
Aditya-Kapadiya/gators
d7c9967e3a8e304a601b6a92ad834d03d3e36338
[ "Apache-2.0" ]
5
2021-11-17T20:16:54.000Z
2022-02-21T18:21:02.000Z
# License: Apache-2.0 import pytest from gators.encoders import WOEEncoder def test_init(): with pytest.raises(TypeError): WOEEncoder(dtype=str)
16
38
0.725
21
160
5.47619
0.857143
0
0
0
0
0
0
0
0
0
0
0.015267
0.18125
160
9
39
17.777778
0.862595
0.11875
0
0
0
0
0
0
0
0
0
0
0
1
0.2
true
0
0.4
0
0.6
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
b8b8fea580ad11ca4c52211df15e76ce7b14906e
849
py
Python
test/test_billing_cycles_page_all_of.py
CiscoDevNet/python-msx-sdk
d7e0a08c656504b4f4551d263e67c671a2a04b3f
[ "MIT" ]
null
null
null
test/test_billing_cycles_page_all_of.py
CiscoDevNet/python-msx-sdk
d7e0a08c656504b4f4551d263e67c671a2a04b3f
[ "MIT" ]
null
null
null
test/test_billing_cycles_page_all_of.py
CiscoDevNet/python-msx-sdk
d7e0a08c656504b4f4551d263e67c671a2a04b3f
[ "MIT" ]
null
null
null
""" MSX SDK MSX SDK client. # noqa: E501 The version of the OpenAPI document: 1.0.9 Generated by: https://openapi-generator.tech """ import sys import unittest import python_msx_sdk from python_msx_sdk.model.billing_cycle import BillingCycle globals()['BillingCycle'] = BillingCycle from python_msx_sdk.model.billing_cycles_page_all_of import BillingCyclesPageAllOf class TestBillingCyclesPageAllOf(unittest.TestCase): """BillingCyclesPageAllOf unit test stubs""" def setUp(self): pass def tearDown(self): pass def testBillingCyclesPageAllOf(self): """Test BillingCyclesPageAllOf""" # FIXME: construct object with mandatory attributes with example values # model = BillingCyclesPageAllOf() # noqa: E501 pass if __name__ == '__main__': unittest.main()
22.342105
82
0.712603
94
849
6.234043
0.574468
0.051195
0.061433
0.054608
0.095563
0.095563
0
0
0
0
0
0.013333
0.204947
849
37
83
22.945946
0.854815
0.366313
0
0.2
1
0
0.039841
0
0
0
0
0.027027
0
1
0.2
false
0.2
0.333333
0
0.6
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
1
0
0
0
0
1
1
0
1
0
0
5
b25d688d197ea183e6f6f33beedeb735ef38a202
48,929
py
Python
hashes.py
SortAnon/PonySorter
392817c52878fff3df89b1c209b2f88ffc5cceb0
[ "MIT" ]
3
2019-11-08T01:48:44.000Z
2021-06-20T06:40:18.000Z
hashes.py
SortAnon/PonySorter
392817c52878fff3df89b1c209b2f88ffc5cceb0
[ "MIT" ]
1
2021-07-23T18:45:51.000Z
2021-07-24T00:33:52.000Z
hashes.py
SortAnon/PonySorter
392817c52878fff3df89b1c209b2f88ffc5cceb0
[ "MIT" ]
null
null
null
friendly_names = { "fim_s01e01": "Season 1, Episode 1", "fim_s01e02": "Season 1, Episode 2", "fim_s01e03": "Season 1, Episode 3", "fim_s01e04": "Season 1, Episode 4", "fim_s01e05": "Season 1, Episode 5", "fim_s01e06": "Season 1, Episode 6", "fim_s01e07": "Season 1, Episode 7", "fim_s01e08": "Season 1, Episode 8", "fim_s01e09": "Season 1, Episode 9", "fim_s01e10": "Season 1, Episode 10", "fim_s01e11": "Season 1, Episode 11", "fim_s01e12": "Season 1, Episode 12", "fim_s01e13": "Season 1, Episode 13", "fim_s01e14": "Season 1, Episode 14", "fim_s01e15": "Season 1, Episode 15", "fim_s01e16": "Season 1, Episode 16", "fim_s01e17": "Season 1, Episode 17", "fim_s01e18": "Season 1, Episode 18", "fim_s01e19": "Season 1, Episode 19", "fim_s01e20": "Season 1, Episode 20", "fim_s01e21": "Season 1, Episode 21", "fim_s01e22": "Season 1, Episode 22", "fim_s01e23": "Season 1, Episode 23", "fim_s01e24": "Season 1, Episode 24", "fim_s01e25": "Season 1, Episode 25", "fim_s01e26": "Season 1, Episode 26", "fim_s02e01": "Season 2, Episode 1", "fim_s02e02": "Season 2, Episode 2", "fim_s02e03": "Season 2, Episode 3", "fim_s02e04": "Season 2, Episode 4", "fim_s02e05": "Season 2, Episode 5", "fim_s02e06": "Season 2, Episode 6", "fim_s02e07": "Season 2, Episode 7", "fim_s02e08": "Season 2, Episode 8", "fim_s02e09": "Season 2, Episode 9", "fim_s02e10": "Season 2, Episode 10", "fim_s02e11": "Season 2, Episode 11", "fim_s02e12": "Season 2, Episode 12", "fim_s02e13": "Season 2, Episode 13", "fim_s02e14": "Season 2, Episode 14", "fim_s02e15": "Season 2, Episode 15", "fim_s02e16": "Season 2, Episode 16", "fim_s02e17": "Season 2, Episode 17", "fim_s02e18": "Season 2, Episode 18", "fim_s02e19": "Season 2, Episode 19", "fim_s02e20": "Season 2, Episode 20", "fim_s02e21": "Season 2, Episode 21", "fim_s02e22": "Season 2, Episode 22", "fim_s02e23": "Season 2, Episode 23", "fim_s02e24": "Season 2, Episode 24", "fim_s02e25": "Season 2, Episode 25", "fim_s02e26": "Season 2, Episode 26", "fim_s03e01": "Season 3, Episode 1", "fim_s03e02": "Season 3, Episode 2", "fim_s03e03": "Season 3, Episode 3", "fim_s03e04": "Season 3, Episode 4", "fim_s03e05": "Season 3, Episode 5", "fim_s03e06": "Season 3, Episode 6", "fim_s03e07": "Season 3, Episode 7", "fim_s03e08": "Season 3, Episode 8", "fim_s03e09": "Season 3, Episode 9", "fim_s03e10": "Season 3, Episode 10", "fim_s03e11": "Season 3, Episode 11", "fim_s03e12": "Season 3, Episode 12", "fim_s03e13": "Season 3, Episode 13", "fim_s04e01": "Season 4, Episode 1", "fim_s04e02": "Season 4, Episode 2", "fim_s04e03": "Season 4, Episode 3", "fim_s04e04": "Season 4, Episode 4", "fim_s04e05": "Season 4, Episode 5", "fim_s04e06": "Season 4, Episode 6", "fim_s04e07": "Season 4, Episode 7", "fim_s04e08": "Season 4, Episode 8", "fim_s04e09": "Season 4, Episode 9", "fim_s04e10": "Season 4, Episode 10", "fim_s04e11": "Season 4, Episode 11", "fim_s04e12": "Season 4, Episode 12", "fim_s04e13": "Season 4, Episode 13", "fim_s04e14": "Season 4, Episode 14", "fim_s04e15": "Season 4, Episode 15", "fim_s04e16": "Season 4, Episode 16", "fim_s04e17": "Season 4, Episode 17", "fim_s04e18": "Season 4, Episode 18", "fim_s04e19": "Season 4, Episode 19", "fim_s04e20": "Season 4, Episode 20", "fim_s04e21": "Season 4, Episode 21", "fim_s04e22": "Season 4, Episode 22", "fim_s04e23": "Season 4, Episode 23", "fim_s04e24": "Season 4, Episode 24", "fim_s04e25": "Season 4, Episode 25", "fim_s04e26": "Season 4, Episode 26", "fim_s05e01": "Season 5, Episode 1", "fim_s05e02": "Season 5, Episode 2", "fim_s05e03": "Season 5, Episode 3", "fim_s05e04": "Season 5, Episode 4", "fim_s05e05": "Season 5, Episode 5", "fim_s05e06": "Season 5, Episode 6", "fim_s05e07": "Season 5, Episode 7", "fim_s05e08": "Season 5, Episode 8", "fim_s05e09": "Season 5, Episode 9", "fim_s05e10": "Season 5, Episode 10", "fim_s05e11": "Season 5, Episode 11", "fim_s05e12": "Season 5, Episode 12", "fim_s05e13": "Season 5, Episode 13", "fim_s05e14": "Season 5, Episode 14", "fim_s05e15": "Season 5, Episode 15", "fim_s05e16": "Season 5, Episode 16", "fim_s05e17": "Season 5, Episode 17", "fim_s05e18": "Season 5, Episode 18", "fim_s05e19": "Season 5, Episode 19", "fim_s05e20": "Season 5, Episode 20", "fim_s05e21": "Season 5, Episode 21", "fim_s05e22": "Season 5, Episode 22", "fim_s05e23": "Season 5, Episode 23", "fim_s05e24": "Season 5, Episode 24", "fim_s05e25": "Season 5, Episode 25", "fim_s05e26": "Season 5, Episode 26", "fim_s06e01": "Season 6, Episode 1", "fim_s06e02": "Season 6, Episode 2", "fim_s06e03": "Season 6, Episode 3", "fim_s06e04": "Season 6, Episode 4", "fim_s06e05": "Season 6, Episode 5", "fim_s06e06": "Season 6, Episode 6", "fim_s06e07": "Season 6, Episode 7", "fim_s06e08": "Season 6, Episode 8", "fim_s06e09": "Season 6, Episode 9", "fim_s06e10": "Season 6, Episode 10", "fim_s06e11": "Season 6, Episode 11", "fim_s06e12": "Season 6, Episode 12", "fim_s06e13": "Season 6, Episode 13", "fim_s06e14": "Season 6, Episode 14", "fim_s06e15": "Season 6, Episode 15", "fim_s06e16": "Season 6, Episode 16", "fim_s06e17": "Season 6, Episode 17", "fim_s06e18": "Season 6, Episode 18", "fim_s06e19": "Season 6, Episode 19", "fim_s06e20": "Season 6, Episode 20", "fim_s06e21": "Season 6, Episode 21", "fim_s06e22": "Season 6, Episode 22", "fim_s06e23": "Season 6, Episode 23", "fim_s06e24": "Season 6, Episode 24", "fim_s06e25": "Season 6, Episode 25", "fim_s06e26": "Season 6, Episode 26", "fim_s07e01": "Season 7, Episode 1", "fim_s07e02": "Season 7, Episode 2", "fim_s07e03": "Season 7, Episode 3", "fim_s07e04": "Season 7, Episode 4", "fim_s07e05": "Season 7, Episode 5", "fim_s07e06": "Season 7, Episode 6", "fim_s07e07": "Season 7, Episode 7", "fim_s07e08": "Season 7, Episode 8", "fim_s07e09": "Season 7, Episode 9", "fim_s07e10": "Season 7, Episode 10", "fim_s07e11": "Season 7, Episode 11", "fim_s07e12": "Season 7, Episode 12", "fim_s07e13": "Season 7, Episode 13", "fim_s07e14": "Season 7, Episode 14", "fim_s07e15": "Season 7, Episode 15", "fim_s07e16": "Season 7, Episode 16", "fim_s07e17": "Season 7, Episode 17", "fim_s07e18": "Season 7, Episode 18", "fim_s07e19": "Season 7, Episode 19", "fim_s07e20": "Season 7, Episode 20", "fim_s07e21": "Season 7, Episode 21", "fim_s07e22": "Season 7, Episode 22", "fim_s07e23": "Season 7, Episode 23", "fim_s07e24": "Season 7, Episode 24", "fim_s07e25": "Season 7, Episode 25", "fim_s07e26": "Season 7, Episode 26", "fim_s08e01": "Season 8, Episode 1", "fim_s08e02": "Season 8, Episode 2", "fim_s08e03": "Season 8, Episode 3", "fim_s08e04": "Season 8, Episode 4", "fim_s08e05": "Season 8, Episode 5", "fim_s08e06": "Season 8, Episode 6", "fim_s08e07": "Season 8, Episode 7", "fim_s08e08": "Season 8, Episode 8", "fim_s08e09": "Season 8, Episode 9", "fim_s08e10": "Season 8, Episode 10", "fim_s08e11": "Season 8, Episode 11", "fim_s08e12": "Season 8, Episode 12", "fim_s08e13": "Season 8, Episode 13", "fim_s08e14": "Season 8, Episode 14", "fim_s08e15": "Season 8, Episode 15", "fim_s08e16": "Season 8, Episode 16", "fim_s08e17": "Season 8, Episode 17", "fim_s08e18": "Season 8, Episode 18", "fim_s08e19": "Season 8, Episode 19", "fim_s08e20": "Season 8, Episode 20", "fim_s08e21": "Season 8, Episode 21", "fim_s08e22": "Season 8, Episode 22", "fim_s08e23": "Season 8, Episode 23", "fim_s08e24": "Season 8, Episode 24", "fim_s08e25": "Season 8, Episode 25", "fim_s08e26": "Season 8, Episode 26", "fim_s09e01": "Season 9, Episode 1", "fim_s09e02": "Season 9, Episode 2", "fim_s09e03": "Season 9, Episode 3", "fim_s09e04": "Season 9, Episode 4", "fim_s09e05": "Season 9, Episode 5", "fim_s09e06": "Season 9, Episode 6", "fim_s09e07": "Season 9, Episode 7", "fim_s09e08": "Season 9, Episode 8", "fim_s09e09": "Season 9, Episode 9", "fim_s09e10": "Season 9, Episode 10", "fim_s09e11": "Season 9, Episode 11", "fim_s09e12": "Season 9, Episode 12", "fim_s09e13": "Season 9, Episode 13", "fim_s09e14": "Season 9, Episode 14", "fim_s09e15": "Season 9, Episode 15", "fim_s09e16": "Season 9, Episode 16", "fim_s09e17": "Season 9, Episode 17", "fim_s09e18": "Season 9, Episode 18", "fim_s09e19": "Season 9, Episode 19", "fim_s09e20": "Season 9, Episode 20", "fim_s09e21": "Season 9, Episode 21", # "fim_s09e22": "Season 9, Episode 22", # "fim_s09e23": "Season 9, Episode 23", # "fim_s09e24": "Season 9, Episode 24", # "fim_s09e25": "Season 9, Episode 25", # "fim_s09e26": "Season 9, Episode 26", "eqg_original_movie": "Equestria Girls (Original)", "eqg_friendship_games": "Equestria Girls: Friendship Games", "eqg_legend_of_everfree": "Equestria Girls: Legend of Everfree", "eqg_rainbow_rocks": "Equestria Girls: Rainbow Rocks", } original_hashes = { "fim_s01e01": "5735ea49c43ea56109171cde2547a42cecb839cc", "fim_s01e02": "8d61b132aaff821b0b93fbff5baf74a017b93942", "fim_s01e03": "6c5e832dbdc91aec2159bd517a818c6aa1057613", "fim_s01e04": "b18eb5b02993dfed9cd383e54207119ee5cb51e4", "fim_s01e05": "7d7461461e39dd807ad5ace457d762c65075e62e", "fim_s01e06": "94138a8ed565a1d39ab43cbf9244720372287d66", "fim_s01e07": "a416681e16e9d8397e9ae06ecdfd9d2386e8f8f1", "fim_s01e08": "fedfadaa3d737e59fe1617407f80157258858004", "fim_s01e09": "75c31f8555f4b6a931b41185dd9aa645a6b5d9df", "fim_s01e10": "868a4050fd56eb397b25624a6bd6efea7b05f4d1", "fim_s01e11": "d9c603f4073e796454935eb855205f424b2bc0b0", "fim_s01e12": "9aa15d4cc4d6a1596b1b964add7398149cff5d4d", "fim_s01e13": "aa94e28636d9ad224b71c544a1ad84598a4899f6", "fim_s01e14": "6ea73fc00e5626669269c207b3ee0e52f018e382", "fim_s01e15": "701f2862a9aeefca70f6d314c0589c7a8a179ccc", "fim_s01e16": "dfcb90fb26d55641b554268d1d93efaa11ad285c", "fim_s01e17": "cc867f314d68564ce48e0bcad9b57a7af80a1520", "fim_s01e18": "e54ae83f44efd7dcab1bafa88eb6f3a6bd7f6c2a", "fim_s01e19": "96ca30cedca8170dad9611da02f774980ad83737", "fim_s01e20": "f4dbd0df7214583e0848360c89a8bde432c91b6d", "fim_s01e21": "ec5b1b9036ddce7cd62c0af9fb0c96a4dd85a52a", "fim_s01e22": "89aae028e1658c083c18a99216d1a549b30bce21", "fim_s01e23": "b18d2ab28435fbafb90046328e77751b8ca8cf6f", "fim_s01e24": "2e72f04bb686ea6273ebdda7f712ae32d76d0594", "fim_s01e25": "225228dcba4fdc08601b4b48cb182a9bc5d841f8", "fim_s01e26": "69030f04a1395db8a732149d552c7f9a5f95cad7", "fim_s02e01": "b188a4b7b3d9e74fa26dcb573e29216f450d677f", "fim_s02e02": "9072ea4af815c04c86fe00884aa55acde51c8de8", "fim_s02e03": "bc9bcab5e626e649185a237485cd6c45044febac", "fim_s02e04": "0bf3465a2adb91829d8fe16d8354f4dea9a96a4f", "fim_s02e05": "4d3033f9b443ebf892db563ecc183b15ad171134", "fim_s02e06": "e80a27201a93226b99377e5f3c7d60a337bfb974", "fim_s02e07": "5fd93be8ea58d26ed2eac7aee6cab6ea6d606da8", "fim_s02e08": "0f4197de4d3e5e29bb916c68c989c42003a3cae7", "fim_s02e09": "4aec2125d344f7651a25869f6fefe2d340cf255c", "fim_s02e10": "2df0e6d01d8510db000065baa2d028240d7dae49", "fim_s02e11": "7586a9586ffd57ddacda6201abd1e919cc6a782f", "fim_s02e12": "dd027fe0d956c851f8d4b633cfc56e0b5b24f786", "fim_s02e13": "667ef565d8fd3fa82dcd54cf2b469a5e1ae85c5e", "fim_s02e14": "69d1e1a4610eba20343287f2fd5a3419b74fb6e7", "fim_s02e15": "feedd3600151fa1834f9ff73363ce8931f7b5ec6", "fim_s02e16": "d2bb3a3f5daa5553b5be15894b4e209b211ea178", "fim_s02e17": "4524d942ca3834230e9766ba1e4ad4e51681ed0c", "fim_s02e18": "6ac536af39ec9a3096296af9da5559ae4a5d8523", "fim_s02e19": "82e77f72f7b67126ae7fd85e87cccb1d6fc586ff", "fim_s02e20": "333994b8309e760d0eaeaa793b18020b5b7acd9c", "fim_s02e21": "1b085707a89006b05290cc4df7e29030b42c85d0", "fim_s02e22": "cee734596a7c3f57e7c87e8542746142745375c7", "fim_s02e23": "e698ae4ec212fbef527914f5eeb4ee6cae8060fd", "fim_s02e24": "14b3bb367891df57cbd39aa9f34309d6a1658884", "fim_s02e25": "b6e1cc5ec6bcd7c9a14e901a278c7eb940ea93e1", "fim_s02e26": "201d11c9eea301bb85f222b392f88289d1b966d9", "fim_s03e01": "4408659e47d65176add7e46137f67b1756ea0265", "fim_s03e02": "32ace5c7e56f0dc92d192ccc3c5c5eda4ff32f29", "fim_s03e03": "60422fc559b26daeb7392b9c7839c6787e1bbdf0", "fim_s03e04": "51487978bdf587624f56abeb18e98703bb738ab1", "fim_s03e05": "ebd85277ee14163e7f5ec690197e617346032bd3", "fim_s03e06": "36c4ac7e393b268ce76cf7f834a52bcdd170a22c", "fim_s03e07": "7faadb4e07ea50f9660d4d29c5ec98e5080da2e2", "fim_s03e08": "3b4001fce0ab49313f59afcecfdb3944564b3682", "fim_s03e09": "5c045b5532829d502adcc9839cd22b961f5e7342", "fim_s03e10": "8212168e108028e5e4906a4fabba10530f2550a9", "fim_s03e11": "520d1362576df396c8db428fe430b4b14260346c", "fim_s03e12": "735ca37f27f8c75a7d3bc23bd43c933a4aa073c5", "fim_s03e13": "b9c1e54800c8965a2b3a3ab73ba8e1a3b24dd58b", "fim_s04e01": "fd420d33b9f256868ee5e379eb9c8a2bc3b40b09", "fim_s04e02": "73b72f84f85ee26ee9c2728b933c86d7d370a69b", "fim_s04e03": "5bedfc8eb95c9b692daa4a806ff35e6d5c215d1b", "fim_s04e04": "4f6aa4d45802b3304f04e6a4e3a7456933878a21", "fim_s04e05": "a03e2eb3d089408e3b37d3cd258736e81ee2e2cb", "fim_s04e06": "678bd6d70839761b9a4271af8cf55e526c12e6ca", "fim_s04e07": "ca0cd431366b9d29282f1cafed3c4b1194670a89", "fim_s04e08": "81f8192af3404dc563ba9d5567e89e781201226a", "fim_s04e09": "aad68c1cb09aa95482e22cfc9fd4495445cfe1e6", "fim_s04e10": "7be7993cc1a2ea9866f0ee6350765c0973fbab48", "fim_s04e11": "a7476b04649ab027f6419d439b7d7add52342145", "fim_s04e12": "977825b271c87e55d760ef3f93663f1491c16fcb", "fim_s04e13": "3d0fc66b9f550f84d599ae26a0561888620b83a2", "fim_s04e14": "ef3e76f455176c085d74f5571fbe20e378e2db15", "fim_s04e15": "26ef4519511b99b13d112dca008f8933bb0417ef", "fim_s04e16": "09155205ae4c06db7fc224016f3c529b2d72aeeb", "fim_s04e17": "d4516745d73a6c6b06922367370d9b60c1e9c9e2", "fim_s04e18": "0166151f5eb32b945fc0a7c87a83661193dc8a7e", "fim_s04e19": "714b02bc8baf1d892cd7a40d1846e2a98e17f771", "fim_s04e20": "a541743d1e4c68fec52ba8890ffde23b53d76df1", "fim_s04e21": "92ce42d2b108fe9adf0b6be24e91d8f7772a2b97", "fim_s04e22": "e274ef133ad4b64751737407ff2d56fafd404669", "fim_s04e23": "19983b86893a51ff9a9c7dfd975724dcba07f6fd", "fim_s04e24": "477c881d8da11102e280363b61a65fb3da41eecb", "fim_s04e25": "51d3e59472d7393a46303f7f7be084929242145b", "fim_s04e26": "97444afe8ab97a9d31586eb812a2fcd239fd055a", "fim_s05e01": "5dbb872d9bff9054a28e7438558d6a1f8264ff91", "fim_s05e02": "c3f15e75538b723a08fd602faba7714bd6e6d812", "fim_s05e03": "4621407df2da79bd229df24599f5caff56b88ea1", "fim_s05e04": "f839303bc2689ec96d61910ae6c7cf5c209616c7", "fim_s05e05": "5115b64a61e0819007f6382425f397ebe48a06de", "fim_s05e06": "0eb12c6d0baa38299b6afe70450e1c4bf02001fb", "fim_s05e07": "2178552485f41cb2fc30a6e0b5e0b6ff70129ef9", "fim_s05e08": "c5240a27e9956e388ab3aaa75078db473cf4f755", "fim_s05e09": "def459ef5462a3ae16aee3d7897eeeb272f366fc", "fim_s05e10": "b9c0b00bb44280c5a882ab86d65d62c864cd4aca", "fim_s05e11": "c8b22e0bb8d1e8db700ab334b7e1af487028abd1", "fim_s05e12": "d368b0c504d66794db1c576e2665f9e0bdc26149", "fim_s05e13": "9205df05a50ccebe7ef943dd753add0c113977e4", "fim_s05e14": "1f85660cc8a5eb6f02995b9d6791a2a693c78c15", "fim_s05e15": "8a5e01c14f3506c24c62204d57e882b40e77fbad", "fim_s05e16": "935236f72c771c29f37102ef039e91d6650ccb0b", "fim_s05e17": "e0ae2f283a214a454c1f5dc2d7f5266fcf06b625", "fim_s05e18": "aec9d8082e0b5d44df44530ac925eaf06d9eb36c", "fim_s05e19": "897e301efe7314d8b9badce6a976201aeb4a85bc", "fim_s05e20": "0bf2590abedcc2273813e641e19f6a85da0e868f", "fim_s05e21": "319945de56b444a1b576158af1a85f93ee1cce47", "fim_s05e22": "958dcd5354a6a1f92b9f7f825fa621a58a4f24b3", "fim_s05e23": "5ba88f8254ef41fc344e1cc4e19696e1dda8ed4f", "fim_s05e24": "a6f4b609f03c7c3db10f139ae9777b31faa87ade", "fim_s05e25": "2a457cace44f83d75d75a97d51ef8f7610b1ee5e", "fim_s05e26": "6109d956ffa8ef0e5654101188ceac10e0e4b00a", "fim_s06e01": "2f5a0741966fd0a65f39f6a46cf7e211c4abd615", "fim_s06e02": "772a81ef3a8bc4de77e9844a222024b7c6556902", "fim_s06e03": "c1776d478795ef7c1a80163df1d2577020fd67c1", "fim_s06e04": "31df7f9e1b14fe9e2cfda4bc374d42b5f6410ee8", "fim_s06e05": "63ae25a890c4ce775dd1e468cce9ff53ce1555d6", "fim_s06e06": "01eee5ecc47f9194252b0e6a79e3eab1e7c967bf", "fim_s06e07": "fb37ddb83fd33fb21f7ec531d2ab22ee553bfcff", "fim_s06e08": "e59cf84e2bda3c737e8e493eeacd8cc03226ed62", "fim_s06e09": "af76a47b6a4cc4f70c90b5a7a01198c36f9cefe2", "fim_s06e10": "64d83601772b03136d008755ac489d7db6f8782a", "fim_s06e11": "ee4b97ba3d04e45fb95f0bdd3489d2e89082fe46", "fim_s06e12": "624eb125ab329d0cbb6753e0485b3e898ec74f2a", "fim_s06e13": "265a77bbec7ffda9c4bc984a771eac89046d3db4", "fim_s06e14": "60f7e86420539011d092374e1fb9146f8a795108", "fim_s06e15": "b8c38b7727fe2711d5b27f5fd128e4f43f1230c6", "fim_s06e16": "e4e7c18f04dcfe19e6a122edd69dd0705b05815e", "fim_s06e17": "d75ffe2da2f92f8f80671d6a2f6de5ec41909f99", "fim_s06e18": "fb7b89e4a0984b3a31387199bc1e760e5e8e34fc", "fim_s06e19": "e768fb304bc6d8de89496d20649a068c9c482419", "fim_s06e20": "50b39be291c5d541587ec717df9703430f848266", "fim_s06e21": "617546695b583ece594330c591a6e4427eaaf77a", "fim_s06e22": "303d856ed659c809aab459684e1a94d1e4df5f76", "fim_s06e23": "a32aa10d18294a43fd3d6df25a129117f3261397", "fim_s06e24": "25fce908c96c825fd88e5b300f237eb34ec267b5", "fim_s06e25": "0aa2b8bcdc0d515ce645abebf96cf50eabbb2d68", "fim_s06e26": "e28ae456662b264cb791a071d9d8c9fca1b128c6", "fim_s07e01": "c2edfa142bb6c91446a3a747c49c9f3ee2234b9d", "fim_s07e02": "de9c1ca38abce51ed605d86bc6d85daf8fbe595a", "fim_s07e03": "585e527dd175d89f58723725d5aa1d4d27949616", "fim_s07e04": "f94a53d4ca0ff914b35de88f6488d5d0e666ce3b", "fim_s07e05": "58695b0e626411828275efd146d1e2c0953cb054", "fim_s07e06": "ed0d957a8e7f5b35835c9b617159dbef72378c6d", "fim_s07e07": "e75b261b0420f2051558f5d9b7c5d427ce997cbe", "fim_s07e08": "b1a72ee905e56567e9277247aee5ae78ce0ae3af", "fim_s07e09": "59f1d24cdb1b89775ee1c08e697c534b30ee09c0", "fim_s07e10": "fd83d40fcaf077b47fc3e953fcd71a9b55a5d230", "fim_s07e11": "c9a867d1ddc812b691b50cd413aa74d854cbe69f", "fim_s07e12": "df3ab652a7c120292069664886c72a05f6c3d31e", "fim_s07e13": "637041b3645af31dd7467b566f512b491582f59e", "fim_s07e14": "58ebd77188a430a23d63d36c317d40563265448c", "fim_s07e15": "029953957f3f5f96430b9900286671c45ed5029f", "fim_s07e16": "ebd3f72254542a3ab9bd05c8e8833f5ba4961d9e", "fim_s07e17": "c85dbaec5fc5508269cc1a68d8bc2d0fd09a1c5d", "fim_s07e18": "710e6e92c6e755ef6fb833b74b8335d2c4ae1855", "fim_s07e19": "4bc91bc47cc7c1d49682cea2ca5ea0897a14792a", "fim_s07e20": "1066134a286afa3ad42da6d40d800d4d70d10bb8", "fim_s07e21": "438f7eb81b4ef8ef20376bb87a3b07a938354066", "fim_s07e22": "b14f3aabbdafd30cdd91c18b4c8fd31ff6f50e8f", "fim_s07e23": "35e529712b734da8d2e4026f1e7297c064bb5686", "fim_s07e24": "a546204cece37896e6a49df7f53850586bb395ce", "fim_s07e25": "cd3624133eeac941a5a6e26912f9416a762017ef", "fim_s07e26": "7eb71360fafe1fb1f397b3e1ec5023e1a877e575", "fim_s08e01": "076cc70aeedf3b775070a174d24899c99bba48e7", "fim_s08e02": "ef55ff3f9e8be2c295687a9c05e607ef3902b74f", "fim_s08e03": "5d389fd6b7eb480b02f1a42e97ad496349c95ce4", "fim_s08e04": "c309a04a82c5d6b3a805de4ba6fdb1f2a7463283", "fim_s08e05": "83ba497a8e0e6c3cb0e030a0cc45ca2c412f264d", "fim_s08e06": "bb1a1e6aba6414d3d54e42dba64f636b6ccca1f4", "fim_s08e07": "cd90c566bec22350c83c53aa9892b3a31ad6c69a", "fim_s08e08": "7e100b9b553136604e411863d1b01f20b731c747", "fim_s08e09": "4360eba6f9068ddda8534a034e3eaada342bac97", "fim_s08e10": "94ad320e05ce30402d8f22b014f3004d76edfa6b", "fim_s08e11": "03b9ff19482c8db8c700d547025a23b8ca0c9b74", "fim_s08e12": "304d0723742c7fc10ef5d44868daef6684a5f674", "fim_s08e13": "3531ea698101b35a0823a843725e51500b6d70f2", "fim_s08e14": "4830050ce62167e61391b6cece11057caac273e6", "fim_s08e15": "8a2fd1e83457459fe29c548df94de3461d46adfd", "fim_s08e16": "2fb4a3ecc5062a1b5e7515c1f5e87f45151ca319", "fim_s08e17": "27bc30641357df42cae1a8622a6653c29540b550", "fim_s08e18": "c5f759656652a3c4745e2c25e90dae59442f46df", "fim_s08e19": "cb8b76cfcae9ca0496df5c3e8570e927093bce79", "fim_s08e20": "362db545da4fbaabcf31db03151f106ac66fecc1", "fim_s08e21": "c397c7a2c59f905e30d8654ebcb86417bc349dfc", "fim_s08e22": "9e790fb4b4796af8e8c9a7fd4a12cd69628243ba", "fim_s08e23": "19df7e2a55ca6141ac8708d8552fca36e19b593b", "fim_s08e24": "214f2c55f0d2bd625ed32d98bfda086c90d282b8", "fim_s08e25": "ee960deb72558e988f896e6e4bee03972ac598c7", "fim_s08e26": "af21facb8c787fe81b4fc03f7de529a87f425540", "fim_s09e01": "b42a1efd4656e1a935dbdd83bd5090323ec1f3c1", "fim_s09e02": "515fb107f552dfc34b85102276336c77a9daca37", "fim_s09e03": "6a584f94467f7df36ba970c2136f824abcdc8c16", "fim_s09e04": "72b9a3dc0493b064b12500bffaea6f7cf9206f41", "fim_s09e05": "c5540523c71796cc073836e82aca115a4a1c79ba", "fim_s09e06": "847bc311062d64baf047478323cc5aae20993eb9", "fim_s09e07": "6b5a6224ba2d52df20b73e2357a5c78facb0a60f", "fim_s09e08": "2a7fa34a6ddb7e8ee2263756f4d315bc323af94e", "fim_s09e09": "c60d111f27ea50bdb886adc71a8c5f946bfce280", "fim_s09e10": "8adfc1e86af3ec220c8d379a8a397588d98e11a6", "fim_s09e11": "40fb13de7799c29f8bf6f41090a54d24d49233a4", "fim_s09e12": "8cceb7e03154c46c61c6a0691180a654a8fe268d", "fim_s09e13": "7700e2e51cb7c8e634f7cabe28f066c4b1f0f72a", "fim_s09e14": "736f62c0c276f6aa1f911517b82d294dfce4b876", "fim_s09e15": "6a1ddf8ba3c0cd2713522f7582b16a0b48828a41", "fim_s09e16": "18b5e2fa57b4f82b76f3338a5ca44e95a289659e", "fim_s09e17": "d319eedfebff339b116985eeec7db529f952c9de", "fim_s09e18": "baa11cd12bee95a5bf2719b8f7bbe1fa3fad60f5", "fim_s09e19": "1757cfd03e199649d11d566d2c74f9a52d660bc8", "fim_s09e20": "5ba76c741cae8f83fb5ade47b946ba5925224577", "fim_s09e21": "beb7a4d66acd631f2891d2491702db673f026935", "fim_s09e22": "unknown", "fim_s09e23": "unknown", "fim_s09e24": "unknown", "fim_s09e25": "unknown", "fim_s09e26": "unknown", "eqg_original_movie": "a7d91653a1e68c7c1be95cb6f20d334c66266e98", "eqg_friendship_games": "41d5a6e45d13cde4220720e843ad5285d9ab95ff", "eqg_legend_of_everfree": "0ae355e182f7ad116127dcede68c50f247db6876", "eqg_rainbow_rocks": "3e9bccff77192b5acfce95d334805027f1de83e4", } izo_hashes = { "fim_s01e01": "f6a9024c2d5f1b98ed6f65ffb9e633b731633ca1", "fim_s01e02": "837028fbc12f6998da620bd687093cb71da44300", "fim_s01e03": "46cb8d1bdf8a59dbc38a080f7c1ee69bcf6ebe50", "fim_s01e04": "01fd19c33a7cfebae29630469f2b63f00e61ab67", "fim_s01e05": "7ed175f523796df134fe4a91cd924f495e7fc6f0", "fim_s01e06": "b44630407e4ba8aeecb9c9bce3094578a5989be5", "fim_s01e07": "c606a59baf8ea44667cdc1ef32dd0a8b439aa832", "fim_s01e08": "f9ece1c16c067f935f472ca44de2b42cbd4ce72c", "fim_s01e09": "081c9ad4947c28f111c64a2d0dfa3dbb122865a5", "fim_s01e10": "77ea25d4e5d6fbed37c87ef51498465c47850809", "fim_s01e11": "55b6a431b0fdb124106dc3ec3c9b34426780c7be", "fim_s01e12": "92d010ba3ac2b8fef2971ad95fa60b3d88b2dce3", "fim_s01e13": "39c55e57ade0e1dd75ac9f1d9528ebc9eb4049c7", "fim_s01e14": "ff9c70f14c1e9e17c90e5e74f0e6c830662e6641", "fim_s01e15": "c06c7e448eee5390c203692550deaa56c7ca99fa", "fim_s01e16": "f95e0b3e36bf56ad987a338d896c41ecfb5d6ef2", "fim_s01e17": "337e1d6a9d60b516ad4c1c252a2b3b43b110cd4a", "fim_s01e18": "f6adcde8831ca4801cd455c864e47ecf001becbd", "fim_s01e19": "bc91d89bf4361306ee03fbd66161f2c09e932180", "fim_s01e20": "077ef96ebe6b62f7b8dfbad054ccf48eeaa639ad", "fim_s01e21": "e79c648baffc2889e1bcda8bb1e6180ed229bdd0", "fim_s01e22": "d05cbf7e0062b23692542cfef4cb4509e1d1bb7c", "fim_s01e23": "6a6edc7f89bb1f5d297b9163abde7b60218b2f72", "fim_s01e24": "bd7bf5fca6f75306db9d06546a8151cdc8fa2af4", "fim_s01e25": "1f323ccc45e5ed180b91636cafaec314070eeb45", "fim_s01e26": "6c9f96dac12594083cadb1c520d9e9e238127414", "fim_s02e01": "961f47fc2d8617cb513a5c6e963ab5405583b24f", "fim_s02e02": "9cf031d0f8f5fa891a73f086417e3bf9f42f9ccc", "fim_s02e03": "12685c6cf5f1fac7e9114e78f091f42ee5f52b7d", "fim_s02e04": "3c789884ec1d340e55413a813bd39dab4290ef38", "fim_s02e05": "618049dbb04f4c9325f93854e9dd5bf984a459a4", "fim_s02e06": "de634231e70c2f23316944086f2c543c97c19a9f", "fim_s02e07": "4866c807dadb346607332b25c08530931967b4e3", "fim_s02e08": "d1f1885afd3eccc191b586ff7217be732b0d17a5", "fim_s02e09": "d52d0c06cec5ffabc441f2d390ea8260b63b8d47", "fim_s02e10": "9a9845afa5a4b5b64b418294debc45221042ba4f", "fim_s02e11": "f307bf2614e1ce8e19e581a683694a7d37f318c3", "fim_s02e12": "49bc1e0b89c944a5408d7d757779f130ff533ed6", "fim_s02e13": "5e56f840d7d5fbcf4c0724f9fbf6cbf5f00e56f5", "fim_s02e14": "ac86b17bfc3d9341dab3e6282506ead5326c3c70", "fim_s02e15": "1dcb2629a203f0a4f758dfee25930fe18f228a9b", "fim_s02e16": "c17161d4f77d44be1f8c72af6a15df630253ac53", "fim_s02e17": "b08637bc0489faaf9e1e7392536a6c218fadc2ab", "fim_s02e18": "a1191dd442d88bd50037cc8000eeb30b559c53e3", "fim_s02e19": "d9de8c47d06b6a922ba058b72ebfa816f302c573", "fim_s02e20": "fb72d51dab61f932313261a9a424f432e14df024", "fim_s02e21": "319344dd49593b60b2f9188deaac64c7207a91e4", "fim_s02e22": "3dacdacb0831dbf23ea02bc3edaa923b14c0216e", "fim_s02e23": "0415b042a97b52f6d4ee68a7dab90e6032160ab0", "fim_s02e24": "a0a48b6e4609e0c089966043ccdae842cfad7401", "fim_s02e25": "9f52e54d5273baafc607bc2e6503c5b4283a202e", "fim_s02e26": "5cd79ebce7f9302b4fd581c42d8f2ebb9d4dbf11", "fim_s03e01": "ad581fa4b222d653f8f067bf073251aad5c508f5", "fim_s03e02": "26043fa9c1ffd15ce10a32975a81cd0eb024a635", "fim_s03e03": "4ccc98ae5ae3a6845973f05414ee9d5f6bd106e3", "fim_s03e04": "2d028f89db0ab5ecf72126af65a0580d72f37fd8", "fim_s03e05": "a0c2edcc17bb07d07988199d4b8699ae1311cf92", "fim_s03e06": "fd7bdcd134c4e1a1039b58943143cd42c16daf22", "fim_s03e07": "06c566eb542db2fa6591e7d0be03d0588ffc72ce", "fim_s03e08": "fae0c07f7cdd4e071648477e861cf1e16a0bb705", "fim_s03e09": "3753c33c68f01934bc189ec017317f2bcbd70dd6", "fim_s03e10": "82844bb1ebabac572a239d5c08bc50ac602cc4b5", "fim_s03e11": "7cbc0294c8fd6412cd3f60f4d9dfde5a3a4ecae1", "fim_s03e12": "ba91ccd6ecb94859e895c8f3340ff4323ea8739f", "fim_s03e13": "b2bab2e7fa9e171aefcf0996b0987b4af25f16fe", "fim_s04e01": "0b8da7a6025a14aa2a2376d2519052fe883247cf", "fim_s04e02": "16dc2f4e35644a3b6df37ca3270eafa27fbc1dab", "fim_s04e03": "0bab184d4d58e520ea7a2ef54232a3f439076f83", "fim_s04e04": "3e971bd50fd6801a69169c81c9b22d2054b9102e", "fim_s04e05": "4efdae5536326d27db57cea43c8ffb9b486b2cbf", "fim_s04e06": "edb0561371fc453e6fe2474b2401948daab43333", "fim_s04e07": "4bbf58fdd9bc3f33376a44ccf164e8b33e14449e", "fim_s04e08": "f2a5c2ab930579c52aab347e003b6b4bb72c96b6", "fim_s04e09": "7d2f532d3540cd1147c9c3427e0f9a3bd6431162", "fim_s04e10": "f1f1ca515bd1bf1d462c570921c3486ebe99e5ff", "fim_s04e11": "4964977a3956c359d8800ee0f73a65bca0713805", "fim_s04e12": "ef639444d94cb91f057be13feb7d6107011d1c63", "fim_s04e13": "df95a0c61c2eaed4ea3a22d054a14d3533b5e61c", "fim_s04e14": "308cb00a6ab8bd4458759627063b64cff9e71b2b", "fim_s04e15": "19ac49592509505adb2e9cd6bdacb5c6e4ea3fcb", "fim_s04e16": "68f5b5df443dd44f31ba98b797b799022e4b9f58", "fim_s04e17": "06351f66834b2149ce3e4207af795d01f59986d7", "fim_s04e18": "afadfb72c758af6722df942ceb117ff59e26ca83", "fim_s04e19": "c48728696083634780d169c0334ef7570ff9b24c", "fim_s04e20": "bda66b67600367b1a79368e160d94f3f8132bfc3", "fim_s04e21": "36676b142a4765e1b4503067bae814245e5f9d9b", "fim_s04e22": "de86d1413b2d0f6d218f36fa19816d087c8fffda", "fim_s04e23": "06654109453e40c0a771f3f6f931c45638836eeb", "fim_s04e24": "8f0b8efe53b924ede6174b81fc2981accb24a126", "fim_s04e25": "ef09917da342d41a82a56c8688aa8de4fdaeca02", "fim_s04e26": "be4f396dff757242c5eaab50a72e1fe5d1f53223", "fim_s05e01": "dadbddb82ef59384c14c8ff341db3eff97f24ca8", "fim_s05e02": "210dcfc2ae2f3d81ae141c0fe53df47c8a9ab59d", "fim_s05e03": "78416fd1698876844ab838e55075c7d6224c9cc4", "fim_s05e04": "f5e84b08970e3b473361617abdc1f6a0bbe17792", "fim_s05e05": "304ed96576a36cd5646f1bcbe74279cd594871b3", "fim_s05e06": "83cee832d68583db83e6066380ecd0086ca2f1b8", "fim_s05e07": "1a64148801f604cf419f4edd3f0900af1f292112", "fim_s05e08": "6ef331a7f08cd0923f2f0326bf0d4fa0c17626f0", "fim_s05e09": "f7db68bf6e74be8ae26fe7d0c069db66dc48225f", "fim_s05e10": "d8d915e674acab272a146af517629e6d45a2e5c9", "fim_s05e11": "c07f5e9b1be669b59c28ce5aa26eb67546dd074f", "fim_s05e12": "6ea0cf770a228b9537c3c14e1382dd14b50997f7", "fim_s05e13": "27609192ad83af804295d8ae98c00ab8fc22eb5f", "fim_s05e14": "38a6b06c2ab0b3fc4fd7f238f89fe8bd277d28ef", "fim_s05e15": "4688d8c2050235dd5eebf7aa0099812eb5aeca34", "fim_s05e16": "71b2c6c682e142bbd53e80adc298d6b5c6f54123", "fim_s05e17": "a9ef2e4f7bbad929bd21f98563d07adfaab6129e", "fim_s05e18": "806444a811e91498d3cbfb001811cb21d548d4a8", "fim_s05e19": "f862eb7c844ae1f6c721e3fde703488b0e022dc2", "fim_s05e20": "253dc31d2279bfb7ec24228042702ed9e8f27a9a", "fim_s05e21": "beba681c7bf7e04f5537b9dda8d26eea81ad6abc", "fim_s05e22": "4f1118498df9a8a098b945843e2d4708099da8b1", "fim_s05e23": "700b3b57686af13fe370a509f7fe49c93fd12cb6", "fim_s05e24": "eff6b8292ce12f9427a1612e1c5736fada62f071", "fim_s05e25": "e0b85c17a79cb694cfedfe41c9f269ace64354ef", "fim_s05e26": "94173ecac9fa6d993b9e321c24a21d37b5295bdf", "fim_s06e01": "f9abcbff1c6559363dc2d01b1b131b1fd7652075", "fim_s06e02": "4570cb5c8f677081856503e9473b829af9ea5279", "fim_s06e03": "6da71d196d87b5a0d71a0d6cbc8d0739e6f08df3", "fim_s06e04": "a1e365ea7e0a5eee9d3284dc59345ceab167d8a0", "fim_s06e05": "717aca95a8877a9b5b5aaa4224c8eb595efbc8f8", "fim_s06e06": "5a1422a00d41575285b653b087fd72c2880452b5", "fim_s06e07": "e73b105b48d9554661558f0296bc4c34cb33c237", "fim_s06e08": "dda06b88279e0d2bbc536526af548d48b5e4f1e4", "fim_s06e09": "289234b9563758f0ced37eac3e6ed43e9bf2dd49", "fim_s06e10": "0368cfdd86f97d4ba49076cb164452e3aa920beb", "fim_s06e11": "11ab453a3f70f147952d35e9b4158920fc112524", "fim_s06e12": "9b4182df2d0e21170e23552796bcfcd33ecad1f1", "fim_s06e13": "b93b9faf3daa40b569c7d1200175a981dcc27335", "fim_s06e14": "46d41de3ce8e1811225930d27691c4de2049de85", "fim_s06e15": "fcb2fa148c53badc896b38e3b7ca9a9697ac063b", "fim_s06e16": "f3ae9395e43b6f3690795d8ab187af799e87cf29", "fim_s06e17": "498828cb2eee52431057d8b6728eccfb372df368", "fim_s06e18": "010ae66278753eb775d49bae32acab0d1c9c6fcd", "fim_s06e19": "8b6e00372b21906b74161141745cbb8643f937d5", "fim_s06e20": "2ea96c422a1d980cbc431da6df61cbf2bbb00ecf", "fim_s06e21": "fee21ca21647b474b10c57cd95b915f9454e3e4c", "fim_s06e22": "fd05dd1eafabb6ad23294f087400415428083952", "fim_s06e23": "e6b38a84d01530fb1710417c37b14edb9ceb0318", "fim_s06e24": "1d569bd9e83b93165a321d7f1137cc4f856e2f28", "fim_s06e25": "0988ecb76b172b1e0f2ab83c8a81a2b21d90cb23", "fim_s06e26": "7b255c9d24419c79b61cb03e1aa1c51ee869a59b", "fim_s07e01": "13552a4e583122cb929c335f2aabb96868ebe8bf", "fim_s07e02": "7168f16470d158d98e77cd2f956d3c3aeed950f0", "fim_s07e03": "f9d114d4a6ba8728ab1e66e2c72c2ab49afdb425", "fim_s07e04": "a4863d754430365e8f8352f1ea281b33152f62ec", "fim_s07e05": "f7e82abd7dfb363f7cc5d88c056ff39bf88fc91a", "fim_s07e06": "6f7d7a949963cf603d94a1d2f6ea2faba40d6ec0", "fim_s07e07": "f554058057385bf47b8e44247296bdecd74245d7", "fim_s07e08": "34a440cba25b5c0d28c4a4519fd666291c4eacb5", "fim_s07e09": "0a80082dcb8261751db62316624ddb1a5413d084", "fim_s07e10": "33959c2ac2e4210fe679a9d74ed035baa32ff581", "fim_s07e11": "f262360d1b534b9893277f17065efbc006e86597", "fim_s07e12": "decde67c0c63c957c89b3cc4814ec62010e0390f", "fim_s07e13": "a1fd8783e398141ab29969c968a9ef8d926a2761", "fim_s07e14": "538abc0eb0513c9d2915b7c226d63949977c8b45", "fim_s07e15": "ce4422c88246c21768f4188843824dc48bf2da30", "fim_s07e16": "ae4ba22190cdf32599bad2d1fa67371e31fa1bc5", "fim_s07e17": "c6a47aab6a11fccb4846ddabf650a47ed3ad95d9", "fim_s07e18": "800d3ba5074eb59556ff3d2d929fe55f33662467", "fim_s07e19": "49566b3604ef3414064cc5f6e2ddb71716f3c55e", "fim_s07e20": "856e6dc2c66f4c352fdb48625eae6cf8f8e8d0bf", "fim_s07e21": "55d99812da760cd528a735887e822517e06a30f4", "fim_s07e22": "62801071748a63e688e939b306d78b51f5f8e824", "fim_s07e23": "3a70ac5a28606d4e92fb9fec484997c5c45454bc", "fim_s07e24": "c8b532184c09ecb0f9eb468b18746edb95553053", "fim_s07e25": "da047c5cf0eb2e93cd163775fe1729e64ad3b5ca", "fim_s07e26": "b69f4c32c3717abef52fbf43e0f7d95e5ce0a9ae", "fim_s08e01": "695f7365f9fbb7df059f38911ef397c2525ddd0f", "fim_s08e02": "976df812644dbbaa5905dd9e6f2b712bfb9bce5a", "fim_s08e03": "4f8f3f236ad697147aa002d545907ce6427c1ef2", "fim_s08e04": "b3faf68eaf99deec4f5ef9ea162b5ec6df0412ff", "fim_s08e05": "7bdd85dec8e09fda1ec57cf56ce5cafc75188b31", "fim_s08e06": "6a53c91e3dd22ddc069d5cf85225d3ec9a141e2e", "fim_s08e07": "5b788645db606822e99d6188cbad5a06556bcd80", "fim_s08e08": "6cbcfde1eddaef72e4f54fab85602776c3f83f1f", "fim_s08e09": "1c01cfc679b442b2f05184327ca15fa0bb54a04c", "fim_s08e10": "8d680da1acdd9c8636fb6d093e3cae5e1072916c", "fim_s08e11": "3acc0bd1c3bd9ad1924a7baad0ae52d224f1b98f", "fim_s08e12": "814e5e20a1d5cb11b2d40630d8d9f09aadf0f367", "fim_s08e13": "f153eb6197d9587f10d5ef21b2564ecce8a0869c", "fim_s08e14": "003127da6e5d687a916e8f0facb99130f34d6856", "fim_s08e15": "c1db00dfe88352f6d09e90825ccf20aedda29416", "fim_s08e16": "bd5879b90204a8e45534f8f1021aeb05085b0cfb", "fim_s08e17": "d5d073670b0053b023bf7c82ba33bc58ae064e81", "fim_s08e18": "8bac4e2877cbdb46df87f1ca61c4f78ca41cb491", "fim_s08e19": "7d7cb95831868838738a12a215b04e97ab7d15d4", "fim_s08e20": "f631a709607562db55fc15b36657ef4ecddcc039", "fim_s08e21": "9690385208ee229254b635af82a09fa2ab9828c4", "fim_s08e22": "4379434a499ec49628607955e9d711d001c2c709", "fim_s08e23": "9d1bbd5ffa936a38dd50f819ee0ffa61bb8ce9b7", "fim_s08e24": "ae1aa3fa3ad40e000d3e4ce4775d665ff9f54cda", "fim_s08e25": "d51e3fe09bfcf10efcb7e81db41075d1afd48476", "fim_s08e26": "db77fb88f9de6d48f1abd197f366d481be9b76c6", "fim_s09e01": "697b309edad2fea1ac2d21e6c1d6e17dcedcabdb", "fim_s09e02": "756036b6d4932190a97b08c3578a5fd67fce328d", "fim_s09e03": "44a1060f5bf3d587e7bf85ad0dd172fefa636a83", "fim_s09e04": "430e5a5756053b09780400e1cb4bdad0662f492b", "fim_s09e05": "5d0fdc9c8dc60bdff56aec4c031de671f639749b", "fim_s09e06": "bb38c9d23c41df9c22668da7bf535988c3f1356f", "fim_s09e07": "ca180f475678b55150b92382edd7ce1c4350467d", "fim_s09e08": "e01251baa48012eb5a75e7798ca0f7970b08bbd6", "fim_s09e09": "f7d6a40d4c4405a96fdad66917fbb1b013b3d0aa", "fim_s09e10": "5c726e521b2160c19b9010fab42103e181e60ed5", "fim_s09e11": "54c9aedfe15155519c363c10133dd6d2277ad751", "fim_s09e12": "60f163a0092527684966532789bc2d90b8ee6986", "fim_s09e13": "6008d29554185bd36deec16b72368101b791fda3", "fim_s09e14": "44b896f80f0393559ee001e05c64df30a5dda905", "fim_s09e15": "6d880d843f8adecd6ec664128c1d355c486f2753", "fim_s09e16": "682776123da12ab638f3af15a75d7915dab38b4d", "fim_s09e17": "79e62638d6628c7ba97af6f6187a864e15787a7f", "fim_s09e18": "2974b45463f9ac41b4a29f63d9b0d013e311771e", "fim_s09e19": "8989d8a96822f29839bc3330487d7586aa927d37", "fim_s09e20": "088134fe57889434089515c889e590f33afeb099", "fim_s09e21": "7d6749aeb470e71c0e8bd51e3760ae9562f6579d", "fim_s09e22": "a164e1f92185d6fb51f1b5a25196c2377498ea43", "fim_s09e23": "3094600e69bd6934e925f58cb95a2430d1839f54", "fim_s09e24": "ded8ba2b9887a14597e41ec7256d9f45b0f61abc", "fim_s09e25": "ebab1fc09dadb040388d89486aeef1b75885b0b5", "fim_s09e26": "2ba14c1d174eb33155dd3f6ebace2279ba8b4ef6", "eqg_original_movie": "edea58393759cf74326e05d0b0a821e7ff54dc03", "eqg_friendship_games": "9619ab463a28b5498490ed1e43ff83ba247ac309", "eqg_legend_of_everfree": "6b65399c961f71afd2dfa2189d493a412ee3300a", "eqg_rainbow_rocks": "b5a8d331a5e6b37931282207874b334d488d562d", } unmix_hashes = { "fim_s01e01": "104d5aaa0c37225c200ad7b83fcf63034f05522f", "fim_s01e02": "e0d7b62bb2291a3d692f3feccdeefa184e80e7c1", "fim_s01e03": "c29cb960fae5e435016e02fa107ea1bcdbc75eae", "fim_s01e04": "19a6c63c6ebf8be3e040003e8c08627df98e5a44", "fim_s01e05": "9ef84b6c65927182d21b3cc3d4b2a847e6c16c18", "fim_s01e06": "50594babaf65ec42243c4a9800ee1bfebc6bc7d8", "fim_s01e07": "eb05c17e53a166ae660d1f3da6e90b8f14b7c79a", "fim_s01e08": "41577ab4d5a133397e55c03a747d41f4658b4481", "fim_s01e09": "59a587efd4f2292c9969f0e391e54ecf9d7cb594", "fim_s01e10": "df48e4108bfb89a9e6b490b07bf04dbd1bc3494b", "fim_s01e11": "907907fdc17d15f7e65d8ca1e079095b508b18a6", "fim_s01e12": "5a8007535d7b0925f077fde57a63791b71bad523", "fim_s01e13": "d6e26ed11d68262ebd32becca6529509f97c3a58", "fim_s01e14": "a5784986a38730fc1fb430ad0f0272fd0c7d0cf4", "fim_s01e15": "7fd50b75fe4a02337c25f8ff694e390f268a9456", "fim_s01e16": "0344d2ae7ee8f2f6461798e2900ed0ad3bd0b11d", "fim_s01e17": "28b9582d04a27dd13b0557730cf0eadaaa2cd629", "fim_s01e18": "6e84cf840ba430e9527f71ef2a0dc8ce6c218875", "fim_s01e19": "4a9a544a5663a6d7ac731a9083c9cce71aefdb6b", "fim_s01e20": "fa7733b6ab981829b4466c26f185738509ec062e", "fim_s01e21": "388cc179f81c44d23aee3fcffec64b17d3c10f01", "fim_s01e22": "e46ae2a8f92e82be3172ffd7d25f491de7cd0289", "fim_s01e23": "661828a394087d716376dc0139b61137389ae5de", "fim_s01e24": "b227ac1c89f3a25dc4522118750a58e978475b9c", "fim_s01e25": "2004b2aa9015498e1f2d8454856e5883bfbb3315", "fim_s01e26": "f66ca26045de350188d476ab5b501408c551acba", "fim_s02e01": "44b3fe6e76e60b7e70ef85aed2c0b2756c69cef7", "fim_s02e02": "35fff48ca55ecb1e601b57d896330900a55cbc92", "fim_s02e03": "87e1d81dcb3cffbca12550e143cc922e6a4a68b1", "fim_s02e04": "e5463604e47ddcc6c15552e65c4a8ae75ba55730", "fim_s02e05": "33149416515e8a3f04e1db6f636afecd20e4572c", "fim_s02e06": "8516c352f688e3be76cd9db8ca709d5dd62dc5bf", "fim_s02e07": "00f060faae1f1e0b6b82361b4c0fc4ddde90fd1d", "fim_s02e08": "059f6d9b21d6e78d7ff2593f01a032f045bb3246", "fim_s02e09": "153a013f94d0272ccaee7a4197f353a0756b917e", "fim_s02e10": "13de5f5c20c11bcf6afdf01a76db934f370c5afa", "fim_s02e11": "1f1b0e38ec868d3d976444b6b28548e023fd2508", "fim_s02e12": "cc9a39c32d44632161968b5b5babd9a38bc9b385", "fim_s02e13": "00ccf5ce90f50db65a4aeec6a8b6c75f056e9e19", "fim_s02e14": "b737ccfc861470abbc6e9e1d8d4d11dae78cfe8f", "fim_s02e15": "9e03f0e03c39f797f16211b086aea4f660f72684", "fim_s02e16": "ae02167827b0a27794154534fcb16c489df6418c", "fim_s02e17": "4a002a75c00b34ca9cf932a5cf7987b7abf84292", "fim_s02e18": "8fe1a7765ddf8ab1b062ea7ddb968d1c92569876", "fim_s02e19": "c4f73cec0071d37a021d96a0c7e8e8269cfa6b21", "fim_s02e20": "a8a392cbfe39a7f478f308dde7774f5264da1bef", "fim_s02e21": "c19ce429444c7862f6de83fcee8479ede4d2de0b", "fim_s02e22": "9054930ee5a9403da56794aa30ee8a9b8bc66c54", "fim_s02e23": "96baecf46098eccca9b26a587f8e588c622a0443", "fim_s02e24": "d304f143b81026f93628bc26f3018442d6b494b4", "fim_s02e25": "258b39c68661c89a7a3f564f0827382c365ac824", "fim_s02e26": "58df95dbcd6998ace149d16479add90f670b5156", "fim_s03e01": "197d03426d4bbdebff15e7723bb95f5cffccd230", "fim_s03e02": "3623a1cb7dea3c5fd43ed5b5e77c91f83d7ced4b", "fim_s03e03": "4df72e4dc9580acf9a9c598d5fbcb36e1f1429f7", "fim_s03e04": "213ba1e62e23931e58dc4ebb5f4b2dfd735f47ca", "fim_s03e05": "564a8c54b13320aa982ff2209565ef4750564194", "fim_s03e06": "ed1b6fb5b071ab56a78492e54875b082c0c8a074", "fim_s03e07": "a37fc358a86679130e9a4ff8baf0ba55ccf28b56", "fim_s03e08": "e050d4d8d14c26c6ebb859b01a4569d871fcd2b0", "fim_s03e09": "229dbc841e643c820653af1e7f3bd14f07ef1e1b", "fim_s03e10": "50f5e34647763ab9b007c7e86d0d7be94c297845", "fim_s03e11": "df0c039168e062c9dd57e77c974e810255dceb4f", "fim_s03e12": "3bf02a42574ea2a703639adddb3614172d50a525", "fim_s03e13": "788d4bc2660f27bf51fa57c469155d4e3a4488e4", "fim_s04e01": "b538e685b444022c8fce4916da0d422d13f6e576", "fim_s04e02": "aa205fdfd60da95fc4f99fffba883c567421dab1", "fim_s04e03": "fe64dcf231ccc42722fc855a3e74ae3bbbf0e643", "fim_s04e04": "001c014fe5324332f8d00f012efb35fefa47f533", "fim_s04e05": "e8a338e557652d21b161b8026dd5768e05976027", "fim_s04e06": "321426038fc6cc0bc8ddd086a79c3946a27cd436", "fim_s04e07": "611e78559560a6b63a099fc3397ef3a8eb0db4c7", "fim_s04e08": "3a463dd8573a4eb51dabd2efb28cd099681e110e", "fim_s04e09": "de37b8d59676f5f598ea6bda080077a371fbf601", "fim_s04e10": "9f40be459463d5513ba274189548c2b0b3552d36", "fim_s04e11": "bfa1dc10e4c64bdefe2c7ebe0fc2ffb9f4f1e443", "fim_s04e12": "13adfc2233f9a005b6bf708e7abd0b93faba828b", "fim_s04e13": "3fc37f27939d951f313111a9f792715731ed059d", "fim_s04e14": "88a29e567214de2c72b8b5a11466ea8f2e2b5c96", "fim_s04e15": "2728093f445fd3a21d0ac86598cf07f9b20fc45d", "fim_s04e16": "9f720280324c0d491fc75f179d69ca4965f46821", "fim_s04e17": "77437fa49ab73a880859c76ee4b6b522e60e5b5e", "fim_s04e18": "ee79772dd96bb4cf78e53879168b52044a80f83a", "fim_s04e19": "3a93bca017d5fe1f28a1f89c10df0abc49a33e42", "fim_s04e20": "8481897fa44d02624b3a8799ceba22a1b9087060", "fim_s04e21": "74f6f18d61e52673b99ba1c1379fcad2a1125899", "fim_s04e22": "cec016654cdd2f7c73864229f54760ea20b86c8a", "fim_s04e23": "1f894ae6cf86a865988b72b3d1a5060cf2f89a86", "fim_s04e24": "c6a4fe51123ba3ce0b0716df21e9989e8b555ade", "fim_s04e25": "204666928675f6b9bff9e92ef3b2176099180e9b", "fim_s04e26": "47de6d5d70bb61fc746a47d28fc53854d2be441b", "fim_s05e01": "2cafa7cc6ca0414c294c824d63c3a433e07b2f13", "fim_s05e02": "69260d52ed666d0dc97544ed5019e1914d674c53", "fim_s05e03": "5c7db95c1f78f2e7425096b67ce534fc872e6618", "fim_s05e04": "91da34c761324628156d1db94b5a06b77a327c41", "fim_s05e05": "ee74a927b5a5419fe9e851a132fe2d814f699f10", "fim_s05e06": "84d7d6c7cce9a4cca502d9c8a24ed0be862ea702", "fim_s05e07": "2c128bf9d45e75ffddd452ac2f20abd553203641", "fim_s05e08": "2954354ce57c7fedd61d372e8fa908731e3407bb", "fim_s05e09": "317ac1df8d316d175fca6e1715bb9f97cfc1ca13", "fim_s05e10": "f977396916f65a96ca0aa40fee7345d3ce0d34a8", "fim_s05e11": "1df05e8363c41ba68f5eaa2af0c22e29998d066d", "fim_s05e12": "bc08072dc6be4e21dae03db1464ae0b83f657a7f", "fim_s05e13": "674758bd23d8ba73d14858580b60fa5062e28fe0", "fim_s05e14": "047799ab041a30d774938d0dc2672c34935371f8", "fim_s05e15": "66ec2eb2ce01dc382cc32c9c6530374e8a96a938", "fim_s05e16": "4bc308416d420583a69642bfa83c8235fb84e1e1", "fim_s05e17": "8fe15d113baf7a5e140f53729aa11a4722aaec64", "fim_s05e18": "9ff2bf125cf6a07af325cb5cbba3d17b2579c498", "fim_s05e19": "af9a63a629b1fc154e600ab058878457bdc799e1", "fim_s05e20": "ea0635bf7757e53300a07d56887e4b1857cde93c", "fim_s05e21": "3fa37e113e81c54667db87204d68958cb4dfb50f", "fim_s05e22": "b5f54f2e4736b4e1be4d537d8d0edaa219ca16c7", "fim_s05e23": "40bce23e28e12686b667c431072f925b01bdf817", "fim_s05e24": "f08b14a1e6e41dccc4315aade503ed91ce2f71b3", "fim_s05e25": "85272b7929fa219f503ca08637f04b52458b2636", "fim_s05e26": "abe7acfacc78bba55e4da71eab592383e8c2010d", "fim_s06e01": "bb554e4b036f19bfe98b0e11db71732204e71747", "fim_s06e02": "9bcd6ba7d6da353e49da88ee9702a1c9e7b58f9d", "fim_s06e03": "44f278c1c3b1642f92dae0f1dc9d1869cb5edd3e", "fim_s06e04": "a23fc5a9b0171265d4c37debd3e6888b7d5cfadd", "fim_s06e05": "717c3c0a63515266079cafe0d0076cedf3eeb2c9", "fim_s06e06": "0c7f49103a41190b115f8d4d4a4134c10d03c441", "fim_s06e07": "dc1011e5ee80a45544ee9d9c5edd6bca2e0b9b10", "fim_s06e08": "70ebfee1498e73c6e0432e279cda32efc6c611d7", "fim_s06e09": "0ecdf3735a03bb49075e94221e840815e960e736", "fim_s06e10": "eac675ef07f63907353d758cc5dccf82c75bcf9c", "fim_s06e11": "43bd3f861e85bc7e21dc4523e112d82a3193edd0", "fim_s06e12": "cee4185a9957ecbd00b6b6f374fa56715ef04fcd", "fim_s06e13": "e040a7ec92cf7139a415a5e27bff994c8604c320", "fim_s06e14": "b1f071de18a25d9ee6f70674ff3c00379ed44e09", "fim_s06e15": "75473364424e5b4dd91e918657e41b5d4e7f0b61", "fim_s06e16": "a59a451317257474359cc85e523892e94c2f393c", "fim_s06e17": "0bd07609e7209aac921e21d9f33f6a8b16172d65", "fim_s06e18": "3d16b21da67c674735b61adddb831a0e2240d3b9", "fim_s06e19": "3594101ff21359203054973ead72905fd09b5680", "fim_s06e20": "562c8a5c548deef2a915c8fdd9f3ab069e1222ae", "fim_s06e21": "38a558ff7551b56511cb9644dfe2ceb7b0c635ec", "fim_s06e22": "5735868115acbe5c18d0370592eeff689402a3b3", "fim_s06e23": "9a40a8b6b6c304d286f34d2cee80535dc46c618a", "fim_s06e24": "8987aaca1bb4395673093c28ec00023b65abf451", "fim_s06e25": "f33e490c411fe249d90be1e23b455f422bbfea7d", "fim_s06e26": "70a737ebe36d85801294b2d22a462bf41a211a77", "fim_s07e01": "unknown", "fim_s07e02": "unknown", "fim_s07e03": "unknown", "fim_s07e04": "unknown", "fim_s07e05": "unknown", "fim_s07e06": "unknown", "fim_s07e07": "unknown", "fim_s07e08": "unknown", "fim_s07e09": "unknown", "fim_s07e10": "unknown", "fim_s07e11": "unknown", "fim_s07e12": "unknown", "fim_s07e13": "unknown", "fim_s07e14": "unknown", "fim_s07e15": "unknown", "fim_s07e16": "unknown", "fim_s07e17": "unknown", "fim_s07e18": "unknown", "fim_s07e19": "unknown", "fim_s07e20": "unknown", "fim_s07e21": "unknown", "fim_s07e22": "unknown", "fim_s07e23": "unknown", "fim_s07e24": "unknown", "fim_s07e25": "unknown", "fim_s07e26": "unknown", "fim_s08e01": "unknown", "fim_s08e02": "unknown", "fim_s08e03": "unknown", "fim_s08e04": "unknown", "fim_s08e05": "unknown", "fim_s08e06": "unknown", "fim_s08e07": "unknown", "fim_s08e08": "unknown", "fim_s08e09": "unknown", "fim_s08e10": "unknown", "fim_s08e11": "unknown", "fim_s08e12": "unknown", "fim_s08e13": "unknown", "fim_s08e14": "unknown", "fim_s08e15": "unknown", "fim_s08e16": "unknown", "fim_s08e17": "unknown", "fim_s08e18": "unknown", "fim_s08e19": "unknown", "fim_s08e20": "unknown", "fim_s08e21": "unknown", "fim_s08e22": "unknown", "fim_s08e23": "unknown", "fim_s08e24": "unknown", "fim_s08e25": "unknown", "fim_s08e26": "unknown", "fim_s09e01": "unknown", "fim_s09e02": "unknown", "fim_s09e03": "unknown", "fim_s09e04": "unknown", "fim_s09e05": "unknown", "fim_s09e06": "unknown", "fim_s09e07": "unknown", "fim_s09e08": "unknown", "fim_s09e09": "unknown", "fim_s09e10": "unknown", "fim_s09e11": "unknown", "fim_s09e12": "unknown", "fim_s09e13": "unknown", "fim_s09e14": "unknown", "fim_s09e15": "unknown", "fim_s09e16": "unknown", "fim_s09e17": "unknown", "fim_s09e18": "unknown", "fim_s09e19": "unknown", "fim_s09e20": "unknown", "fim_s09e21": "unknown", "fim_s09e22": "eec65346f3f84a2200a5e5918e89d91a2a549a29", "fim_s09e23": "1426f4afd21cc478d175cc89d342d4cb42d358b7", "fim_s09e24": "14ac91b7eda5698feed15ec53084aee5cf0fb571", "fim_s09e25": "60cbea49cec1cd14c94921c0990a42df754abf51", "fim_s09e26": "9b2d98c2eb5e336a97e49b3e35bffee39238414c", "eqg_original_movie": "5ecf9491a5808e7b32accabdf7c57273ad197192", "eqg_friendship_games": "31097404640cced077169c41e7cdf925ced9f165", "eqg_legend_of_everfree": "3104471033ef47b7cd303812dfeb720bd0d63f8a", "eqg_rainbow_rocks": "ff4e528045e846f2221229a3f38bababd5c0b733", }
53.650219
73
0.76002
3,403
48,929
10.656186
0.254187
0.021234
0.010038
0.002096
0
0
0
0
0
0
0
0.442937
0.12465
48,929
911
74
53.709111
0.403736
0.003863
0
0
0
0
0.777424
0.491813
0
0
0
0
0
1
0
false
0
0
0
0
0
0
0
1
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
1
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
b27c4b8009f6699085dcc300297438d9da4027da
50
py
Python
spatial_lda/__init__.py
MagdalenaMat/spatial_lda
f40c0c8c3478b4325830109ec971709a7b395ef8
[ "MIT" ]
12
2020-07-23T18:19:07.000Z
2022-03-30T10:20:36.000Z
spatial_lda/__init__.py
MagdalenaMat/spatial_lda
f40c0c8c3478b4325830109ec971709a7b395ef8
[ "MIT" ]
12
2020-08-03T17:33:49.000Z
2021-11-04T04:55:56.000Z
spatial_lda/__init__.py
MagdalenaMat/spatial_lda
f40c0c8c3478b4325830109ec971709a7b395ef8
[ "MIT" ]
4
2020-08-16T22:49:24.000Z
2022-03-22T17:28:42.000Z
from .online_lda import LatentDirichletAllocation
25
49
0.9
5
50
8.8
1
0
0
0
0
0
0
0
0
0
0
0
0.08
50
1
50
50
0.956522
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
b27e0fa3a4232304791498103b58fecccf406856
1,552
py
Python
tests/unit/datetime_/test_datetime_.py
matthewgdv/subtypes
52caa785f2861c6a9b867ed9b6c3756f8015689b
[ "MIT" ]
1
2019-11-20T00:25:45.000Z
2019-11-20T00:25:45.000Z
tests/unit/datetime_/test_datetime_.py
matthewgdv/subtypes
52caa785f2861c6a9b867ed9b6c3756f8015689b
[ "MIT" ]
null
null
null
tests/unit/datetime_/test_datetime_.py
matthewgdv/subtypes
52caa785f2861c6a9b867ed9b6c3756f8015689b
[ "MIT" ]
null
null
null
import pytest import datetime as dt from subtypes import DateTime @pytest.fixture def example_datetime(): return DateTime(1994, 3, 24, 12, 30, 15) class TestDateTime: def test___str__(self): # synced assert True def test_shift(self, example_datetime): # synced assert example_datetime.shift(years=26, months=-2, days=-23, hours=-12, minutes=-30, seconds=-15) == DateTime(2020, 1, 1) def test_date(self): # synced assert True def test_time(self): # synced assert True def test_to_stdlib(self): # synced assert True def test_to_isoformat(self, example_datetime): # synced assert example_datetime.to_isoformat() == "1994-03-24 12:30:15" def test_to_format(self): # synced assert True def test_from_datetime(self, example_datetime): # synced assert example_datetime == DateTime.from_datetime(dt.datetime(1994, 3, 24, 12, 30, 15)) def test_from_isoformat(self): # synced assert True def test_from_format(self): # synced assert True def test_from_string(self): # synced assert True def test_from_parts(self): # synced assert True def test_infer(self): # synced assert True def test_TimeZone(self): # synced assert True def test_Hour(self): # synced assert True def test_Minute(self): # synced assert True def test_Second(self): # synced assert True def test_MicroSecond(self): # synced assert True
23.515152
129
0.646263
204
1,552
4.72549
0.254902
0.130705
0.248963
0.311203
0.634855
0.634855
0.387967
0.076763
0
0
0
0.05
0.265464
1,552
65
130
23.876923
0.795614
0.080541
0
0.348837
0
0
0.013494
0
0
0
0
0
0.418605
1
0.44186
false
0
0.069767
0.023256
0.55814
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
1
0
0
0
0
1
0
0
5
b2892e38ab258ee62a93561d4b5665b81a9258ff
96
py
Python
zcore/action/__init__.py
razaibi/autocode
765fa947d9c6a1b559fc8b7e2e40e1914455fbd4
[ "Apache-2.0" ]
null
null
null
zcore/action/__init__.py
razaibi/autocode
765fa947d9c6a1b559fc8b7e2e40e1914455fbd4
[ "Apache-2.0" ]
1
2021-09-20T22:14:03.000Z
2021-09-20T22:14:03.000Z
zcore/action/__init__.py
razaibi/zaunic
765fa947d9c6a1b559fc8b7e2e40e1914455fbd4
[ "Apache-2.0" ]
null
null
null
from . import service from . import generator_service __all__ = ['service', 'generator_service']
32
42
0.78125
11
96
6.272727
0.454545
0.289855
0
0
0
0
0
0
0
0
0
0
0.114583
96
3
42
32
0.811765
0
0
0
0
0
0.247423
0
0
0
0
0
0
1
0
false
0
0.666667
0
0.666667
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
5
b29df6facf98ea10bb030ca2a912dc7f86eae3fa
146
py
Python
apps/manax_theme_alpha/apps.py
manax-dojo/cashflow
44da3596ed40d20a5b99179c4f1e016f028cdd71
[ "BSD-3-Clause" ]
null
null
null
apps/manax_theme_alpha/apps.py
manax-dojo/cashflow
44da3596ed40d20a5b99179c4f1e016f028cdd71
[ "BSD-3-Clause" ]
null
null
null
apps/manax_theme_alpha/apps.py
manax-dojo/cashflow
44da3596ed40d20a5b99179c4f1e016f028cdd71
[ "BSD-3-Clause" ]
null
null
null
from django.apps import AppConfig class ManaxThemeAlphaConfig(AppConfig): name = 'manax_theme_alpha' verbose_name = "Manax Theme Alpha"
20.857143
39
0.767123
17
146
6.411765
0.705882
0.165138
0.256881
0.348624
0
0
0
0
0
0
0
0
0.164384
146
6
40
24.333333
0.893443
0
0
0
0
0
0.232877
0
0
0
0
0
0
1
0
false
0
0.25
0
1
0
1
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
5
b2ade9e5017e8f6be9c8c85e95a68e413cf165d8
74
py
Python
tests/test_fluprodia.py
fwitte/CoolProp.plotting
7c844692ec61e9764202f1eadd077fd4ecc43341
[ "MIT" ]
8
2020-05-06T07:50:53.000Z
2021-09-15T19:38:46.000Z
tests/test_fluprodia.py
fwitte/CoolProp.plotting
7c844692ec61e9764202f1eadd077fd4ecc43341
[ "MIT" ]
1
2020-10-30T08:24:31.000Z
2020-11-08T17:48:48.000Z
tests/test_fluprodia.py
fwitte/CoolProp.plotting
7c844692ec61e9764202f1eadd077fd4ecc43341
[ "MIT" ]
1
2020-06-19T23:11:30.000Z
2020-06-19T23:11:30.000Z
# from fluprodia import FluidPropertyDiagram def test_main(): pass
10.571429
44
0.743243
8
74
6.75
1
0
0
0
0
0
0
0
0
0
0
0
0.202703
74
6
45
12.333333
0.915254
0.567568
0
0
0
0
0
0
0
0
0
0
0
1
0.5
true
0.5
0
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
1
1
0
0
0
0
0
5
a24b17a344c09568280fc8d1561f9e7d39fc2c54
5,028
py
Python
lenstronomy/LensModel/Profiles/const_mag.py
lucateo/lenstronomy
3ab6cfd4adea2222f02d3f0f1a9cb5390c533aab
[ "MIT" ]
1
2021-06-05T15:17:39.000Z
2021-06-05T15:17:39.000Z
lenstronomy/LensModel/Profiles/const_mag.py
lucateo/lenstronomy
3ab6cfd4adea2222f02d3f0f1a9cb5390c533aab
[ "MIT" ]
null
null
null
lenstronomy/LensModel/Profiles/const_mag.py
lucateo/lenstronomy
3ab6cfd4adea2222f02d3f0f1a9cb5390c533aab
[ "MIT" ]
null
null
null
__author__ = 'gipagano' import numpy as np import lenstronomy.Util.util as util from lenstronomy.LensModel.Profiles.base_profile import LensProfileBase __all__ = ['ConstMag'] class ConstMag(LensProfileBase): """ this class implements the macromodel potential of `Diego et al. <https://www.aanda.org/articles/aa/pdf/2019/07/aa35490-19.pdf>`_ Convergence and shear are computed according to `Diego2018 <arXiv:1706.10281v2>`_ """ param_names = ['center_x', 'center_y','mu_r', 'mu_t', 'parity', 'phi_G'] lower_limit_default = {'center_x': -100, 'center_y': -100, 'mu_r':1, 'mu_t': 1000, 'parity': -1, 'phi_G':0.0} upper_limit_default = {'center_x': 100, 'center_y': 100, 'mu_r':1, 'mu_t': 1000, 'parity': 1, 'phi_G':np.pi} def function(self, x, y, mu_r, mu_t, parity, phi_G, center_x=0, center_y=0): """ :param x: x-coord (in angles) :param y: y-coord (in angles) :param mu_r: radial magnification :param mu_t: tangential magnification :param parity: parity side of the macromodel. Either +1 (positive parity) or -1 (negative parity) :param phi_G: shear orientation angle (relative to the x-axis) :return: lensing potential """ # positive parity case if (parity== 1): gamma = (1./mu_t-1./mu_r)*0.5 kappa = 1 -gamma-1./mu_r # negative parity case elif (parity== -1): gamma = (1./mu_t+1./mu_r)*0.5 kappa = 1 -gamma+1./mu_r else: raise ValueError('%f is not a valid value for the parity of the macromodel. Choose either +1 or -1.' % parity) # compute the shear along the x and y directions, rotate the vector in the opposite direction than the reference frame (compare with util.rotate) gamma1, gamma2 = gamma*np.cos(2*phi_G), -gamma*np.sin(2*phi_G) x_shift = x - center_x y_shift = y - center_y f_ = 1./2. * kappa * (x_shift*x_shift + y_shift*y_shift) + 1./2. * gamma1 * (x_shift*x_shift - y_shift*y_shift)-gamma2*x_shift*y_shift return f_ def derivatives(self, x, y, mu_r, mu_t, parity, phi_G, center_x=0, center_y=0): """ :param x: x-coord (in angles) :param y: y-coord (in angles) :param mu_r: radial magnification :param mu_t: tangential magnification :param parity: parity of the side of the macromodel. Either +1 (positive parity) or -1 (negative parity) :param phi_G: shear orientation angle (relative to the x-axis) :return: deflection angle (in angles) """ # positive parity case if (parity== 1): gamma = (1./mu_t-1./mu_r)*0.5 kappa = 1 -gamma-1./mu_r # negative parity case elif (parity== -1): gamma = (1./mu_t+1./mu_r)*0.5 kappa = 1 -gamma+1./mu_r else: raise ValueError('%f is not a valid value for the parity of the macromodel. Choose either +1 or -1.' % parity) # compute the shear along the x and y directions, rotate the vector in the opposite direction than the reference frame (compare with util.rotate) gamma1, gamma2 = gamma*np.cos(2*phi_G), -gamma*np.sin(2*phi_G) x_shift = x - center_x y_shift = y - center_y f_x = (kappa+gamma1)*x_shift - gamma2*y_shift f_y = (kappa-gamma1)*y_shift - gamma2*x_shift return f_x, f_y def hessian(self, x, y, mu_r, mu_t, parity, phi_G, center_x=0, center_y=0): """ :param x: x-coord (in angles) :param y: y-coord (in angles) :param mu_r: radial magnification :param mu_t: tangential magnification :param parity: parity of the side of the macromodel. Either +1 (positive parity) or -1 (negative parity) :param phi_G: shear orientation angle (relative to the x-axis) :return: hessian matrix (in angles) """ # positive parity case if (parity== 1): gamma = (1./mu_t-1./mu_r)*0.5 kappa = 1 -gamma-1./mu_r # negative parity case elif (parity== -1): gamma = (1./mu_t+1./mu_r)*0.5 kappa = 1 -gamma+1./mu_r else: raise ValueError('%f is not a valid value for the parity of the macromodel. Choose either +1 or -1.' % parity) # compute the shear along the x and y directions, rotate the vector in the opposite direction than the reference frame (compare with util.rotate) gamma1, gamma2 = gamma*np.cos(2*phi_G), -gamma*np.sin(2*phi_G) f_xx = kappa + gamma1 f_yy = kappa - gamma1 f_xy = -gamma2 return f_xx, f_yy, f_xy
42.252101
154
0.567025
722
5,028
3.792244
0.180055
0.02301
0.030679
0.039445
0.788532
0.777575
0.777575
0.777575
0.753835
0.753835
0
0.040588
0.323787
5,028
118
155
42.610169
0.764706
0.356603
0
0.596154
0
0.057692
0.127764
0
0
0
0
0
0
1
0.057692
false
0
0.057692
0
0.25
0
0
0
0
null
0
0
0
0
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
a28a66c0994468912f6a3f98ac6ddd3757e87fa2
217,268
py
Python
pydrs.py
lnls-elp/pydrs
7c76d596509d4293972a5c0701eae93beeee9cbe
[ "MIT" ]
null
null
null
pydrs.py
lnls-elp/pydrs
7c76d596509d4293972a5c0701eae93beeee9cbe
[ "MIT" ]
null
null
null
pydrs.py
lnls-elp/pydrs
7c76d596509d4293972a5c0701eae93beeee9cbe
[ "MIT" ]
1
2021-04-01T18:47:13.000Z
2021-04-01T18:47:13.000Z
#!/usr/bin/python # -*- coding: utf-8 -*- """ Created on 26/04/2016 Versão 1.0 @author: Ricieri (ELP) Python 3.4.4 """ """ Reviewed on 15/10/2020 Versão 1.0 rev.A - rounded printing values to 3 decimal places and displays '°C' instead of 'ºC'. @author: Marcelo (ELP) Python 3.8.6 """ """ Reviewed on 06/05/2021 Versão 1.0 rev.B - Added FAC_DCDC_EMA variables. @author: Marcelo (ELT) Python 3.9.5 """ import struct import glob import serial import time import csv import math import numpy as np import matplotlib.pyplot as plt import os from datetime import datetime ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ====================================================================== Listas de Entidades BSMP A posição da entidade na lista corresponde ao seu ID BSMP ====================================================================== ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' UDC_FIRMWARE_VERSION = "0.42 2021-05-06" ListVar = ['iLoad1','iLoad2','iMod1','iMod2','iMod3','iMod4','vLoad', 'vDCMod1','vDCMod2','vDCMod3','vDCMod4','vOutMod1','vOutMod2', 'vOutMod3','vOutMod4','temp1','temp2','temp3','temp4','ps_OnOff', 'ps_OpMode','ps_Remote','ps_OpenLoop','ps_SoftInterlocks', 'ps_HardInterlocks','iRef','wfmRef_Gain','wfmRef_Offset','sigGen_Enable','sigGen_Type', 'sigGen_Ncycles','sigGenPhaseStart','sigGen_PhaseEnd','sigGen_Freq', 'sigGen_Amplitude','sigGen_Offset','sigGen_Aux','dp_ID','dp_Class','dp_Coeffs','ps_Model', 'wfmRef_PtrBufferStart','wfmRef_PtrBufferEnd','wfmRef_PtrBufferK','wfmRef_SyncMode'] ListCurv = ['wfmRef_Curve','sigGen_SweepAmp','samplesBuffer','fullwfmRef_Curve','wfmRef_Blocks','samplesBuffer_blocks'] ListFunc = ['TurnOn','TurnOff','OpenLoop','ClosedLoop','OpMode','RemoteInterface', 'SetISlowRef','ConfigWfmRef','ConfigSigGen', 'EnableSigGen', 'DisableSigGen','ConfigDPModule','WfmRefUpdate','ResetInterlocks','ConfigPSModel', 'ConfigHRADC','ConfigHRADCOpMode','EnableHRADCSampling','DisableHRADCSampling','ResetWfmRef', 'SetRSAddress','EnableSamplesBuffer','DisableSamplesBuffer','SetISlowRefx4','SelectHRADCBoard','SelectTestSource', 'ResetHRADCBoards','Config_nHRADC','ReadHRADC_UFM','WriteHRADC_UFM','EraseHRADC_UFM','ReadHRADC_BoardData'] ListTestFunc = ['UdcIoExpanderTest', 'UdcLedTest', 'UdcBuzzerTest', 'UdcEepromTest', 'UdcFlashTest', 'UdcRamTest', 'UdcRtcTest', 'UdcSensorTempTest', 'UdcIsoPlaneTest', 'UdcAdcTest', 'UdcUartTest', 'UdcLoopBackTest', 'UdcComTest', 'UdcI2cIsoTest'] ListHRADCInputType = ['Vin_bipolar','Vin_unipolar_p','Vin_unipolar_n','Iin_bipolar','Iin_unipolar_p', 'Iin_unipolar_n','Vref_bipolar_p','Vref_bipolar_n','GND','Vref_unipolar_p', 'Vref_unipolar_n','GND_unipolar','Temp','Reserved0','Reserved1','Reserved2'] ListPSModels = ['FBP_100kHz', 'FBP_Parallel_100kHz', 'FAC_ACDC_10kHz', 'FAC_DCDC_20kHz', 'FAC_Full_ACDC_10kHz', 'FAC_Full_DCDC_20kHz', 'FAP_ACDC', 'FAP_DCDC_20kHz', 'TEST_HRPWM', 'TEST_HRADC', 'JIGA_HRADC', 'FAP_DCDC_15kHz_225A', 'FBPx4_100kHz', 'FAP_6U_DCDC_20kHz', 'JIGA_BASTIDOR'] ListPSModels_v2_1 = ['Empty','FBP','FBP_DCLink','FAC_ACDC','FAC_DCDC', 'FAC_2S_ACDC','FAC_2S_DCDC','FAC_2P4S_ACDC','FAC_2P4S_DCDC', 'FAP','FAP_4P','FAC_DCDC_EMA','FAP_2P2S','FAP_IMAS', 'FAC_2P_ACDC_IMAS','FAC_2P_DCDC_IMAS','Invalid','Invalid', 'Invalid','Invalid','Invalid','Invalid','Invalid','Invalid', 'Invalid','Invalid','Invalid','Invalid','Invalid','Invalid', 'Invalid','Uninitialized'] ListVar_v2_1 = ['ps_status','ps_setpoint','ps_reference','firmware_version', 'counter_set_slowref','counter_sync_pulse','siggen_enable', 'siggen_type','siggen_num_cycles','siggen_n','siggen_freq', 'siggen_amplitude','siggen_offset','siggen_aux_param', 'wfmref_selected','wfmref_sync_mode','wfmref_gain', 'wfmref_offset','p_wfmref_start','p_wfmref_end','p_wfmref_idx'] #ListCurv_v2_1 = ['wfmref','buf_samples_ctom','buf_samples_mtoc'] ListCurv_v2_1 = ['wfmref_data_0','wfmref_data_1','buf_samples_ctom'] ListFunc_v2_1 = ['turn_on','turn_off','open_loop','closed_loop','select_op_mode', 'reset_interlocks','set_command_interface', 'set_serial_termination','unlock_udc','lock_udc', 'cfg_source_scope','cfg_freq_scope','cfg_duration_scope', 'enable_scope','disable_scope','sync_pulse','set_slowref', 'set_slowref_fbp','set_slowref_readback_mon', 'set_slowref_fbp_readback_mon','set_slowref_readback_ref', 'set_slowref_fbp_readback_ref','reset_counters','cfg_wfmref', 'select_wfmref','get_wfmref_size','reset_wfmref','cfg_siggen', 'set_siggen','enable_siggen','disable_siggen','set_param','get_param', 'save_param_eeprom','load_param_eeprom', 'save_param_bank', 'load_param_bank','set_dsp_coeffs','get_dsp_coeff', 'save_dsp_coeffs_eeprom', 'load_dsp_coeffs_eeprom', 'save_dsp_modules_eeprom', 'load_dsp_modules_eeprom','reset_udc'] ListOpMode_v2_1 = ['Off','Interlock','Initializing','SlowRef','SlowRefSync', 'Cycle','RmpWfm','MigWfm','FastRef'] ListSigGenTypes_v2_1 = ['Sine','DampedSine','Trapezoidal','DampedSquaredSine', 'Square'] ListParameters = ['PS_Name','PS_Model','Num_PS_Modules','Command_Interface', 'RS485_Baudrate','RS485_Address','RS485_Termination', 'UDCNet_Address','Ethernet_IP','Ethernet_Subnet_Mask', 'Buzzer_Volume','Freq_ISR_Controller','Freq_TimeSlicer', 'Control_Loop_State','Max_Ref','Min_Ref','Max_Ref_OpenLoop', 'Min_Ref_OpenLoop', 'PWM_Freq','PWM_DeadTime','PWM_Max_Duty','PWM_Min_Duty', 'PWM_Max_Duty_OpenLoop','PWM_Min_Duty_OpenLoop', 'PWM_Lim_Duty_Share','HRADC_Num_Boards','HRADC_Freq_SPICLK', 'HRADC_Freq_Sampling','HRADC_Enable_Heater', 'HRADC_Enable_Monitor','HRADC_Type_Transducer', 'HRADC_Gain_Transducer','HRADC_Offset_Transducer','SigGen_Type', 'SigGen_Num_Cycles','SigGen_Freq','SigGen_Amplitude', 'SigGen_Offset','SigGen_Aux_Param','WfmRef_ID_WfmRef', 'WfmRef_SyncMode','WfmRef_Frequency','WfmRef_Gain', 'WfmRef_Offset','Analog_Var_Max','Analog_Var_Min', 'Hard_Interlocks_Debounce_Time','Hard_Interlocks_Reset_Time', 'Soft_Interlocks_Debounce_Time','Soft_Interlocks_Reset_Time', 'Scope_Sampling_Frequency','Scope_Source','','','','','','', '','','','','Password','Enable_Onboard_EEPROM'] ListBCBFunc = ['ClearPof', 'SetPof', 'ReadPof', 'EnableBuzzer', 'DisableBuzzer', 'SendUartData', 'GetUartData', 'SendCanData', 'GetCanData', 'GetI2cData'] typeFormat = {'uint8_t': 'BBHBB', 'uint16_t': 'BBHHB', 'uint32_t': 'BBHIB', 'float': 'BBHfB'} bytesFormat = {'Uint16': 'H', 'Uint32': 'L', 'Uint64': 'Q', 'float': 'f'} typeSize = {'uint8_t': 6, 'uint16_t': 7, 'uint32_t': 9, 'float': 9} num_blocks_curves_fbp = [4, 4, 4] num_blocks_curves_fax = [16, 16, 16] size_curve_block = [1024, 1024, 1024] ufmOffset = {'serial': 0, 'calibdate': 4, 'variant': 9, 'rburden': 10, 'calibtemp': 12, 'vin_gain': 14, 'vin_offset': 16, 'iin_gain': 18, 'iin_offset': 20, 'vref_p': 22, 'vref_n': 24, 'gnd': 26} hradcVariant = ['HRADC-FBP','HRADC-FAX-A','HRADC-FAX-B','HRADC-FAX-C','HRADC-FAX-D'] hradcInputTypes = ['GND', 'Vref_bipolar_p', 'Vref_bipolar_n', 'Temp', 'Vin_bipolar_p', 'Vin_bipolar_n', 'Iin_bipolar_p','Iin_bipolar_n'] NUM_MAX_COEFFS_DSP = 12 num_dsp_classes = 7 num_dsp_modules = [4, 4, 4, 6, 8, 4, 2, 2] num_coeffs_dsp_modules = [0, 1, 1, 4, 8, 16, 2] dsp_classes_names = ["DSP_Error", "DSP_SRLim", "DSP_LPF","DSP_PI", "DSP_IIR_2P2Z", "DSP_IIR_3P3Z", "DSP_VdcLink_FeedForward", "DSP_Vect_Product"] # FBP list_fbp_soft_interlocks = ['Heat-Sink Overtemperature'] list_fbp_hard_interlocks = ['Load Overcurrent', 'Load Overvoltage', 'DCLink Overvoltage', 'DCLink Undervoltage', 'DCLink Relay Fault', 'DCLink Fuse Fault', 'MOSFETs Driver Fault', 'Welded Relay Fault'] # FBP DC-Link list_fbp_dclink_hard_interlocks = ['Power_Module_1_Fault', 'Power_Module_2_Fault', 'Power_Module_3_Fault', 'Total_Output_Overvoltage', 'Power_Module_1_Overvoltage', 'Power_Module_2_Overvoltage', 'Power_Module_3_Overvoltage', 'Total_Output_Undervoltage', 'Power_Module_1_Undervoltage', 'Power_Module_2_Undervoltage', 'Power_Module_3_Undervoltage', 'Smoke_Detector','External_Interlock'] # FAC ACDC list_fac_acdc_soft_interlocks = [] list_fac_acdc_hard_interlocks = ['CapBank Overvoltage', 'Rectifier Overvoltage', 'Rectifier Undervoltage', 'Rectifier Overcurrent', 'Welded Contactor Fault', 'Opened Contactor Fault', 'IIB Input Stage Interlock', 'IIB Command Interlock'] list_fac_acdc_iib_is_interlocks = ['Rectifier Overvoltage', 'Input Overcurrent', 'IGBT Overtemperature', 'IGBT Overtemperature HW', 'Driver Overvoltage', 'Driver Overcurrent', 'Top Driver Error', 'Bottom Driver Error', 'Inductors Overtemperature', 'Heat-Sink Overtemperature', 'Board IIB Overtemperature', 'Module Overhumidity'] list_fac_acdc_iib_is_alarms = ['Rectifier Overvoltage', 'Input Overcurrent', 'IGBT Overtemperature', 'Driver Overvoltage', 'Driver Overcurrent', 'Inductors Overtemperature', 'Heat-Sink Overtemperature', 'Board IIB Overtemperature', 'Module Overhumidity'] list_fac_acdc_iib_cmd_interlocks = ['Capbank Overvoltage', 'Output Overvoltage', 'External Boards Overvoltage', 'Auxiliary Board Overcurrent', 'IDB Board Overcurrent', 'Rectifier Inductor Overtemperature', 'Rectifier Heat-Sink Overtemperature', 'AC Mains Overcurrent', 'Emergency Button', 'AC Mains Undervoltage', 'AC Mains Overvoltage', 'Ground Leakage Overcurrent', 'Board IIB Overtemperature', 'Module Overhumidity'] list_fac_acdc_iib_cmd_alarms = ['Capbank Overvoltage', 'Output Overvoltage', 'External Boards Overvoltage', 'Auxiliary Board Overcurrent', 'IDB Board Overcurrent', 'Rectifier Inductor Overtemperature', 'Rectifier Heat-Sink Overtemperature', 'Ground Leakage Overcurrent', 'Board IIB Overtemperature', 'Module Overhumidity'] # FAC DCDC list_fac_dcdc_soft_interlocks = ['DCCT 1 Fault', 'DCCT 2 Fault', 'DCCT High Difference', 'Load Feedback 1 Fault', 'Load Feedback 2 Fault'] list_fac_dcdc_hard_interlocks = ['Load Overcurrent', 'CapBank Overvoltage', 'CapBank Undervoltage', 'IIB Interlock', 'External Interlock', 'Rack Interlock'] list_fac_dcdc_iib_interlocks = ['Input Overvoltage', 'Input Overcurrent', 'Output Overcurrent', 'IGBT 1 Overtemperature', 'IGBT 1 Overtemperature HW', 'IGBT 2 Overtemperature', 'IGBT 2 Overtemperature HW', 'Driver Overvoltage', 'Driver 1 Overcurrent', 'Driver 2 Overcurrent', 'Top Driver 1 Error', 'Bottom Driver 1 Error', 'Top Driver 2 Error', 'Bottom Driver 2 Error', 'Inductors Overtemperature', 'Heat-Sink Overtemperature', 'Ground Leakage Overcurrent', 'Board IIB Overtemperature', 'Module Overhumidity'] list_fac_dcdc_iib_alarms = ['Input Overvoltage', 'Input Overcurrent', 'Output Overcurrent', 'IGBT 1 Overtemperature', 'IGBT 2 Overtemperature', 'Driver Overvoltage', 'Driver 1 Overcurrent', 'Driver 2 Overcurrent', 'Inductors Overtemperature', 'Heat-Sink Overtemperature', 'Ground Leakage Overcurrent', 'Board IIB Overtemperature', 'Module Overhumidity'] # FAC-2S AC/DC list_fac_2s_acdc_hard_interlocks = ['CapBank Overvoltage', 'Rectifier Overvoltage', 'Rectifier Undervoltage', 'Rectifier Overcurrent', 'Welded Contactor Fault', 'Opened Contactor Fault', 'IIB Input Stage Interlock', 'IIB Command Interlock'] list_fac_2s_acdc_iib_is_interlocks = list_fac_acdc_iib_is_interlocks list_fac_2s_acdc_iib_cmd_interlocks = list_fac_acdc_iib_cmd_interlocks list_fac_2s_acdc_iib_is_alarms = list_fac_acdc_iib_is_alarms list_fac_2s_acdc_iib_cmd_alarms = list_fac_acdc_iib_cmd_alarms # FAC-2S DC/DC list_fac_2s_dcdc_soft_interlocks = ['DCCT 1 Fault', 'DCCT 2 Fault', 'DCCT High Difference', 'Load Feedback 1 Fault', 'Load Feedback 2 Fault'] list_fac_2s_dcdc_hard_interlocks = ['Load Overcurrent', 'Module 1 CapBank Overvoltage', 'Module 2 CapBank Overvoltage', 'Module 1 CapBank Undervoltage', 'Module 2 CapBank Undervoltage', 'IIB Mod 1 Itlk', 'IIB Mod 2 Itlk', 'External Interlock', 'Rack Interlock'] list_fac_2s_dcdc_iib_interlocks = list_fac_dcdc_iib_interlocks list_fac_2s_dcdc_iib_alarms = list_fac_dcdc_iib_alarms # FAC-2P4S AC/DC list_fac_2p4s_acdc_hard_interlocks = ['CapBank Overvoltage', 'Rectifier Overvoltage', 'Rectifier Undervoltage', 'Rectifier Overcurrent', 'Welded Contactor Fault', 'Opened Contactor Fault', 'IIB Input Stage Interlock', 'IIB Command Interlock'] list_fac_2p4s_acdc_iib_is_interlocks = list_fac_acdc_iib_is_interlocks list_fac_2p4s_acdc_iib_cmd_interlocks = list_fac_acdc_iib_cmd_interlocks list_fac_2p4s_acdc_iib_is_alarms = list_fac_acdc_iib_is_alarms list_fac_2p4s_acdc_iib_cmd_alarms = list_fac_acdc_iib_cmd_alarms # FAC-2P4S DC/DC list_fac_2p4s_dcdc_soft_interlocks = ['DCCT 1 Fault', 'DCCT 2 Fault', 'DCCT High Difference', 'Load Feedback 1 Fault', 'Load Feedback 2 Fault', 'Arm 1 Overcurrent', 'Arm 2 Overcurrent', 'Arms High Difference', 'Complementary PS Interlock'] list_fac_2p4s_dcdc_hard_interlocks = ['Load Overcurrent', 'Module 1 CapBank Overvoltage', 'Module 2 CapBank Overvoltage', 'Module 3 CapBank Overvoltage', 'Module 4 CapBank Overvoltage', 'Module 5 CapBank Overvoltage', 'Module 6 CapBank Overvoltage', 'Module 7 CapBank Overvoltage', 'Module 8 CapBank Overvoltage', 'Module 1 CapBank Undervoltage', 'Module 2 CapBank Undervoltage', 'Module 3 CapBank Undervoltage', 'Module 4 CapBank Undervoltage', 'Module 5 CapBank Undervoltage', 'Module 6 CapBank Undervoltage', 'Module 7 CapBank Undervoltage', 'Module 8 CapBank Undervoltage', 'IIB 1 Itlk', 'IIB 2 Itlk', 'IIB 3 Itlk', 'IIB 4 Itlk', 'IIB 5 Itlk', 'IIB 6 Itlk', 'IIB 7 Itlk', 'IIB 8 Itlk'] list_fac_2p4s_dcdc_iib_interlocks = list_fac_dcdc_iib_interlocks list_fac_2p4s_dcdc_iib_alarms = list_fac_dcdc_iib_alarms # FAP list_fap_soft_interlocks = ['DCCT 1 Fault', 'DCCT 2 Fault', 'DCCT High Difference', 'Load Feedback 1 Fault', 'Load Feedback 2 Fault', 'IGBTs Current High Difference'] list_fap_hard_interlocks = ['Load Overcurrent', 'Load Overvoltage', 'DCLink Overvoltage', 'DCLink Undervoltage', 'Welded Contactor Fault', 'Opened Contactor Fault', 'IGBT 1 Overcurrent', 'IGBT 2 Overcurrent', 'IIB Itlk'] list_fap_iib_interlocks = ['Input Overvoltage', 'Output Overvoltage', 'IGBT 1 Overcurrent', 'IGBT 2 Overcurrent', 'IGBT 1 Overtemperature', 'IGBT 2 Overtemperature', 'Driver Overvoltage', 'Driver 1 Overcurrent', 'Driver 2 Overcurrent', 'Driver 1 Error', 'Driver 2 Error', 'Inductors Overtemperature', 'Heat-Sink Overtemperature', 'DCLink Contactor Fault', 'Contact Sticking of Contactor', 'External Interlock', 'Rack Interlock', 'High Leakage Current', 'Board IIB Overtemperature', 'Module Overhumidity'] list_fap_iib_alarms = ['Input Overvoltage', 'Output Overvoltage', 'IGBT 1 Overcurrent', 'IGBT 2 Overcurrent', 'IGBT 1 Overtemperature', 'IGBT 2 Overtemperature', 'Driver Overvoltage', 'Driver 1 Overcurrent', 'Driver 2 Overcurrent', 'Inductors Overtemperature', 'Heat-Sink Overtemperature', 'High Leakage Current', 'Board IIB Overtemperature', 'Module Overhumidity'] # FAP-4P list_fap_4p_soft_interlocks = ['DCCT 1 Fault', 'DCCT 2 Fault', 'DCCT High Difference', 'Load Feedback 1 Fault', 'Load Feedback 2 Fault', 'IGBTs Current High Difference'] list_fap_4p_hard_interlocks = ['Load Overcurrent', 'Load Overvoltage', 'IGBT 1 Mod 1 Overcurrent', 'IGBT 2 Mod 1 Overcurrent', 'IGBT 1 Mod 2 Overcurrent', 'IGBT 2 Mod 2 Overcurrent', 'IGBT 1 Mod 3 Overcurrent', 'IGBT 2 Mod 3 Overcurrent', 'IGBT 1 Mod 4 Overcurrent', 'IGBT 2 Mod 4 Overcurrent', 'Welded Contactor Mod 1 Fault', 'Welded Contactor Mod 2 Fault', 'Welded Contactor Mod 3 Fault', 'Welded Contactor Mod 4 Fault', 'Opened Contactor Mod 1 Fault', 'Opened Contactor Mod 2 Fault', 'Opened Contactor Mod 3 Fault', 'Opened Contactor Mod 4 Fault', 'DCLink Mod 1 Overvoltage', 'DCLink Mod 2 Overvoltage', 'DCLink Mod 3 Overvoltage', 'DCLink Mod 4 Overvoltage', 'DCLink Mod 1 Undervoltage', 'DCLink Mod 2 Undervoltage', 'DCLink Mod 3 Undervoltage', 'DCLink Mod 4 Undervoltage', 'IIB Mod 1 Itlk', 'IIB Mod 2 Itlk', 'IIB Mod 3 Itlk', 'IIB Mod 4 Itlk'] list_fap_4p_iib_interlocks = list_fap_iib_interlocks list_fap_4p_iib_alarms = list_fap_iib_alarms # FAC DCDC EMA list_fac_dcdc_ema_soft_interlocks = ['DCCT Fault', 'Load Feedback Fault'] list_fac_dcdc_ema_hard_interlocks = ['Load Overcurrent', 'DCLink Overvoltage', 'DCLink Undervoltage', 'Emergency Button', 'Load Waterflow', 'Load Overtemperature', 'IIB Itlk'] list_fac_dcdc_ema_iib_interlocks = ['Input Overvoltage', 'Input Overcurrent', 'Output Overcurrent', 'IGBT 1 Overtemperature', 'IGBT 1 Overtemperature HW', 'IGBT 2 Overtemperature', 'IGBT 2 Overtemperature HW', 'Driver Overvoltage', 'Driver 1 Overcurrent', 'Driver 2 Overcurrent', 'Top Driver 1 Error', 'Bottom Driver 1 Error', 'Top Driver 2 Error', 'Bottom Driver 2 Error', 'Inductors Overtemperature', 'Heat-Sink Overtemperature', 'Ground Leakage Overcurrent', 'Board IIB Overtemperature', 'Module Overhumidity'] list_fac_dcdc_ema_iib_alarms = ['Input Overvoltage', 'Input Overcurrent', 'Output Overcurrent', 'IGBT 1 Overtemperature', 'IGBT 2 Overtemperature', 'Driver Overvoltage', 'Driver 1 Overcurrent', 'Driver 2 Overcurrent', 'Inductors Overtemperature', 'Heat-Sink Overtemperature', 'Ground Leakage Overcurrent', 'Board IIB Overtemperature', 'Module Overhumidity'] # FAP-2P2S list_fap_2p2s_soft_interlocks = ['DCCT 1 Fault', 'DCCT 2 Fault', 'DCCT High Difference', 'Load Feedback 1 Fault', 'Load Feedback 2 Fault', 'Arms High Difference', 'IGBTs Current High Difference', 'Complementary PS Interlock'] list_fap_2p2s_hard_interlocks = ['Load Overcurrent', 'IGBT 1 Mod 1 Overcurrent', 'IGBT 2 Mod 1 Overcurrent', 'IGBT 1 Mod 2 Overcurrent', 'IGBT 2 Mod 2 Overcurrent', 'IGBT 1 Mod 3 Overcurrent', 'IGBT 2 Mod 3 Overcurrent', 'IGBT 1 Mod 4 Overcurrent', 'IGBT 2 Mod 4 Overcurrent', 'Welded Contactor Mod 1 Fault', 'Welded Contactor Mod 2 Fault', 'Welded Contactor Mod 3 Fault', 'Welded Contactor Mod 4 Fault', 'Opened Contactor Mod 1 Fault', 'Opened Contactor Mod 2 Fault', 'Opened Contactor Mod 3 Fault', 'Opened Contactor Mod 4 Fault', 'DCLink Mod 1 Overvoltage', 'DCLink Mod 2 Overvoltage', 'DCLink Mod 3 Overvoltage', 'DCLink Mod 4 Overvoltage', 'DCLink Mod 1 Undervoltage', 'DCLink Mod 2 Undervoltage', 'DCLink Mod 3 Undervoltage', 'DCLink Mod 4 Undervoltage', 'IIB Mod 1 Itlk', 'IIB Mod 2 Itlk', 'IIB Mod 3 Itlk', 'IIB Mod 4 Itlk', 'Arm 1 Overcurrent', 'Arm 2 Overcurrent'] list_fap_2p2s_iib_interlocks = list_fap_iib_interlocks list_fap_2p2s_iib_alarms = list_fap_iib_alarms # FAP 225A list_fap_225A_soft_interlocks = ['IGBTs Current High Difference'] list_fap_225A_hard_interlocks = ['Load Overcurrent', 'DCLink Contactor Fault', 'IGBT 1 Overcurrent', 'IGBT 2 Overcurrent'] # FAC-2P ACDC list_fac_2p_acdc_imas_soft_interlocks = [] list_fac_2p_acdc_imas_hard_interlocks = ['CapBank Overvoltage', 'Rectifier Overcurrent', 'AC Mains Contactor Fault', 'Module A Interlock', 'Module B Interlock', 'DCDC Interlock'] # FAC-2P DCDC list_fac_2p_dcdc_imas_soft_interlocks = [] list_fac_2p_dcdc_imas_hard_interlocks = ['Load Overcurrent', 'Module 1 CapBank_Overvoltage', 'Module 2 CapBank_Overvoltage', 'Module 1 CapBank_Undervoltage', 'Module 2 CapBank_Undervoltage', 'Arm 1 Overcurrent', 'Arm 2 Overcurrent', 'Arms High_Difference', 'ACDC Interlock'] class SerialDRS(object): ser = serial.Serial() def __init__(self): #self.ser=serial.Serial() self.MasterAdd = '\x00' self.SlaveAdd = '\x01' self.BCastAdd = '\xFF' self.ComWriteVar = '\x20' self.WriteFloatSizePayload = '\x00\x05' self.WriteDoubleSizePayload = '\x00\x03' self.ComReadVar = '\x10\x00\x01' self.ComRequestCurve = '\x40' self.ComSendWfmRef = '\x41' self.ComFunction = '\x50' self.DP_MODULE_MAX_COEFF = 16 self.ListDPClass = ['ELP_Error','ELP_SRLim','ELP_LPF','ELP_PI_dawu','ELP_IIR_2P2Z','ELP_IIR_3P3Z', 'DCL_PID','DCL_PI','DCL_DF13','DCL_DF22','DCL_23'] self.ListHardInterlocks = ['Sobrecorrente', 'Interlock Externo', 'Falha AC', 'Falha ACDC', 'Falha DCDC','Sobretensao','Falha Resistor Precarga','Falha Carga Capacitores Saída', 'Botão de Emergência', 'OUT_OVERVOLTAGE', 'IN_OVERVOLTAGE','ARM1_OVERCURRENT','ARM2_OVERCURRENT', 'IN_OVERCURRENT','DRIVER1_FAULT','DRIVER2_FAULT','OUT1_OVERCURRENT','OUT2_OVERCURRENT','OUT1_OVERVOLTAGE', 'OUT2_OVERVOLTAGE','LEAKAGE_OVERCURRENT','AC_OVERCURRENT'] self.ListSoftInterlocks = ['IGBT1_OVERTEMP','IGBT2_OVERTEMP','L1_OVERTEMP','L2_OVERTEMP','HEATSINK_OVERTEMP','WATER_OVERTEMP', 'RECTFIER1_OVERTEMP','RECTFIER2_OVERTEMP','AC_TRANSF_OVERTEMP','WATER_FLUX_FAULT','OVER_HUMIDITY_FAULT'] print("\n pyDRS - compatible UDC firmware version: " + UDC_FIRMWARE_VERSION + "\n") ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ====================================================================== Funções Internas da Classe ====================================================================== ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' # Converte float para hexadecimal def float_to_hex(self, value): hex_value = struct.pack('f', value) return hex_value.decode('ISO-8859-1') # Converte lista de float para hexadecimal def float_list_to_hex(self, value_list): hex_list = b'' for value in value_list: hex_list = hex_list + struct.pack('f', value) return hex_list.decode('ISO-8859-1') def format_list_size(self, in_list, max_size): out_list = in_list[0:max_size] if max_size > len(in_list): for i in range(max_size - len(in_list)): out_list.append(0) return out_list # Converte double para hexadecimal def double_to_hex(self,value): hex_value = struct.pack('H',value) return hex_value.decode('ISO-8859-1') # Converte unsigned int para hexadecimal def uint32_to_hex(self,value): hex_value = struct.pack('I',value) return hex_value.decode('ISO-8859-1') # Converte indice para hexadecimal def index_to_hex(self,value): hex_value = struct.pack('B',value) return hex_value.decode('ISO-8859-1') # Converte payload_size para hexadecimal def size_to_hex(self,value): hex_value = struct.pack('>H',value) return hex_value.decode('ISO-8859-1') # Função Checksum def checksum(self, packet): b=bytearray(packet.encode('ISO-8859-1')) csum =(256-sum(b))%256 hcsum = struct.pack('B',csum) send_msg = packet + hcsum.decode(encoding='ISO-8859-1') return send_msg # Função de leitura de variável def read_var(self,var_id): send_msg = self.checksum(self.SlaveAdd+self.ComReadVar+var_id) self.ser.reset_input_buffer() self.ser.write(send_msg.encode('ISO-8859-1')) def is_open(self): return self.ser.isOpen() def _convertToUint16List(self, val, format): val_16 = [] val_b = struct.pack(bytesFormat[format],val) print(val_b) for i in range(0,len(val_b),2): val_16.append(struct.unpack('H',val_b[i:i+2])[0]) print(val_16) return val_16 ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ====================================================================== Métodos de Chamada de Entidades Funções BSMP O retorno do método são os bytes de retorno da mensagem ====================================================================== ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' def TurnOn_FAx(self): payload_size = self.size_to_hex(1) #Payload: ID send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc.index('TurnOn')) send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def TurnOn(self,ps_modules): payload_size = self.size_to_hex(1+2) #Payload: ID + ps_modules hex_modules = self.double_to_hex(ps_modules) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc.index('TurnOn'))+hex_modules send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def turn_on(self): payload_size = self.size_to_hex(1) #Payload: ID send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc_v2_1.index('turn_on')) send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def TurnOff_FAx(self): payload_size = self.size_to_hex(1) #Payload: ID send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc.index('TurnOff')) send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def TurnOff(self,ps_modules): payload_size = self.size_to_hex(1+2) #Payload: ID + ps_modules hex_modules = self.double_to_hex(ps_modules) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc.index('TurnOff'))+hex_modules send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def turn_off(self): payload_size = self.size_to_hex(1) #Payload: ID send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc_v2_1.index('turn_off')) send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def open_loop(self): payload_size = self.size_to_hex(1) #Payload: ID send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc_v2_1.index('open_loop')) send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def closed_loop(self): payload_size = self.size_to_hex(1) #Payload: ID send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc_v2_1.index('closed_loop')) send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def OpenLoop(self,ps_modules): payload_size = self.size_to_hex(1+2) #Payload: ID + ps_modules hex_modules = self.double_to_hex(ps_modules) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc.index('OpenLoop'))+hex_modules send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def ClosedLoop(self,ps_modules): payload_size = self.size_to_hex(1+2) #Payload: ID + ps_modules hex_modules = self.double_to_hex(ps_modules) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc.index('ClosedLoop'))+hex_modules send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def OpenLoop_FAx(self): payload_size = self.size_to_hex(1) #Payload: ID send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc.index('OpenLoop')) send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def ClosedLoop_FAx(self): payload_size = self.size_to_hex(1) #Payload: ID send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc.index('ClosedLoop')) send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def OpMode(self,op_mode): payload_size = self.size_to_hex(1+2) #Payload: ID + ps_opmode hex_opmode = self.double_to_hex(op_mode) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc.index('OpMode'))+hex_opmode send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def RemoteInterface(self): payload_size = self.size_to_hex(1) #Payload: ID send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc.index('RemoteInterface')) send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def SetISlowRef(self,setpoint): payload_size = self.size_to_hex(1+4) #Payload: ID + iSlowRef hex_setpoint = self.float_to_hex(setpoint) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc.index('SetISlowRef'))+hex_setpoint send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def ConfigWfmRef(self,gain,offset): payload_size = self.size_to_hex(1+4+4) #Payload: ID + gain + offset hex_gain = self.float_to_hex(gain) hex_offset = self.float_to_hex(offset) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc.index('ConfigWfmRef'))+hex_gain+hex_offset send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def ConfigSigGen(self,sigType,nCycles,phaseStart,phaseEnd): payload_size = self.size_to_hex(1+2+2+4+4) #Payload: ID + type + nCycles + phaseStart + phaseEnd hex_sigType = self.double_to_hex(sigType) hex_nCycles = self.double_to_hex(nCycles) hex_phaseStart = self.float_to_hex(phaseStart) hex_phaseEnd = self.float_to_hex(phaseEnd) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc.index('ConfigSigGen'))+hex_sigType+hex_nCycles+hex_phaseStart+hex_phaseEnd send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def EnableSigGen(self): payload_size = self.size_to_hex(1) #Payload: ID send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc.index('EnableSigGen')) send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def DisableSigGen(self): payload_size = self.size_to_hex(1) #Payload: ID send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc.index('DisableSigGen')) send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def ConfigDPModule(self): payload_size = self.size_to_hex(1) #Payload: ID send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc.index('ConfigDPModule')) send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def ConfigDPModuleFull(self,dp_id,dp_class,dp_coeffs): self.Write_dp_ID(dp_id) self.Write_dp_Class(dp_class) self.Write_dp_Coeffs(dp_coeffs) self.ConfigDPModule() def WfmRefUpdate(self): payload_size = self.size_to_hex(1) #Payload: ID send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc.index('WfmRefUpdate')) send_msg = self.checksum(self.BCastAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) def ResetInterlocks(self): payload_size = self.size_to_hex(1) #Payload: ID send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc.index('ResetInterlocks')) send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def reset_interlocks(self): payload_size = self.size_to_hex(1) #Payload: ID send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc_v2_1.index('reset_interlocks')) send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def ConfigPSModel(self,ps_model): payload_size = self.size_to_hex(1+2) #Payload: ID + ps_Model hex_model = self.double_to_hex(ps_model) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc.index('ConfigPSModel'))+hex_model send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def ConfigHRADC(self,hradcID,freqSampling,inputType,enableHeater,enableMonitor): payload_size = self.size_to_hex(1+2+4+2+2+2) #Payload: ID + hradcID + freqSampling + inputType + enableHeater + enableMonitor hex_hradcID = self.double_to_hex(hradcID) hex_freq = self.float_to_hex(freqSampling) hex_type = self.double_to_hex(ListHRADCInputType.index(inputType)) hex_enHeater = self.double_to_hex(enableHeater) hex_enMonitor = self.double_to_hex(enableMonitor) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc.index('ConfigHRADC'))+hex_hradcID+hex_freq+hex_type+hex_enHeater+hex_enMonitor send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def ConfigHRADCOpMode(self,hradcID,opMode): payload_size = self.size_to_hex(1+2+2) #Payload: ID + hradcID + opMode hex_hradcID = self.double_to_hex(hradcID) hex_opMode = self.double_to_hex(opMode) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc.index('ConfigHRADCOpMode'))+hex_hradcID+hex_opMode send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def EnableHRADCSampling(self): payload_size = self.size_to_hex(1) #Payload: ID send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc.index('EnableHRADCSampling')) send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def DisableHRADCSampling(self): payload_size = self.size_to_hex(1) #Payload: ID send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc.index('DisableHRADCSampling')) send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def ResetWfmRef(self): payload_size = self.size_to_hex(1) #Payload: ID send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc.index('ResetWfmRef')) send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def SetRSAddress(self,rs_address): payload_size = self.size_to_hex(1+2) #Payload: ID + rs_address hex_add = self.double_to_hex(rs_address) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc.index('SetRSAddress'))+hex_add send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def EnableSamplesBuffer(self): payload_size = self.size_to_hex(1) #Payload: ID send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc.index('EnableSamplesBuffer')) send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def DisableSamplesBuffer(self): payload_size = self.size_to_hex(1) #Payload: ID send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc.index('DisableSamplesBuffer')) send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def SelectHRADCBoard(self,hradcID): payload_size = self.size_to_hex(1+2) #Payload: ID hex_hradcID = self.double_to_hex(hradcID) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc.index('SelectHRADCBoard'))+hex_hradcID send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def SelectTestSource(self,inputType): payload_size = self.size_to_hex(1+2) #Payload: inputType hex_type = self.double_to_hex(ListHRADCInputType.index(inputType)) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc.index('SelectTestSource'))+hex_type send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def ResetHRADCBoards(self, enable): payload_size = self.size_to_hex(1+2) #Payload: ID+enable(2) hex_enable = self.double_to_hex(enable) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc.index('ResetHRADCBoards'))+hex_enable send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def Config_nHRADC(self,nHRADC): payload_size = self.size_to_hex(1+2) #Payload: nHRADC hex_nhradc = self.double_to_hex(nHRADC) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc.index('Config_nHRADC'))+hex_nhradc send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def ReadHRADC_UFM(self,hradcID,ufmadd): payload_size = self.size_to_hex(1+2+2) #Payload: ID + hradcID + ufmadd hex_hradcID = self.double_to_hex(hradcID) hex_ufmadd = self.double_to_hex(ufmadd) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc.index('ReadHRADC_UFM'))+hex_hradcID+hex_ufmadd send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def WriteHRADC_UFM(self,hradcID,ufmadd,ufmdata): payload_size = self.size_to_hex(1+2+2+2) #Payload: ID + hradcID + ufmadd + ufmdata hex_hradcID = self.double_to_hex(hradcID) hex_ufmadd = self.double_to_hex(ufmadd) hex_ufmdata = self.double_to_hex(ufmdata) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc.index('WriteHRADC_UFM'))+hex_hradcID+hex_ufmadd+hex_ufmdata send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def EraseHRADC_UFM(self,hradcID): payload_size = self.size_to_hex(1+2) #Payload: ID + hradcID hex_hradcID = self.double_to_hex(hradcID) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc.index('EraseHRADC_UFM'))+hex_hradcID send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def InitHRADC_BoardData(self, serial = 12345678, day = 1, mon = 1, year = 2017, hour = 12, minutes = 30, variant = 'HRADC-FBP', rburden = 20, calibtemp = 40, vin_gain = 1, vin_offset = 0, iin_gain = 1, iin_offset = 0, vref_p = 5, vref_n = -5, gnd = 0): boardData = {'serial': serial, 'variant': variant, 'rburden': rburden, 'tm_mday': day, 'tm_mon': mon, 'tm_year': year, 'tm_hour': hour, 'tm_min': minutes, 'calibtemp': calibtemp, 'vin_gain': vin_gain, 'vin_offset': vin_offset, 'iin_gain': iin_gain, 'iin_offset': iin_offset, 'vref_p': vref_p, 'vref_n': vref_n, 'gnd': gnd} return boardData def WriteHRADC_BoardData(self,hradcID,boardData): print('Configurando placa em UFM mode...') self.ConfigHRADCOpMode(hradcID,1) time.sleep(0.5) print('\nEnviando serial number...') ufmdata_16 = self._convertToUint16List(boardData['serial'],'Uint64') for i in range(len(ufmdata_16)): self.WriteHRADC_UFM(hradcID,i+ufmOffset['serial'],ufmdata_16[i]) time.sleep(0.1) print('\nEnviando variante...') ufmdata_16 = self._convertToUint16List(hradcVariant.index(boardData['variant']),'Uint16') for i in range(len(ufmdata_16)): self.WriteHRADC_UFM(hradcID,i+ufmOffset['variant'],ufmdata_16[i]) time.sleep(0.1) print('\nEnviando rburden...') ufmdata_16 = self._convertToUint16List(boardData['rburden'],'float') for i in range(len(ufmdata_16)): self.WriteHRADC_UFM(hradcID,i+ufmOffset['rburden'],ufmdata_16[i]) time.sleep(0.1) print('\nEnviando calibdate...') ufmdata_16 = self._convertToUint16List(boardData['tm_mday'],'Uint16') for i in range(len(ufmdata_16)): self.WriteHRADC_UFM(hradcID,i+ufmOffset['calibdate'],ufmdata_16[i]) time.sleep(0.1) # Month ufmdata_16 = self._convertToUint16List(boardData['tm_mon'],'Uint16') for i in range(len(ufmdata_16)): self.WriteHRADC_UFM(hradcID,i+ufmOffset['calibdate']+1,ufmdata_16[i]) time.sleep(0.1) # Year ufmdata_16 = self._convertToUint16List(boardData['tm_year'],'Uint16') for i in range(len(ufmdata_16)): self.WriteHRADC_UFM(hradcID,i+ufmOffset['calibdate']+2,ufmdata_16[i]) time.sleep(0.1) # Hour ufmdata_16 = self._convertToUint16List(boardData['tm_hour'],'Uint16') for i in range(len(ufmdata_16)): self.WriteHRADC_UFM(hradcID,i+ufmOffset['calibdate']+3,ufmdata_16[i]) time.sleep(0.1) # Minutes ufmdata_16 = self._convertToUint16List(boardData['tm_min'],'Uint16') for i in range(len(ufmdata_16)): self.WriteHRADC_UFM(hradcID,i+ufmOffset['calibdate']+4,ufmdata_16[i]) time.sleep(0.1) print('\nEnviando calibtemp...') ufmdata_16 = self._convertToUint16List(boardData['calibtemp'],'float') for i in range(len(ufmdata_16)): self.WriteHRADC_UFM(hradcID,i+ufmOffset['calibtemp'],ufmdata_16[i]) time.sleep(0.1) print('\nEnviando vin_gain...') ufmdata_16 = self._convertToUint16List(boardData['vin_gain'],'float') for i in range(len(ufmdata_16)): self.WriteHRADC_UFM(hradcID,i+ufmOffset['vin_gain'],ufmdata_16[i]) time.sleep(0.1) print('\nEnviando vin_offset...') ufmdata_16 = self._convertToUint16List(boardData['vin_offset'],'float') for i in range(len(ufmdata_16)): self.WriteHRADC_UFM(hradcID,i+ufmOffset['vin_offset'],ufmdata_16[i]) time.sleep(0.1) print('\nEnviando iin_gain...') ufmdata_16 = self._convertToUint16List(boardData['iin_gain'],'float') for i in range(len(ufmdata_16)): self.WriteHRADC_UFM(hradcID,i+ufmOffset['iin_gain'],ufmdata_16[i]) time.sleep(0.1) print('\nEnviando iin_offset...') ufmdata_16 = self._convertToUint16List(boardData['iin_offset'],'float') for i in range(len(ufmdata_16)): self.WriteHRADC_UFM(hradcID,i+ufmOffset['iin_offset'],ufmdata_16[i]) time.sleep(0.1) print('\nEnviando vref_p...') ufmdata_16 = self._convertToUint16List(boardData['vref_p'],'float') for i in range(len(ufmdata_16)): self.WriteHRADC_UFM(hradcID,i+ufmOffset['vref_p'],ufmdata_16[i]) time.sleep(0.1) print('\nEnviando vref_n...') ufmdata_16 = self._convertToUint16List(boardData['vref_n'],'float') for i in range(len(ufmdata_16)): self.WriteHRADC_UFM(hradcID,i+ufmOffset['vref_n'],ufmdata_16[i]) time.sleep(0.1) print('\nEnviando gnd...') ufmdata_16 = self._convertToUint16List(boardData['gnd'],'float') for i in range(len(ufmdata_16)): self.WriteHRADC_UFM(hradcID,i+ufmOffset['gnd'],ufmdata_16[i]) time.sleep(0.1) print('Colocando a placa em Sampling mode...') self.ConfigHRADCOpMode(hradcID,0) def ReadHRADC_BoardData(self,hradcID): print('Configurando placa em UFM mode...') print(self.ConfigHRADCOpMode(hradcID,1)) time.sleep(0.5) print('Extraindo dados da placa...') payload_size = self.size_to_hex(1+2) #Payload: ID + hradcID hex_hradcID = self.double_to_hex(hradcID) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc.index('ReadHRADC_BoardData'))+hex_hradcID send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) print(self.ser.read(6)) print('Lendo dados da placa...') self.read_var(self.index_to_hex(50+hradcID)) reply_msg = self.ser.read(1+1+2+56+1) print(reply_msg) print(len(reply_msg)) val = struct.unpack('BBHLLHHHHHHfffffffffB',reply_msg) try: boardData = self.InitHRADC_BoardData(val[3]+val[4]*pow(2,32),val[5], val[6],val[7],val[8],val[9], hradcVariant[val[10]],val[11], val[12],val[13],val[14],val[15], val[16],val[17],val[18],val[19]) except: print('\n### Placa não inicializada ###\n') boardData = self.InitHRADC_BoardData(serial = int(input('Digite o S/N: '))) print('\n') print('Colocando a placa em Sampling mode...') print(self.ConfigHRADCOpMode(hradcID,0)) time.sleep(0.5) return boardData def UpdateHRADC_BoardData(self,hradcID): variant = len(hradcVariant) while variant >= len(hradcVariant) or variant < 0: variant = int(input("Enter HRADC variant number:\n 0: HRADC-FBP\n 1: HRADC-FAX-A\n 2: HRADC-FAX-B\n 3: HRADC-FAX-C\n 4: HRADC-FAX-D\n\n>>> ")) variant = hradcVariant[variant] boardData = self.ReadHRADC_BoardData(hradcID) boardData['variant'] = variant boardData['vin_offset'] = np.float32(0) boardData['iin_offset'] = np.float32(0) if variant == 'HRADC-FBP': boardData['rburden'] = np.float32(20) boardData['vin_gain'] = np.float32(1) boardData['iin_gain'] = np.float32(1) print(boardData['vin_gain']) print(boardData['variant']) elif variant == 'HRADC-FAX-A': boardData['rburden'] = np.float32(0) boardData['vin_gain'] = np.float32(6.0/5.0) boardData['iin_gain'] = np.float32(6.0/5.0) print(boardData['vin_gain']) print(boardData['variant']) elif variant == 'HRADC-FAX-B': boardData['rburden'] = np.float32(0) boardData['vin_gain'] = np.float32(1) boardData['iin_gain'] = np.float32(1) print(boardData['vin_gain']) print(boardData['variant']) elif variant == 'HRADC-FAX-C': boardData['rburden'] = np.float32(5) boardData['vin_gain'] = np.float32(1) boardData['iin_gain'] = np.float32(1) print(boardData['vin_gain']) print(boardData['variant']) elif variant == 'HRADC-FAX-D': boardData['rburden'] = np.float32(1) boardData['vin_gain'] = np.float32(1) boardData['iin_gain'] = np.float32(1) print(boardData['vin_gain']) print(boardData['variant']) print('\n\nBoard data from HRADC of slot #' + str(hradcID) + ' is about to be overwritten by the following data:') print(boardData) i = input('\n Do you want to proceed? [y/n]: ') if i is 'Y' or i is 'y': self.ConfigHRADCOpMode(hradcID,1) time.sleep(0.1) self.EraseHRADC_UFM(hradcID) time.sleep(0.5) self.ResetHRADCBoards(1) time.sleep(0.5) self.ResetHRADCBoards(0) time.sleep(1.5) self.WriteHRADC_BoardData(hradcID,boardData) boardData_new = self.ReadHRADC_BoardData(hradcID) print(boardData_new) print(boardData) if boardData_new == boardData: print('\n\n ### Operation was successful !!! ### \n\n') else: print('\n\n ### Operation failed !!! ### \n\n') return [boardData, boardData_new] def GetHRADCs_BoardData(self,numHRADC): boardData_list = [] for i in range(numHRADC): boardData_list.append(self.ReadHRADC_BoardData(i)) return boardData_list def UdcEepromTest(self, rw, data=None): if data is not None: payload_size = self.size_to_hex(12) hex_rw = self.double_to_hex(rw) hex_byte_0 = self.double_to_hex(data[0]) hex_byte_1 = self.double_to_hex(data[1]) hex_byte_2 = self.double_to_hex(data[2]) hex_byte_3 = self.double_to_hex(data[3]) hex_byte_4 = self.double_to_hex(data[4]) hex_byte_5 = self.double_to_hex(data[5]) hex_byte_6 = self.double_to_hex(data[6]) hex_byte_7 = self.double_to_hex(data[7]) hex_byte_8 = self.double_to_hex(data[8]) hex_byte_9 = self.double_to_hex(data[9]) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListTestFunc.index('UdcEepromTest'))+hex_rw[0]+ \ hex_byte_0[0] + hex_byte_1[0] + hex_byte_2[0] + hex_byte_3[0] + hex_byte_4[0] + hex_byte_5[0]+ \ hex_byte_6[0] + hex_byte_7[0] + hex_byte_8[0] + hex_byte_9[0] print(send_packet.encode('ISO-8859-1')) self.ser.write(send_packet.encode('ISO-8859-1')) return self.ser.read(15) def UdcFlashTest(self, rw): payload_size = self.size_to_hex(2) hex_rw = self.double_to_hex(rw) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListTestFunc.index('UdcFlashTest'))+hex_rw[0] self.ser.write(send_packet.encode('ISO-8859-1')) return self.ser.read(6) def UdcRamTest(self, rw): payload_size = self.size_to_hex(2) hex_rw = self.double_to_hex(rw) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListTestFunc.index('UdcRamTest'))+hex_rw[0] self.ser.write(send_packet.encode('ISO-8859-1')) return self.ser.read(6) def UdcAdcTest(self, rw, channel): payload_size = self.size_to_hex(3) hex_rw = self.double_to_hex(rw) hex_channel = self.double_to_hex(channel) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListTestFunc.index('UdcAdcTest'))+hex_rw[0]+hex_channel[0] self.ser.write(send_packet.encode('ISO-8859-1')) return self.ser.read(6) def UdcSensorTempTest(self, rw): payload_size = self.size_to_hex(2) hex_rw = self.double_to_hex(rw) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListTestFunc.index('UdcSensorTempTest'))+hex_rw[0] self.ser.write(send_packet.encode('ISO-8859-1')) return self.ser.read(6) def UdcRtcTest(self, rw): payload_size = self.size_to_hex(2) hex_rw = self.double_to_hex(rw) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListTestFunc.index('UdcRtcTest'))+hex_rw[0] self.ser.write(send_packet.encode('ISO-8859-1')) return self.ser.read(6) def UdcUartTest(self, rw): payload_size = self.size_to_hex(2) hex_rw = self.double_to_hex(rw) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListTestFunc.index('UdcUartTest'))+hex_rw[0] self.ser.write(send_packet.encode('ISO-8859-1')) return self.ser.read(6) def UdcIoExpanderTest(self, rw): payload_size = self.size_to_hex(2) hex_rw = self.double_to_hex(rw) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListTestFunc.index('UdcIoExpanderTest'))+hex_rw[0] self.ser.write(send_packet.encode('ISO-8859-1')) return self.ser.read(6) # def UdcEthernetTest(self, rw): # payload_size = self.size_to_hex(2) # hex_rw = self.double_to_hex(rw) # send_packet = self.ComFunction+payload_size+self.index_to_hex(ListTestFunc.index('UdcEthernetTest'))+hex_rw # self.ser.write(send_packet.encode('ISO-8859-1')) # return self.ser.read() def UdcIsoPlaneTest(self, rw): payload_size = self.size_to_hex(2) hex_rw = self.double_to_hex(rw) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListTestFunc.index('UdcIsoPlaneTest'))+hex_rw[0] self.ser.write(send_packet.encode('ISO-8859-1')) return self.ser.read(6) def UdcLoopBackTest(self, rw, channel): payload_size = self.size_to_hex(3) hex_rw = self.double_to_hex(rw) hex_channel = self.double_to_hex(channel) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListTestFunc.index('UdcLoopBackTest'))+hex_rw[0]+hex_channel[0] self.ser.write(send_packet.encode('ISO-8859-1')) return self.ser.read(6) def UdcLedTest(self, rw): payload_size = self.size_to_hex(2) hex_rw = self.double_to_hex(rw) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListTestFunc.index('UdcLedTest'))+hex_rw[0] self.ser.write(send_packet.encode('ISO-8859-1')) return self.ser.read(6) def UdcBuzzerTest(self, rw): payload_size = self.size_to_hex(2) hex_rw = self.double_to_hex(rw) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListTestFunc.index('UdcBuzzerTest'))+hex_rw[0] self.ser.write(send_packet.encode('ISO-8859-1')) return self.ser.read(6) def UdcComTest(self, rw, val): payload_size = self.size_to_hex(3) hex_rw = self.double_to_hex(rw) hex_value = self.double_to_hex(val) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListTestFunc.index('UdcComTest'))+hex_rw[0]+hex_value[0] self.ser.write(send_packet.encode('ISO-8859-1')) time.sleep(0.2) return self.ser.read(6) def UdcI2cIsoTest(self, rw, val): payload_size = self.size_to_hex(3) hex_rw = self.double_to_hex(rw) hex_value = self.double_to_hex(val) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListTestFunc.index('UdcI2cIsoTest'))+hex_rw[0]+hex_value[0] self.ser.write(send_packet.encode('ISO-8859-1')) return self.ser.read(6) def SetISlowRefx4(self, iRef1 = 0, iRef2 = 0, iRef3 = 0, iRef4 = 0): payload_size = self.size_to_hex(1+4*4) #Payload: ID + 4*iRef hex_iRef1 = self.float_to_hex(iRef1) hex_iRef2 = self.float_to_hex(iRef2) hex_iRef3 = self.float_to_hex(iRef3) hex_iRef4 = self.float_to_hex(iRef4) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc.index('SetISlowRefx4'))+hex_iRef1+hex_iRef2+hex_iRef3+hex_iRef4 send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def SetPof(self): payload_size = self.size_to_hex(1) #Payload: ID send_packet = self.ComFunction+payload_size+self.index_to_hex(ListBCBFunc.index('SetPof')) send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def ClearPof(self): payload_size = self.size_to_hex(1) #Payload: ID send_packet = self.ComFunction+payload_size+self.index_to_hex(ListBCBFunc.index('ClearPof')) send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def ReadPof(self): payload_size = self.size_to_hex(1) #Payload: ID send_packet = self.ComFunction+payload_size+self.index_to_hex(ListBCBFunc.index('ReadPof')) send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def EnableBuzzer(self): payload_size = self.size_to_hex(1) #Payload: ID send_packet = self.ComFunction+payload_size+self.index_to_hex(ListBCBFunc.index('EnableBuzzer')) send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def DisableBuzzer(self): payload_size = self.size_to_hex(1) #Payload: ID send_packet = self.ComFunction+payload_size+self.index_to_hex(ListBCBFunc.index('DisableBuzzer')) send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def SendUartData(self): payload_size = self.size_to_hex(1) #Payload: ID send_packet = self.ComFunction+payload_size+self.index_to_hex(ListBCBFunc.index('SendUartData')) send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def GetUartData(self): payload_size = self.size_to_hex(1) #Payload: ID send_packet = self.ComFunction+payload_size+self.index_to_hex(ListBCBFunc.index('GetUartData')) send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def SendCanData(self): payload_size = self.size_to_hex(1) #Payload: ID send_packet = self.ComFunction+payload_size+self.index_to_hex(ListBCBFunc.index('SendCanData')) send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def GetCanData(self): payload_size = self.size_to_hex(1) #Payload: ID send_packet = self.ComFunction+payload_size+self.index_to_hex(ListBCBFunc.index('GetCanData')) send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def GetI2cData(self): payload_size = self.size_to_hex(1) #Payload: ID send_packet = self.ComFunction+payload_size+self.index_to_hex(ListBCBFunc.index('GetI2cData')) send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def read_ps_status(self): self.read_var(self.index_to_hex(ListVar_v2_1.index('ps_status'))) reply_msg = self.ser.read(7) val = struct.unpack('BBHHB',reply_msg) status = {} status['state'] = ListOpMode_v2_1[(val[3] & 0b0000000000001111)] status['open_loop'] = (val[3] & 0b0000000000010000) >> 4 status['interface'] = (val[3] & 0b0000000001100000) >> 5 status['active'] = (val[3] & 0b0000000010000000) >> 7 status['model'] = ListPSModels_v2_1[(val[3] & 0b0001111100000000) >> 8] status['unlocked'] = (val[3] & 0b0010000000000000) >> 13 #print(status) return status def set_ps_name(self,ps_name): if type(ps_name) == str: for n in range(len(ps_name)): self.set_param('PS_Name', n, float(ord(ps_name[n]))) for i in range(n+1,64): self.set_param('PS_Name', i, float(ord(" "))) def get_ps_name(self): ps_name = "" for n in range(64): ps_name = ps_name + chr(int(self.get_param('PS_Name', n))) if ps_name[-3:] == ' ': ps_name = ps_name[:n-2] break return ps_name def set_slowref(self,setpoint): payload_size = self.size_to_hex(1+4) #Payload: ID + iSlowRef hex_setpoint = self.float_to_hex(setpoint) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc_v2_1.index('set_slowref'))+hex_setpoint send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def set_slowref_fbp(self, iRef1 = 0, iRef2 = 0, iRef3 = 0, iRef4 = 0): payload_size = self.size_to_hex(1+4*4) #Payload: ID + 4*iRef hex_iRef1 = self.float_to_hex(iRef1) hex_iRef2 = self.float_to_hex(iRef2) hex_iRef3 = self.float_to_hex(iRef3) hex_iRef4 = self.float_to_hex(iRef4) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc_v2_1.index('set_slowref_fbp'))+hex_iRef1+hex_iRef2+hex_iRef3+hex_iRef4 send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def set_slowref_readback_mon(self,setpoint): payload_size = self.size_to_hex(1+4) #Payload: ID + iSlowRef hex_setpoint = self.float_to_hex(setpoint) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc_v2_1.index('set_slowref_readback_mon'))+hex_setpoint send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) reply_msg = self.ser.read(9) val = struct.unpack('BBHfB',reply_msg) return val[3] def set_slowref_fbp_readback_mon(self, iRef1 = 0, iRef2 = 0, iRef3 = 0, iRef4 = 0): payload_size = self.size_to_hex(1+4*4) #Payload: ID + 4*iRef hex_iRef1 = self.float_to_hex(iRef1) hex_iRef2 = self.float_to_hex(iRef2) hex_iRef3 = self.float_to_hex(iRef3) hex_iRef4 = self.float_to_hex(iRef4) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc_v2_1.index('set_slowref_fbp_readback_mon'))+hex_iRef1+hex_iRef2+hex_iRef3+hex_iRef4 send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) reply_msg = self.ser.read(21) if(len(reply_msg) == 6): return reply_msg else: val = struct.unpack('BBHffffB',reply_msg) return [val[3],val[4],val[5],val[6]] def set_slowref_readback_ref(self,setpoint): payload_size = self.size_to_hex(1+4) #Payload: ID + iSlowRef hex_setpoint = self.float_to_hex(setpoint) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc_v2_1.index('set_slowref_readback_ref'))+hex_setpoint send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) reply_msg = self.ser.read(9) val = struct.unpack('BBHfB',reply_msg) return val[3] def set_slowref_fbp_readback_ref(self, iRef1 = 0, iRef2 = 0, iRef3 = 0, iRef4 = 0): payload_size = self.size_to_hex(1+4*4) #Payload: ID + 4*iRef hex_iRef1 = self.float_to_hex(iRef1) hex_iRef2 = self.float_to_hex(iRef2) hex_iRef3 = self.float_to_hex(iRef3) hex_iRef4 = self.float_to_hex(iRef4) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc_v2_1.index('set_slowref_fbp_readback_ref'))+hex_iRef1+hex_iRef2+hex_iRef3+hex_iRef4 send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) reply_msg = self.ser.read(21) if(len(reply_msg) == 6): return reply_msg else: val = struct.unpack('BBHffffB',reply_msg) return [val[3],val[4],val[5],val[6]] def set_param(self, param_id, n, value): payload_size = self.size_to_hex(1+2+2+4) #Payload: ID + param id + [n] + value if type(param_id) == str: hex_id = self.double_to_hex(ListParameters.index(param_id)) if type(param_id) == int: hex_id = self.double_to_hex(param_id) hex_n = self.double_to_hex(n) hex_value = self.float_to_hex(value) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc_v2_1.index('set_param'))+hex_id+hex_n+hex_value send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) reply_msg = self.ser.read(6) if reply_msg[4] == 8: print('Invalid parameter') return reply_msg def get_param(self, param_id, n = 0): payload_size = self.size_to_hex(1+2+2) #Payload: ID + param id + [n] if type(param_id) == str: hex_id = self.double_to_hex(ListParameters.index(param_id)) if type(param_id) == int: hex_id = self.double_to_hex(param_id) hex_n = self.double_to_hex(n) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc_v2_1.index('get_param'))+hex_id+hex_n send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.reset_input_buffer() self.ser.write(send_msg.encode('ISO-8859-1')) reply_msg = self.ser.read(9) if len(reply_msg) == 9: val = struct.unpack('BBHfB',reply_msg) return val[3] else: #print('Invalid parameter') return float('nan') def save_param_eeprom(self, param_id, n = 0, type_memory = 2): payload_size = self.size_to_hex(1+2+2+2) #Payload: ID + param id + [n] + memory type if type(param_id) == str: hex_id = self.double_to_hex(ListParameters.index(param_id)) if type(param_id) == int: hex_id = self.double_to_hex(param_id) hex_n = self.double_to_hex(n) hex_type = self.double_to_hex(type_memory) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc_v2_1.index('save_param_eeprom'))+hex_id+hex_n+hex_type send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) reply_msg = self.ser.read(6) if reply_msg[4] == 8: print('Invalid parameter') return reply_msg def load_param_eeprom(self, param_id, n = 0, type_memory = 2): payload_size = self.size_to_hex(1+2+2+2) #Payload: ID + param id + [n] + memory type if type(param_id) == str: hex_id = self.double_to_hex(ListParameters.index(param_id)) if type(param_id) == int: hex_id = self.double_to_hex(param_id) hex_n = self.double_to_hex(n) hex_type = self.double_to_hex(type_memory) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc_v2_1.index('load_param_eeprom'))+hex_id+hex_n+hex_type send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) reply_msg = self.ser.read(6) if reply_msg[4] == 8: print('Invalid parameter') return reply_msg def save_param_bank(self, type_memory = 2): payload_size = self.size_to_hex(1+2) #Payload: ID + memory type hex_type = self.double_to_hex(type_memory) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc_v2_1.index('save_param_bank'))+hex_type send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def load_param_bank(self, type_memory = 2): payload_size = self.size_to_hex(1+2) #Payload: ID + memory type hex_type = self.double_to_hex(type_memory) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc_v2_1.index('load_param_bank'))+hex_type send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def set_param_bank(self, param_file): fbp_param_list = [] with open(param_file,newline='') as f: reader = csv.reader(f) for row in reader: fbp_param_list.append(row) for param in fbp_param_list: if str(param[0]) == 'PS_Name': print(str(param[0]) + "[0]: " + str(param[1])) print(self.set_ps_name(str(param[1]))) else: for n in range(64): try: print(str(param[0]) + "["+ str(n) + "]: " + str(param[n+1])) print(self.set_param(str(param[0]),n,float(param[n+1]))) except: break #self.save_param_bank() def get_param_bank(self, list_param = ListParameters, timeout = 0.5, print_modules = True): timeout_old = self.ser.timeout #self.ser.timeout = 0.05 param_bank = [] for param_name in list_param: param_row = [param_name] for n in range(64): if param_name == 'PS_Name': p = self.get_ps_name() param_row.append(p) #if(print_modules): #print('PS_Name: ' + p) self.ser.timeout = timeout break else: p = self.get_param(param_name,n) if math.isnan(p): break param_row.append(p) #if(print_modules): #print(param_name + "[" + str(n) + "]: " + str(p)) if(print_modules): print(param_row) param_bank.append(param_row) self.ser.timeout = timeout_old return param_bank def store_param_bank_csv(self, bank): filename = input('Digite o nome do arquivo: ') with open( filename + '.csv', 'w', newline='') as f: writer = csv.writer(f, delimiter=',') for param_row in bank: writer.writerow(param_row) def enable_onboard_eeprom(self): self.set_param('Enable_Onboard_EEPROM',0,0) self.save_param_eeprom('Enable_Onboard_EEPROM',0,2) def disable_onboard_eeprom(self): self.set_param('Enable_Onboard_EEPROM',0,1) self.save_param_eeprom('Enable_Onboard_EEPROM',0,2) def set_dsp_coeffs(self, dsp_class, dsp_id, coeffs_list = [0,0,0,0,0,0,0,0,0,0,0,0]): coeffs_list_full = self.format_list_size(coeffs_list, NUM_MAX_COEFFS_DSP) payload_size = self.size_to_hex(1+2+2+4*NUM_MAX_COEFFS_DSP) hex_dsp_class= self.double_to_hex(dsp_class) hex_dsp_id = self.double_to_hex(dsp_id) hex_coeffs = self.float_list_to_hex(coeffs_list_full) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc_v2_1.index('set_dsp_coeffs'))+hex_dsp_class+hex_dsp_id+hex_coeffs send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def get_dsp_coeff(self, dsp_class, dsp_id, coeff): payload_size = self.size_to_hex(1+2+2+2) hex_dsp_class= self.double_to_hex(dsp_class) hex_dsp_id = self.double_to_hex(dsp_id) hex_coeff = self.double_to_hex(coeff) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc_v2_1.index('get_dsp_coeff'))+hex_dsp_class+hex_dsp_id+hex_coeff send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.reset_input_buffer() self.ser.write(send_msg.encode('ISO-8859-1')) reply_msg = self.ser.read(9) #print(reply_msg) val = struct.unpack('BBHfB',reply_msg) return val[3] def save_dsp_coeffs_eeprom(self, dsp_class, dsp_id, type_memory = 2): payload_size = self.size_to_hex(1+2+2+2) hex_dsp_class= self.double_to_hex(dsp_class) hex_dsp_id = self.double_to_hex(dsp_id) hex_type = self.double_to_hex(type_memory) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc_v2_1.index('save_dsp_coeffs_eeprom'))+hex_dsp_class+hex_dsp_id+hex_type send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def load_dsp_coeffs_eeprom(self, dsp_class, dsp_id, type_memory = 2): payload_size = self.size_to_hex(1+2+2+2) hex_dsp_class= self.double_to_hex(dsp_class) hex_dsp_id = self.double_to_hex(dsp_id) hex_type = self.double_to_hex(type_memory) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc_v2_1.index('load_dsp_coeffs_eeprom'))+hex_dsp_class+hex_dsp_id+hex_type send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def save_dsp_modules_eeprom(self, type_memory = 2): payload_size = self.size_to_hex(1+2) #Payload: ID + memory type hex_type = self.double_to_hex(type_memory) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc_v2_1.index('save_dsp_modules_eeprom'))+hex_type send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def load_dsp_modules_eeprom(self, type_memory = 2): payload_size = self.size_to_hex(1+2) #Payload: ID + memory type hex_type = self.double_to_hex(type_memory) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc_v2_1.index('load_dsp_modules_eeprom'))+hex_type send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def reset_udc(self): reply = input('\nEste comando realiza o reset do firmware da placa UDC, e por isso, so e executado caso a fonte esteja desligada. \nCaso deseje apenas resetar interlocks, utilize o comando reset_interlocks(). \n\nTem certeza que deseja prosseguir? [Y/N]: ') if reply == 'Y' or reply == 'y': payload_size = self.size_to_hex(1) #Payload: ID send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc_v2_1.index('reset_udc')) send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) def run_bsmp_func(self,id_func,print_msg = 0): payload_size = self.size_to_hex(1) #Payload: ID send_packet = self.ComFunction+payload_size+self.index_to_hex(id_func) send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) reply_msg = self.ser.read(6) if print_msg: print(reply_msg) return reply_msg def run_bsmp_func_all_ps(self,p_func,add_list,arg = None,delay = 0.5, print_reply = 1): old_add = self.GetSlaveAdd() for add in add_list: self.SetSlaveAdd(add) if arg == None: r = p_func() else: r = p_func(arg) if print_reply: print('\n Add ' + str(add)) print(r) time.sleep(delay) self.SetSlaveAdd(old_add) def cfg_source_scope(self,p_source): payload_size = self.size_to_hex(1+4) #Payload: ID + p_source hex_op_mode = self.uint32_to_hex(p_source) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc_v2_1.index('cfg_source_scope'))+hex_op_mode send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def cfg_freq_scope(self,freq): payload_size = self.size_to_hex(1+4) #Payload: ID + freq hex_op_mode = self.float_to_hex(freq) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc_v2_1.index('cfg_freq_scope'))+hex_op_mode send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def cfg_duration_scope(self,duration): payload_size = self.size_to_hex(1+4) #Payload: ID + duration hex_op_mode = self.float_to_hex(duration) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc_v2_1.index('cfg_duration_scope'))+hex_op_mode send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def enable_scope(self): payload_size = self.size_to_hex(1) #Payload: ID send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc_v2_1.index('enable_scope')) send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def disable_scope(self): payload_size = self.size_to_hex(1) #Payload: ID send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc_v2_1.index('disable_scope')) send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def get_scope_vars(self): print('\n### Scope Variables ###\n') print('Frequency: ' + str((round(self.read_bsmp_variable(25,'float'),3)))) print('Duration: ' + str((round(self.read_bsmp_variable(26,'float'),3)))) print('Source Data: ' + str((round(self.read_bsmp_variable(27,'uint32_t'),3)))) def sync_pulse(self): payload_size = self.size_to_hex(1) #Payload: ID send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc_v2_1.index('sync_pulse')) send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def select_op_mode(self,op_mode): payload_size = self.size_to_hex(1+2) #Payload: ID + enable hex_op_mode = self.double_to_hex(ListOpMode_v2_1.index(op_mode)) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc_v2_1.index('select_op_mode'))+hex_op_mode send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def set_serial_termination(self,term_enable): payload_size = self.size_to_hex(1+2) #Payload: ID + enable hex_enable = self.double_to_hex(term_enable) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc_v2_1.index('set_serial_termination'))+hex_enable send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def set_command_interface(self,interface): payload_size = self.size_to_hex(1+2) #Payload: ID + enable hex_interface = self.double_to_hex(interface) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc_v2_1.index('set_command_interface'))+hex_interface send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def unlock_udc(self,password): payload_size = self.size_to_hex(1+2) #Payload: ID + password hex_password = self.double_to_hex(password) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc_v2_1.index('unlock_udc'))+hex_password send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def lock_udc(self,password): payload_size = self.size_to_hex(1+2) #Payload: ID + password hex_password = self.double_to_hex(password) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc_v2_1.index('lock_udc'))+hex_password send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def reset_counters(self): payload_size = self.size_to_hex(1) #Payload: ID send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc_v2_1.index('reset_counters')) send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def cfg_siggen(self,sig_type,num_cycles,freq,amplitude,offset,aux0,aux1,aux2,aux3): payload_size = self.size_to_hex(1+2+2+4+4+4+4*4) hex_sig_type = self.double_to_hex(ListSigGenTypes_v2_1.index(sig_type)) hex_num_cycles = self.double_to_hex(num_cycles) hex_freq = self.float_to_hex(freq) hex_amplitude = self.float_to_hex(amplitude) hex_offset = self.float_to_hex(offset) hex_aux0 = self.float_to_hex(aux0) hex_aux1 = self.float_to_hex(aux1) hex_aux2 = self.float_to_hex(aux2) hex_aux3 = self.float_to_hex(aux3) send_packet = self.ComFunction + payload_size + self.index_to_hex(ListFunc_v2_1.index('cfg_siggen')) + hex_sig_type + hex_num_cycles + hex_freq + hex_amplitude + hex_offset + hex_aux0 + hex_aux1 + hex_aux2 + hex_aux3 send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def set_siggen(self,freq,amplitude,offset): payload_size = self.size_to_hex(1+4+4+4) hex_freq = self.float_to_hex(freq) hex_amplitude = self.float_to_hex(amplitude) hex_offset = self.float_to_hex(offset) send_packet = self.ComFunction + payload_size + self.index_to_hex(ListFunc_v2_1.index('set_siggen')) + hex_freq + hex_amplitude + hex_offset send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def enable_siggen(self): payload_size = self.size_to_hex(1) #Payload: ID send_packet = self.ComFunction+payload_size + self.index_to_hex(ListFunc_v2_1.index('enable_siggen')) send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def disable_siggen(self): payload_size = self.size_to_hex(1) #Payload: ID send_packet = self.ComFunction+payload_size + self.index_to_hex(ListFunc_v2_1.index('disable_siggen')) send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def cfg_wfmref(self, idx, sync_mode, frequency, gain = 1, offset = 0): payload_size = self.size_to_hex(1+2+2+4+4+4) #Payload: ID + idx + sync_mode + frequency + gain + offset hex_idx = self.double_to_hex(idx) hex_mode = self.double_to_hex(sync_mode) hex_freq = self.float_to_hex(frequency) hex_gain = self.float_to_hex(gain) hex_offset = self.float_to_hex(offset) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc_v2_1.index('cfg_wfmref'))+hex_idx+hex_mode+hex_freq+hex_gain+hex_offset send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def select_wfmref(self,idx): payload_size = self.size_to_hex(1+2) #Payload: ID + idx hex_idx = self.double_to_hex(idx) send_packet = self.ComFunction+payload_size+self.index_to_hex(ListFunc_v2_1.index('select_wfmref'))+hex_idx send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def reset_wfmref(self): payload_size = self.size_to_hex(1) #Payload: ID send_packet = self.ComFunction+payload_size + self.index_to_hex(ListFunc_v2_1.index('reset_wfmref')) send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(6) def get_wfmref_vars(self,curve_id): print('\n### WfmRef ' + str(curve_id) + ' Variables ###\n') print('Length: ' + str((round(self.read_bsmp_variable(20+curve_id*3,'uint32_t'),3)-round(self.read_bsmp_variable(19+curve_id*3,'uint32_t'),3))/2+1)) print('Index: ' + str((round(self.read_bsmp_variable(21+curve_id*3,'uint32_t'),3)-round(self.read_bsmp_variable(19+curve_id*3,'uint32_t'),3))/2+1)) print('WfmRef Selected: ' + str(round(self.read_bsmp_variable(14,'uint16_t'),3))) print('Sync Mode: ' + str(round(self.read_bsmp_variable(15,'uint16_t'),3))) print('Frequency: ' + str(round(self.read_bsmp_variable(16,'float'),3)) + " Hz") print('Gain: ' + str(round(self.read_bsmp_variable(17,'float'),3))) print('Offset: ' + str(round(self.read_bsmp_variable(18,'float'),3))) def read_csv_file(self,filename, type = 'float'): csv_list = [] with open(filename, newline = '') as f: reader = csv.reader(f) for row in reader: if type == 'float': row_converted = float(row[0]) elif type == 'string' or type == 'str': row_converted = str(row[0]) csv_list.append(row_converted) print('Length of list: ' + str(len(csv_list)) + '\n') return csv_list ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ====================================================================== Métodos de Leitura de Valores das Variáveis BSMP O retorno do método são os valores double/float da respectiva variavel ====================================================================== ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' def read_bsmp_variable(self,id_var,type_var,print_msg = 0): self.read_var(self.index_to_hex(id_var)) reply_msg = self.ser.read(typeSize[type_var]) if print_msg: print(reply_msg) val = struct.unpack(typeFormat[type_var],reply_msg) return val[3] def read_bsmp_variable_gen(self,id_var,size_bytes,print_msg = 0): self.read_var(self.index_to_hex(id_var)) reply_msg = self.ser.read(size_bytes+5) if print_msg: print(reply_msg) return reply_msg def read_udc_arm_version(self): self.read_var(self.index_to_hex(3)) reply_msg = self.ser.read(133) val = struct.unpack('16s',reply_msg[4:20]) return val[0].decode('utf-8') def read_udc_c28_version(self): self.read_var(self.index_to_hex(3)) reply_msg = self.ser.read(133) val = struct.unpack('16s',reply_msg[20:36]) return val[0].decode('utf-8') def read_udc_version(self): print('\n ARM: ' + self.read_udc_arm_version()) print(' C28: ' + self.read_udc_c28_version()) def Read_iLoad1(self): self.read_var(self.index_to_hex(ListVar.index('iLoad1'))) reply_msg = self.ser.read(9) print(reply_msg) val = struct.unpack('BBHfB',reply_msg) return val[3] def Read_iLoad2(self): self.read_var(self.index_to_hex(ListVar.index('iLoad2'))) reply_msg = self.ser.read(9) val = struct.unpack('BBHfB',reply_msg) return val[3] def Read_iMod1(self): self.read_var(self.index_to_hex(ListVar.index('iMod1'))) reply_msg = self.ser.read(9) val = struct.unpack('BBHfB',reply_msg) return val[3] def Read_iMod2(self): self.read_var(self.index_to_hex(ListVar.index('iMod2'))) reply_msg = self.ser.read(9) val = struct.unpack('BBHfB',reply_msg) return val[3] def Read_iMod3(self): self.read_var(self.index_to_hex(ListVar.index('iMod3'))) reply_msg = self.ser.read(9) val = struct.unpack('BBHfB',reply_msg) return val[3] def Read_iMod4(self): self.read_var(self.index_to_hex(ListVar.index('iMod4'))) reply_msg = self.ser.read(9) val = struct.unpack('BBHfB',reply_msg) return val[3] def Read_vLoad(self): self.read_var(self.index_to_hex(ListVar.index('vLoad'))) reply_msg = self.ser.read(9) val = struct.unpack('BBHfB',reply_msg) return val[3] def Read_vDCMod1(self): self.read_var(self.index_to_hex(ListVar.index('vDCMod1'))) reply_msg = self.ser.read(9) print(reply_msg) val = struct.unpack('BBHfB',reply_msg) return val[3] def Read_vDCMod2(self): self.read_var(self.index_to_hex(ListVar.index('vDCMod2'))) reply_msg = self.ser.read(9) print(reply_msg) val = struct.unpack('BBHfB',reply_msg) return val[3] def Read_vDCMod3(self): self.read_var(self.index_to_hex(ListVar.index('vDCMod3'))) reply_msg = self.ser.read(9) print(reply_msg) val = struct.unpack('BBHfB',reply_msg) return val[3] def Read_vDCMod4(self): self.read_var(self.index_to_hex(ListVar.index('vDCMod4'))) reply_msg = self.ser.read(9) print(reply_msg) val = struct.unpack('BBHfB',reply_msg) return val[3] def Read_vOutMod1(self): self.read_var(self.index_to_hex(ListVar.index('vOutMod1'))) reply_msg = self.ser.read(9) print(reply_msg) val = struct.unpack('BBHfB',reply_msg) return val[3] def Read_vOutMod2(self): self.read_var(self.index_to_hex(ListVar.index('vOutMod2'))) reply_msg = self.ser.read(9) print(reply_msg) val = struct.unpack('BBHfB',reply_msg) return val[3] def Read_vOutMod3(self): self.read_var(self.index_to_hex(ListVar.index('vOutMod3'))) reply_msg = self.ser.read(9) print(reply_msg) val = struct.unpack('BBHfB',reply_msg) return val[3] def Read_vOutMod4(self): self.read_var(self.index_to_hex(ListVar.index('vOutMod4'))) reply_msg = self.ser.read(9) print(reply_msg) val = struct.unpack('BBHfB',reply_msg) return val[3] def Read_temp1(self): self.read_var(self.index_to_hex(ListVar.index('temp1'))) reply_msg = self.ser.read(9) val = struct.unpack('BBHfB',reply_msg) return val[3] def Read_temp2(self): self.read_var(self.index_to_hex(ListVar.index('temp2'))) reply_msg = self.ser.read(9) val = struct.unpack('BBHfB',reply_msg) return val[3] def Read_temp3(self): self.read_var(self.index_to_hex(ListVar.index('temp3'))) reply_msg = self.ser.read(9) val = struct.unpack('BBHfB',reply_msg) return val[3] def Read_temp4(self): self.read_var(self.index_to_hex(ListVar.index('temp4'))) reply_msg = self.ser.read(9) val = struct.unpack('BBHfB',reply_msg) return val[3] def Read_ps_OnOff(self): self.read_var(self.index_to_hex(ListVar.index('ps_OnOff'))) reply_msg = self.ser.read(7) val = struct.unpack('BBHHB',reply_msg) return val[3] def Read_ps_OpMode(self): self.read_var(self.index_to_hex(ListVar.index('ps_OpMode'))) reply_msg = self.ser.read(7) val = struct.unpack('BBHHB',reply_msg) return val[3] def Read_ps_Remote(self): self.read_var(self.index_to_hex(ListVar.index('ps_Remote'))) reply_msg = self.ser.read(7) val = struct.unpack('BBHHB',reply_msg) return val[3] def Read_ps_OpenLoop(self): self.read_var(self.index_to_hex(ListVar.index('ps_OpenLoop'))) reply_msg = self.ser.read(7) val = struct.unpack('BBHHB',reply_msg) return val[3] def Read_ps_SoftInterlocks(self): op_bin = 1 ActiveSoftInterlocks = [] SoftInterlocksList = ['N/A', 'Sobre-tensao na carga 1', 'N/A',\ 'N/A', 'N/A', 'N/A', 'N/A', 'N/A', 'N/A',\ 'Sobre-tensao na carga 2', 'N/A', \ 'N/A', 'N/A', 'N/A', 'N/A', 'N/A', 'N/A',\ 'Sobre-tensao na carga 3', 'N/A', \ 'N/A', 'N/A', 'N/A', 'N/A', 'N/A', 'N/A',\ 'Sobre-tensao na carga 4', 'N/A', \ 'N/A', 'N/A', 'N/A', 'N/A', 'N/A', 'N/A'] self.read_var(self.index_to_hex(ListVar.index('ps_SoftInterlocks'))) reply_msg = self.ser.read(9) print(reply_msg) val = struct.unpack('BBHIB',reply_msg) print('Soft Interlocks ativos:') for i in range(len('{0:b}'.format(val[3]))): if (val[3] & (op_bin << i)) == 2**i: ActiveSoftInterlocks.append(SoftInterlocksList[i]) print(SoftInterlocksList[i]) print('---------------------------------------------------------------') return val[3] def Read_ps_HardInterlocks(self): op_bin = 1 ActiveHardInterlocks = [] HardInterlocksList = ['Sobre-corrente na carga 1', 'N/A', \ 'Sobre-tensao no DC-Link do modulo 1', \ 'Sub-tensao no DC-Link do modulo 1', \ 'Falha no rele de entrada do DC-Link do modulo 1', \ 'Falha no fusivel de entrada do DC-Link do modulo 1', \ 'Falha nos drivers do modulo 1', \ 'Sobre-temperatura no modulo 1', \ 'Sobre-corrente na carga 2', 'N/A', \ 'Sobre-tensao no DC-Link do modulo 2', \ 'Sub-tensao no DC-Link do modulo 2', \ 'Falha no rele de entrada do DC-Link do modulo 2', \ 'Falha no fusivel de entrada do DC-Link do modulo 2', \ 'Falha nos drivers do modulo 2', \ 'Sobre-temperatura no modulo 2', \ 'Sobre-corrente na carga 3', 'N\A', \ 'Sobre-tensao no DC-Link do modulo 3', \ 'Sub-tensao no DC-Link do modulo 3', \ 'Falha no rele de entrada no DC-Link do modulo 3', \ 'Falha no fusivel de entrada do DC-Link do modulo 3', \ 'Falha nos drivers do modulo 3', \ 'Sobre-temperatura no modulo 3', \ 'Sobre-corrente na carga 4', 'N/A', \ 'Sobre-tensao no DC-Link do modulo 4', \ 'Sub-tensao no DC-Link do modulo 4', \ 'Falha no rele de entrada do DC-Link do modulo 4', \ 'Falha no fusivel de entrada do DC-Link do modulo 4', \ 'Falha nos drivers do modulo 4', \ 'Sobre-temperatura no modulo 4'] self.read_var(self.index_to_hex(ListVar.index('ps_HardInterlocks'))) reply_msg = self.ser.read(9) print(reply_msg) val = struct.unpack('BBHIB',reply_msg) print('Hard Interlocks ativos:') for i in range(len('{0:b}'.format(val[3]))): if (val[3] & (op_bin << i)) == 2**i: ActiveHardInterlocks.append(HardInterlocksList[i]) print(HardInterlocksList[i]) print('---------------------------------------------------------------') return val[3] def Read_iRef(self): self.read_var(self.index_to_hex(ListVar.index('iRef'))) reply_msg = self.ser.read(9) val = struct.unpack('BBHfB',reply_msg) return val[3] def Read_wfmRef_Gain(self): self.read_var(self.index_to_hex(ListVar.index('wfmRef_Gain'))) reply_msg = self.ser.read(9) val = struct.unpack('BBHfB',reply_msg) return val[3] def Read_wfmRef_Offset(self): self.read_var(self.index_to_hex(ListVar.index('wfmRef_Offset'))) reply_msg = self.ser.read(9) val = struct.unpack('BBHfB',reply_msg) return val[3] def Read_sigGen_Enable(self): self.read_var(self.index_to_hex(ListVar.index('sigGen_Enable'))) reply_msg = self.ser.read(7) val = struct.unpack('BBHHB',reply_msg) return val[3] def Read_sigGen_Type(self): self.read_var(self.index_to_hex(ListVar.index('sigGen_Type'))) reply_msg = self.ser.read(7) val = struct.unpack('BBHHB',reply_msg) return val[3] def Read_sigGen_Ncycles(self): self.read_var(self.index_to_hex(ListVar.index('sigGen_Ncycles'))) reply_msg = self.ser.read(7) val = struct.unpack('BBHHB',reply_msg) return val[3] def Read_sigGen_PhaseStart(self): self.read_var(self.index_to_hex(ListVar.index('sigGen_PhaseStart'))) reply_msg = self.ser.read(9) val = struct.unpack('BBHfB',reply_msg) return val[3] def Read_sigGen_PhaseEnd(self): self.read_var(self.index_to_hex(ListVar.index('sigGen_PhaseEnd'))) reply_msg = self.ser.read(9) val = struct.unpack('BBHfB',reply_msg) return val[3] def Read_sigGen_Freq(self): self.read_var(self.index_to_hex(ListVar.index('sigGen_Freq'))) reply_msg = self.ser.read(9) val = struct.unpack('BBHfB',reply_msg) return val[3] def Read_sigGen_Amplitude(self): self.read_var(self.index_to_hex(ListVar.index('sigGen_Amplitude'))) reply_msg = self.ser.read(9) val = struct.unpack('BBHfB',reply_msg) return val[3] def Read_sigGen_Offset(self): self.read_var(self.index_to_hex(ListVar.index('sigGen_Offset'))) reply_msg = self.ser.read(9) val = struct.unpack('BBHfB',reply_msg) return val[3] def Read_sigGen_Aux(self): self.read_var(self.index_to_hex(ListVar.index('sigGen_Aux'))) reply_msg = self.ser.read(9) val = struct.unpack('BBHfB',reply_msg) return val[3] def Read_dp_ID(self): self.read_var(self.index_to_hex(ListVar.index('dp_ID'))) reply_msg = self.ser.read(7) val = struct.unpack('BBHHB',reply_msg) return val[3] def Read_dp_Class(self): self.read_var(self.index_to_hex(ListVar.index('dp_Class'))) reply_msg = self.ser.read(7) val = struct.unpack('BBHHB',reply_msg) return val[3] def Read_dp_Coeffs(self): self.read_var(self.index_to_hex(ListVar.index('dp_Coeffs'))) reply_msg = self.ser.read(69) val = struct.unpack('BBHffffffffffffffffB',reply_msg) return [val[3],val[4],val[5],val[6],val[7],val[8],val[9],val[10],val[11],val[12],val[13],val[14],val[15],val[16],val[17],val[18]] def Read_ps_Model(self): self.read_var(self.index_to_hex(ListVar.index('ps_Model'))) reply_msg = self.ser.read(7) val = struct.unpack('BBHHB',reply_msg) return val def read_ps_model(self): reply_msg = self.Read_ps_Model() return ListPSModels[reply_msg[3]] def Read_wfmRef_PtrBufferStart(self): self.read_var(self.index_to_hex(ListVar.index('wfmRef_PtrBufferStart'))) reply_msg = self.ser.read(9) val = struct.unpack('BBHIB',reply_msg) return val[3] def Read_wfmRef_PtrBufferEnd(self): self.read_var(self.index_to_hex(ListVar.index('wfmRef_PtrBufferEnd'))) reply_msg = self.ser.read(9) val = struct.unpack('BBHIB',reply_msg) return val[3] def Read_wfmRef_PtrBufferK(self): self.read_var(self.index_to_hex(ListVar.index('wfmRef_PtrBufferK'))) reply_msg = self.ser.read(9) val = struct.unpack('BBHIB',reply_msg) return val[3] def Read_wfmRef_SyncMode(self): self.read_var(self.index_to_hex(ListVar.index('wfmRef_SyncMode'))) reply_msg = self.ser.read(7) val = struct.unpack('BBHHB',reply_msg) return val[3] def Read_iRef1(self): self.read_var(self.index_to_hex(45)) reply_msg = self.ser.read(9) val = struct.unpack('BBHfB',reply_msg) return val[3] def Read_iRef2(self): self.read_var(self.index_to_hex(46)) reply_msg = self.ser.read(9) val = struct.unpack('BBHfB',reply_msg) return val[3] def Read_iRef3(self): self.read_var(self.index_to_hex(47)) reply_msg = self.ser.read(9) val = struct.unpack('BBHfB',reply_msg) return val[3] def Read_iRef4(self): self.read_var(self.index_to_hex(48)) reply_msg = self.ser.read(9) val = struct.unpack('BBHfB',reply_msg) return val[3] def Read_counterSetISlowRefx4(self): self.read_var(self.index_to_hex(49)) reply_msg = self.ser.read(9) val = struct.unpack('BBHfB',reply_msg) return val[3] ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ====================================================================== Métodos de Escrita de Valores das Variáveis BSMP O retorno do método são os bytes de retorno da mensagem ====================================================================== ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' def Write_sigGen_Freq(self,float_value): hex_float = self.float_to_hex(float_value) send_packet = self.ComWriteVar+self.WriteFloatSizePayload+self.index_to_hex(ListVar.index('sigGen_Freq'))+hex_float send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(5) def Write_sigGen_Amplitude(self,float_value): hex_float = self.float_to_hex(float_value) send_packet = self.ComWriteVar+self.WriteFloatSizePayload+self.index_to_hex(ListVar.index('sigGen_Amplitude'))+hex_float send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(5) def Write_sigGen_Offset(self,float_value): hex_float = self.float_to_hex(float_value) send_packet = self.ComWriteVar+self.WriteFloatSizePayload+self.index_to_hex(ListVar.index('sigGen_Offset'))+hex_float send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(5) def Write_sigGen_Aux(self,float_value): hex_float = self.float_to_hex(float_value) send_packet = self.ComWriteVar+self.WriteFloatSizePayload+self.index_to_hex(ListVar.index('sigGen_Aux'))+hex_float send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(5) def Write_dp_ID(self,double_value): hex_double = self.double_to_hex(double_value) send_packet = self.ComWriteVar+self.WriteDoubleSizePayload+self.index_to_hex(ListVar.index('dp_ID'))+hex_double send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(5) def Write_dp_Class(self,double_value): hex_double = self.double_to_hex(double_value) send_packet = self.ComWriteVar+self.WriteDoubleSizePayload+self.index_to_hex(ListVar.index('dp_Class'))+hex_double send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(5) def Write_dp_Coeffs(self,list_float): hex_float_list = [] #list_full = list_float[:] #while(len(list_full) < self.DP_MODULE_MAX_COEFF): # list_full.append(0) list_full = [0 for i in range(self.DP_MODULE_MAX_COEFF)] list_full[:len(list_float)] = list_float[:] for float_value in list_full: hex_float = self.float_to_hex(float(float_value)) hex_float_list.append(hex_float) str_float_list = ''.join(hex_float_list) payload_size = self.size_to_hex(1+4*self.DP_MODULE_MAX_COEFF) #Payload: ID + 16floats send_packet = self.ComWriteVar+payload_size+self.index_to_hex(ListVar.index('dp_Coeffs'))+str_float_list send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(5) ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ====================================================================== Métodos de Escrita de Curvas BSMP O retorno do método são os bytes de retorno da mensagem ====================================================================== ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' def Send_wfmRef_Curve(self,block_idx,data): block_hex = struct.pack('>H',block_idx).decode('ISO-8859-1') val = [] for k in range(0,len(data)): val.append(self.float_to_hex(float(data[k]))) payload_size = struct.pack('>H', (len(val)*4)+3).decode('ISO-8859-1') curva_hex = ''.join(val) send_packet = self.ComSendWfmRef+payload_size+self.index_to_hex(ListCurv.index('wfmRef_Curve'))+block_hex+curva_hex send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(5) def Recv_wfmRef_Curve(self,block_idx): block_hex = struct.pack('>H',block_idx).decode('ISO-8859-1') payload_size = self.size_to_hex(1+2) #Payload: ID+Block_index send_packet = self.ComRequestCurve+payload_size+self.index_to_hex(ListCurv.index('wfmRef_Curve'))+block_hex send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) recv_msg = self.ser.read(1+1+2+1+2+8192+1) #Address+Command+Size+ID+Block_idx+data+checksum val = [] for k in range(7,len(recv_msg)-1,4): val.append(struct.unpack('f',recv_msg[k:k+4])) return val def Recv_samplesBuffer(self): block_hex = struct.pack('>H',0).decode('ISO-8859-1') payload_size = self.size_to_hex(1+2) #Payload: ID+Block_index send_packet = self.ComRequestCurve+payload_size+self.index_to_hex(ListCurv.index('samplesBuffer'))+block_hex send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) recv_msg = self.ser.read(1+1+2+1+2+16384+1) #Address+Command+Size+ID+Block_idx+data+checksum val = [] try: for k in range(7,len(recv_msg)-1,4): val.extend(struct.unpack('f',recv_msg[k:k+4])) except: pass return val def Send_fullwfmRef_Curve(self,block_idx,data): block_hex = struct.pack('>H',block_idx).decode('ISO-8859-1') val = [] for k in range(0,len(data)): val.append(self.float_to_hex(float(data[k]))) payload_size = struct.pack('>H', (len(val)*4)+3).decode('ISO-8859-1') curva_hex = ''.join(val) send_packet = self.ComSendWfmRef+payload_size+self.index_to_hex(ListCurv.index('fullwfmRef_Curve'))+block_hex+curva_hex send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(5) def Recv_fullwfmRef_Curve(self,block_idx): block_hex = struct.pack('>H',block_idx).decode('ISO-8859-1') payload_size = self.size_to_hex(1+2) #Payload: ID+Block_index send_packet = self.ComRequestCurve+payload_size+self.index_to_hex(ListCurv.index('fullwfmRef_Curve'))+block_hex send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) recv_msg = self.ser.read(1+1+2+1+2+16384+1) #Address+Command+Size+ID+Block_idx+data+checksum val = [] for k in range(7,len(recv_msg)-1,4): val.append(struct.unpack('f',recv_msg[k:k+4])) return val def Recv_samplesBuffer_blocks(self,block_idx): block_hex = struct.pack('>H',block_idx).decode('ISO-8859-1') payload_size = self.size_to_hex(1+2) #Payload: ID+Block_index send_packet = self.ComRequestCurve+payload_size+self.index_to_hex(ListCurv.index('samplesBuffer_blocks'))+block_hex send_msg = self.checksum(self.SlaveAdd+send_packet) #t0 = time.time() self.ser.write(send_msg.encode('ISO-8859-1')) recv_msg = self.ser.read(1+1+2+1+2+1024+1) #Address+Command+Size+ID+Block_idx+data+checksum #print(time.time()-t0) #print(recv_msg) val = [] for k in range(7,len(recv_msg)-1,4): val.extend(struct.unpack('f',recv_msg[k:k+4])) return val def Recv_samplesBuffer_allblocks(self): buff = [] #self.DisableSamplesBuffer() for i in range(0,16): #t0 = time.time() buff.extend(self.Recv_samplesBuffer_blocks(i)) #print(time.time()-t0) #self.EnableSamplesBuffer() return buff def read_curve_block(self,curve_id,block_id): block_hex = struct.pack('>H',block_id).decode('ISO-8859-1') payload_size = self.size_to_hex(1+2) #Payload: curve_id + block_id send_packet = self.ComRequestCurve+payload_size+self.index_to_hex(curve_id)+block_hex send_msg = self.checksum(self.SlaveAdd+send_packet) #t0 = time.time() self.ser.reset_input_buffer() self.ser.write(send_msg.encode('ISO-8859-1')) recv_msg = self.ser.read(1+1+2+1+2+size_curve_block[curve_id]+1) #Address+Command+Size+ID+Block_idx+data+checksum #print(time.time()-t0) #print(recv_msg) val = [] for k in range(7,len(recv_msg)-1,4): val.extend(struct.unpack('f',recv_msg[k:k+4])) return val def write_curve_block(self,curve_id,block_id,data): block_hex = struct.pack('>H',block_id).decode('ISO-8859-1') val = [] for k in range(0,len(data)): val.append(self.float_to_hex(float(data[k]))) payload_size = struct.pack('>H', (len(val)*4)+3).decode('ISO-8859-1') curva_hex = ''.join(val) send_packet = self.ComSendWfmRef+payload_size+self.index_to_hex(curve_id)+block_hex+curva_hex send_msg = self.checksum(self.SlaveAdd+send_packet) self.ser.write(send_msg.encode('ISO-8859-1')) return self.ser.read(5) def write_wfmref(self,curve,data): #curve = ListCurv_v2_1.index('wfmref') block_size = int(size_curve_block[curve]/4) print(block_size) blocks = [data[x:x+block_size] for x in range(0, len(data), block_size)] ps_status = self.read_ps_status() wfmref_selected = self.read_bsmp_variable(14,'uint16_t') if( (wfmref_selected == curve) and (ps_status['state'] == 'RmpWfm' or ps_status['state'] == 'MigWfm') ): print("\n The specified curve ID is currently selected and PS is on " + ps_status['state'] + " state. Choose a different curve ID to proceed.\n") else: for block_id in range(len(blocks)): self.write_curve_block(curve, block_id, blocks[block_id]) print(blocks[block_id]) def read_buf_samples_ctom(self): buf = [] curve_id = ListCurv_v2_1.index('buf_samples_ctom') ps_status = self.read_ps_status() if ps_status['model'] == 'FBP': for i in range(num_blocks_curves_fbp[curve_id]): buf.extend(self.read_curve_block(curve_id,i)) else: for i in range(num_blocks_curves_fax[curve_id]): buf.extend(self.read_curve_block(curve_id,i)) return buf ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ====================================================================== Funções Serial ====================================================================== ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' def Connect(self,port='COM2',baud=6000000): try: SerialDRS.ser = serial.Serial(port,baud,timeout=1) #port format should be 'COM'+number return True except: return False def Disconnect(self): if (self.ser.isOpen()): try: self.ser.close() return True except: return False def SetSlaveAdd(self,address): self.SlaveAdd = struct.pack('B',address).decode('ISO-8859-1') def GetSlaveAdd(self): return struct.unpack('B',self.SlaveAdd.encode())[0] ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ====================================================================== Funções auxiliares ====================================================================== ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' def read_vars_common(self, print_all = False): loop_state = ["Closed Loop","Open Loop"] ps_status = self.read_ps_status() if ps_status['open_loop'] == 0: if (ps_status['model'] == 'FAC_ACDC') or (ps_status['model'] == 'FAC_2S_ACDC') or (ps_status['model'] == 'FAC_2P4S_ACDC'): setpoint_unit = " V" else: setpoint_unit = " A" else: setpoint_unit = " %" print("\nPS Model: " + ps_status['model']) print("State: " + ps_status['state']) print("Loop State: " + loop_state[ps_status['open_loop']]) print("\nSetpoint: " + str(round(self.read_bsmp_variable(1,'float'),3)) + setpoint_unit) print("Reference: " + str(round(self.read_bsmp_variable(2,'float'),3)) + setpoint_unit) if print_all: print(self.read_ps_status()) print("\nCounter set_slowref: " + str(round(self.read_bsmp_variable(4,'uint32_t'),3))) print("Counter sync pulse: " + str(round(self.read_bsmp_variable(5,'uint32_t'),3))) self.get_siggen_vars() self.get_wfmref_vars(0) self.get_wfmref_vars(1) self.get_scope_vars() def decode_interlocks(self,reg_interlocks,list_interlocks): active_interlocks = [] for i in range(32): if(reg_interlocks & (1 << i)): active_interlocks.append(list_interlocks[i]) print('\t' + list_interlocks[i]) return active_interlocks def read_vars_fbp(self, n = 1, dt = 0.5): try: for i in range(n): print('\n--- Measurement #' + str(i+1) + ' ------------------------------------------\n') self.read_vars_common() soft_itlks = self.read_bsmp_variable(31,'uint32_t') print("\nSoft Interlocks: " + str(soft_itlks)) if(soft_itlks): self.decode_interlocks(soft_itlks, list_fbp_soft_interlocks) print('') hard_itlks = self.read_bsmp_variable(32,'uint32_t') print("Hard Interlocks: " + str(hard_itlks)) if(hard_itlks): self.decode_interlocks(hard_itlks, list_fbp_hard_interlocks) print("\nLoad Current: " + str(round(self.read_bsmp_variable(33,'float'),3)) + " A") print("Load Voltage: " + str(round(self.read_bsmp_variable(34,'float'),3)) + " V") print("Load Resistance: " + str(abs(round(self.read_bsmp_variable(34,'float') / self.read_bsmp_variable(33,'float'),3))) + " Ohm") print("Load Power: " + str(abs(round(self.read_bsmp_variable(34,'float') * self.read_bsmp_variable(33,'float'),3))) + " W") print("DC-Link Voltage: " + str(round(self.read_bsmp_variable(35,'float'),3)) + " V") print("Heat-Sink Temp: " + str(round(self.read_bsmp_variable(36,'float'),3)) + " °C") print("Duty-Cycle: " + str(round(self.read_bsmp_variable(37,'float'),3)) + " %") time.sleep(dt) except: pass def read_vars_fbp_dclink(self, n = 1, dt = 0.5): try: for i in range(n): print('\n--- Measurement #' + str(i+1) + ' ------------------------------------------\n') self.read_vars_common() hard_itlks = self.read_bsmp_variable(32,'uint32_t') print("\nHard Interlocks: " + str(hard_itlks)) if(hard_itlks): self.decode_interlocks(hard_itlks, list_fbp_dclink_hard_interlocks) print("\nModules status: " + str(round(self.read_bsmp_variable(33,'uint32_t'),3))) print("DC-Link Voltage: " + str(round(self.read_bsmp_variable(34,'float'),3)) + " V") print("PS1 Voltage: " + str(round(self.read_bsmp_variable(35,'float'),3)) + " V") print("PS2 Voltage: " + str(round(self.read_bsmp_variable(36,'float'),3)) + " V") print("PS3 Voltage: " + str(round(self.read_bsmp_variable(37,'float'),3)) + " V") print("Dig Pot Tap: " + str(round(self.read_bsmp_variable(38,'uint8_t'),3))) time.sleep(dt) except: pass def read_vars_fac_acdc(self, n = 1, dt = 0.5, iib = 1): #try: for i in range(n): print('\n--- Measurement #' + str(i+1) + ' ------------------------------------------\n') self.read_vars_common() soft_itlks = self.read_bsmp_variable(31,'uint32_t') print("\nSoft Interlocks: " + str(soft_itlks)) if(soft_itlks): self.decode_interlocks(soft_itlks, list_fac_acdc_soft_interlocks) print('') hard_itlks = self.read_bsmp_variable(32,'uint32_t') print("Hard Interlocks: " + str(hard_itlks)) if(hard_itlks): self.decode_interlocks(hard_itlks, list_fac_acdc_hard_interlocks) iib_is_itlks = self.read_bsmp_variable(45,'uint32_t') print("\nIIB IS Interlocks: " + str(iib_is_itlks)) if(iib_is_itlks): self.decode_interlocks(iib_is_itlks, list_fac_acdc_iib_is_interlocks) iib_is_alarms = self.read_bsmp_variable(46,'uint32_t') print("IIB IS Alarms: " + str(iib_is_alarms)) if(iib_is_alarms): self.decode_interlocks(iib_is_alarms, list_fac_acdc_iib_is_alarms) iib_cmd_itlks = self.read_bsmp_variable(57,'uint32_t') print("\nIIB Cmd Interlocks: " + str(iib_cmd_itlks)) if(iib_cmd_itlks): self.decode_interlocks(iib_cmd_itlks, list_fac_acdc_iib_cmd_interlocks) iib_cmd_alarms = self.read_bsmp_variable(58,'uint32_t') print("IIB Cmd Alarms: " + str(iib_cmd_alarms)) if(iib_cmd_alarms): self.decode_interlocks(iib_cmd_alarms, list_fac_acdc_iib_cmd_alarms) print("\nCapBank Voltage: " + str(round(self.read_bsmp_variable(33,'float'),3)) + " V") print("Rectifier Current: " + str(round(self.read_bsmp_variable(34,'float'),3)) + " A") print("Duty-Cycle: " + str(round(self.read_bsmp_variable(35,'float'),3)) + " %") if(iib): print("\nIIB IS Input Current: " + str(round(self.read_bsmp_variable(36,'float'),3)) + " A") print("IIB IS Input Voltage: " + str(round(self.read_bsmp_variable(37,'float'),3)) + " V") print("IIB IS IGBT Temp: " + str(round(self.read_bsmp_variable(38,'float'),3)) + " °C") print("IIB IS Driver Voltage: " + str(round(self.read_bsmp_variable(39,'float'),3)) + " V") print("IIB IS Driver Current: " + str(round(self.read_bsmp_variable(40,'float'),3)) + " A") print("IIB IS Inductor Temp: " + str(round(self.read_bsmp_variable(41,'float'),3)) + " °C") print("IIB IS Heat-Sink Temp: " + str(round(self.read_bsmp_variable(42,'float'),3)) + " °C") print("IIB IS Board Temp: " + str(round(self.read_bsmp_variable(43,'float'),3)) + " °C") print("IIB IS Board RH: " + str(round(self.read_bsmp_variable(44,'float'),3)) + " %") print("IIB IS Interlocks: " + str(round(self.read_bsmp_variable(45,'uint32_t'),3))) print("IIB IS Alarms: " + str(round(self.read_bsmp_variable(46,'uint32_t'),3))) print("\nIIB Cmd Load Voltage: " + str(round(self.read_bsmp_variable(47,'float'),3)) + " V") print("IIB Cmd CapBank Voltage: " + str(round(self.read_bsmp_variable(48,'float'),3)) + " V") print("IIB Cmd Rectifier Inductor Temp: " + str(round(self.read_bsmp_variable(49,'float'),3)) + " °C") print("IIB Cmd Rectifier Heat-Sink Temp: " + str(round(self.read_bsmp_variable(50,'float'),3)) + " °C") print("IIB Cmd External Boards Voltage: " + str(round(self.read_bsmp_variable(51,'float'),3)) + " V") print("IIB Cmd Auxiliary Board Current: " + str(round(self.read_bsmp_variable(52,'float'),3)) + " A") print("IIB Cmd IDB Board Current: " + str(round(self.read_bsmp_variable(53,'float'),3)) + " A") print("IIB Cmd Ground Leakage Current: " + str(round(self.read_bsmp_variable(54,'float'),3)) + " A") print("IIB Cmd Board Temp: " + str(round(self.read_bsmp_variable(55,'float'),3)) + " °C") print("IIB Cmd Board RH: " + str(round(self.read_bsmp_variable(56,'float'),3)) + " %") print("IIB Cmd Interlocks: " + str(round(self.read_bsmp_variable(57,'uint32_t'),3))) print("IIB Cmd Alarms: " + str(round(self.read_bsmp_variable(58,'uint32_t'),3))) time.sleep(dt) #except: # pass def read_vars_fac_dcdc(self, n = 1, dt = 0.5, iib = 1): try: for i in range(n): print('\n--- Measurement #' + str(i+1) + ' ------------------------------------------\n') self.read_vars_common() print("\nSync Pulse Counter: " + str(round(self.read_bsmp_variable(5,'uint32_t'),3))) print("WfmRef Index: " + str( (round(self.read_bsmp_variable(20,'uint32_t'),3) - round(self.read_bsmp_variable(18,'uint32_t'),3))/2 + 1)) soft_itlks = self.read_bsmp_variable(31,'uint32_t') print("\nSoft Interlocks: " + str(soft_itlks)) if(soft_itlks): self.decode_interlocks(soft_itlks, list_fac_dcdc_soft_interlocks) print('') hard_itlks = self.read_bsmp_variable(32,'uint32_t') print("Hard Interlocks: " + str(hard_itlks)) if(hard_itlks): self.decode_interlocks(hard_itlks, list_fac_dcdc_hard_interlocks) iib_itlks = self.read_bsmp_variable(51,'uint32_t') print("\nIIB Interlocks: " + str(iib_itlks)) if(iib_itlks): self.decode_interlocks(iib_itlks, list_fac_dcdc_iib_interlocks) iib_alarms = self.read_bsmp_variable(52,'uint32_t') print("IIB Alarms: " + str(iib_alarms)) if(iib_alarms): self.decode_interlocks(iib_alarms, list_fac_dcdc_iib_alarms) print("\nLoad Current: " + str(round(self.read_bsmp_variable(33,'float'),3)) + " A") print("Load Current DCCT 1: " + str(round(self.read_bsmp_variable(34,'float'),3)) + " A") print("Load Current DCCT 2: " + str(round(self.read_bsmp_variable(35,'float'),3)) + " A") print("\nCapBank Voltage: " + str(round(self.read_bsmp_variable(36,'float'),3)) + " V") print("\nDuty-Cycle: " + str(round(self.read_bsmp_variable(37,'float'),3)) + " %") if(iib): print("\nIIB CapBank Voltage: " + str(round(self.read_bsmp_variable(38,'float'),3)) + " V") print("IIB Input Current: " + str(round(self.read_bsmp_variable(39,'float'),3)) + " A") print("IIB Output Current: " + str(round(self.read_bsmp_variable(40,'float'),3)) + " A") print("IIB IGBT Leg 1 Temp: " + str(round(self.read_bsmp_variable(41,'float'),3)) + " °C") print("IIB IGBT Leg 2 Temp: " + str(round(self.read_bsmp_variable(42,'float'),3)) + " °C") print("IIB Inductor Temp: " + str(round(self.read_bsmp_variable(43,'float'),3)) + " °C") print("IIB Heat-Sink Temp: " + str(round(self.read_bsmp_variable(44,'float'),3)) + " °C") print("IIB Driver Voltage: " + str(round(self.read_bsmp_variable(45,'float'),3)) + " V") print("IIB Driver Current 1: " + str(round(self.read_bsmp_variable(46,'float'),3)) + " A") print("IIB Driver Current 2: " + str(round(self.read_bsmp_variable(47,'float'),3)) + " A") print("IIB Ground Leakage Current: " + str(round(self.read_bsmp_variable(48,'float'),3)) + " A") print("IIB Board Temp: " + str(round(self.read_bsmp_variable(49,'float'),3)) + " °C") print("IIB Board RH: " + str(round(self.read_bsmp_variable(50,'float'),3)) + " %") print("IIB Interlocks: " + str(round(self.read_bsmp_variable(51,'uint32_t'),3))) print("IIB Alarms: " + str(round(self.read_bsmp_variable(52,'uint32_t'),3))) time.sleep(dt) except: pass def read_vars_fac_dcdc_ema(self, n = 1, dt = 0.5, iib = 0): try: for i in range(n): print('\n--- Measurement #' + str(i+1) + ' ------------------------------------------\n') self.read_vars_common() soft_itlks = self.read_bsmp_variable(31,'uint32_t') print("\nSoft Interlocks: " + str(soft_itlks)) if(soft_itlks): self.decode_interlocks(soft_itlks, list_fac_dcdc_ema_soft_interlocks) print('') hard_itlks = self.read_bsmp_variable(32,'uint32_t') print("Hard Interlocks: " + str(hard_itlks)) if(hard_itlks): self.decode_interlocks(hard_itlks, list_fac_dcdc_ema_hard_interlocks) iib_itlks = self.read_bsmp_variable(49,'uint32_t') print("IIB Interlocks: " + str(iib_itlks)) if(iib_itlks): self.decode_interlocks(iib_itlks, list_fac_dcdc_ema_iib_interlocks) iib_alarms = self.read_bsmp_variable(50,'uint32_t') print("IIB Alarms: " + str(iib_alarms)) if(iib_alarms): self.decode_interlocks(iib_alarms, list_fac_dcdc_ema_iib_alarms) print("\nLoad Current: " + str(round(self.read_bsmp_variable(33,'float'),3))) print("DC-Link Voltage: " + str(round(self.read_bsmp_variable(34,'float'),3))) print("\nDuty-Cycle: " + str(round(self.read_bsmp_variable(35,'float'),3))) if(iib): print("\nIIB Input Voltage: " + str(round(self.read_bsmp_variable(36,'float'),3)) + " V") print("IIB Input Current: " + str(round(self.read_bsmp_variable(37,'float'),3)) + " A") print("IIB Output Current: " + str(round(self.read_bsmp_variable(38,'float'),3)) + " A") print("IIB IGBT 1 Temp: " + str(round(self.read_bsmp_variable(39,'float'),3)) + " °C") print("IIB IGBT 2 Temp: " + str(round(self.read_bsmp_variable(40,'float'),3)) + " °C") print("IIB Inductor Temp: " + str(round(self.read_bsmp_variable(41,'float'),3)) + " °C") print("IIB Heat-Sink Temp: " + str(round(self.read_bsmp_variable(42,'float'),3)) + " °C") print("IIB Driver Voltage: " + str(round(self.read_bsmp_variable(43,'float'),3)) + " V") print("IIB Driver Current 1: " + str(round(self.read_bsmp_variable(44,'float'),3)) + " A") print("IIB Driver Current 2: " + str(round(self.read_bsmp_variable(45,'float'),3)) + " A") print("IIB Ground Leakage Current: " + str(round(self.read_bsmp_variable(46,'float'),3)) + " A") print("IIB Board Temp: " + str(round(self.read_bsmp_variable(47,'float'),3)) + " °C") print("IIB Board RH: " + str(round(self.read_bsmp_variable(48,'float'),3)) + " %") print("IIB Interlocks: " + str(round(self.read_bsmp_variable(49,'uint32_t'),3))) print("IIB Alarms: " + str(round(self.read_bsmp_variable(50,'uint32_t'),3))) time.sleep(dt) except: pass def read_vars_fac_2s_acdc(self, n = 1, add_mod_a = 2, dt = 0.5, iib = 0): old_add = self.GetSlaveAdd() try: for i in range(n): self.SetSlaveAdd(add_mod_a) print('\n--- Measurement #' + str(i+1) + ' ------------------------------------------\n') self.read_vars_common() print('\n *** MODULE A ***') soft_itlks = self.read_bsmp_variable(31,'uint32_t') print("\nSoft Interlocks: " + str(soft_itlks)) if(soft_itlks): self.decode_interlocks(soft_itlks, list_fac_2s_acdc_soft_interlocks) print('') hard_itlks = self.read_bsmp_variable(32,'uint32_t') print("Hard Interlocks: " + str(hard_itlks)) if(hard_itlks): self.decode_interlocks(hard_itlks, list_fac_2s_acdc_hard_interlocks) iib_is_itlks = self.read_bsmp_variable(45,'uint32_t') print("\nIIB IS Interlocks: " + str(iib_is_itlks)) if(iib_is_itlks): self.decode_interlocks(iib_is_itlks, list_fac_2s_acdc_iib_is_interlocks) iib_is_alarms = self.read_bsmp_variable(46,'uint32_t') print("IIB IS Alarms: " + str(iib_is_alarms)) if(iib_is_alarms): self.decode_interlocks(iib_is_alarms, list_fac_2s_acdc_iib_is_alarms) iib_cmd_itlks = self.read_bsmp_variable(57,'uint32_t') print("\nIIB Cmd Interlocks: " + str(iib_cmd_itlks)) if(iib_cmd_itlks): self.decode_interlocks(iib_cmd_itlks, list_fac_2s_acdc_iib_cmd_interlocks) iib_cmd_alarms = self.read_bsmp_variable(58,'uint32_t') print("IIB Cmd Alarms: " + str(iib_cmd_alarms)) if(iib_cmd_alarms): self.decode_interlocks(iib_cmd_alarms, list_fac_2s_acdc_iib_cmd_alarms) print("\nCapBank Voltage: " + str(round(self.read_bsmp_variable(33,'float'),3)) + " V") print("Rectifier Current: " + str(round(self.read_bsmp_variable(34,'float'),3)) + " A") print("Duty-Cycle: " + str(round(self.read_bsmp_variable(35,'float'),3)) + " %") if(iib): print("\nIIB IS Input Current: " + str(round(self.read_bsmp_variable(36,'float'),3)) + " A") print("IIB IS Input Voltage: " + str(round(self.read_bsmp_variable(37,'float'),3)) + " V") print("IIB IS IGBT Temp: " + str(round(self.read_bsmp_variable(38,'float'),3)) + " °C") print("IIB IS Driver Voltage: " + str(round(self.read_bsmp_variable(39,'float'),3)) + " V") print("IIB IS Driver Current: " + str(round(self.read_bsmp_variable(40,'float'),3)) + " A") print("IIB IS Inductor Temp: " + str(round(self.read_bsmp_variable(41,'float'),3)) + " °C") print("IIB IS Heat-Sink Temp: " + str(round(self.read_bsmp_variable(42,'float'),3)) + " °C") print("IIB IS Board Temp: " + str(round(self.read_bsmp_variable(43,'float'),3)) + " °C") print("IIB IS Board RH: " + str(round(self.read_bsmp_variable(44,'float'),3)) + " %") print("IIB IS Interlocks: " + str(round(self.read_bsmp_variable(45,'uint32_t'),3))) print("IIB IS Alarms: " + str(round(self.read_bsmp_variable(46,'uint32_t'),3))) print("\nIIB Cmd Load Voltage: " + str(round(self.read_bsmp_variable(47,'float'),3)) + " V") print("IIB Cmd CapBank Voltage: " + str(round(self.read_bsmp_variable(48,'float'),3)) + " V") print("IIB Cmd Rectifier Inductor Temp: " + str(round(self.read_bsmp_variable(49,'float'),3)) + " °C") print("IIB Cmd Rectifier Heat-Sink Temp: " + str(round(self.read_bsmp_variable(50,'float'),3)) + " °C") print("IIB Cmd External Boards Voltage: " + str(round(self.read_bsmp_variable(51,'float'),3)) + " V") print("IIB Cmd Auxiliary Board Current: " + str(round(self.read_bsmp_variable(52,'float'),3)) + " A") print("IIB Cmd IDB Board Current: " + str(round(self.read_bsmp_variable(53,'float'),3)) + " A") print("IIB Cmd Ground Leakage Current: " + str(round(self.read_bsmp_variable(54,'float'),3)) + " A") print("IIB Cmd Board Temp: " + str(round(self.read_bsmp_variable(55,'float'),3)) + " °C") print("IIB Cmd Board RH: " + str(round(self.read_bsmp_variable(56,'float'),3)) + " %") print("IIB Cmd Interlocks: " + str(round(self.read_bsmp_variable(57,'uint32_t'),3))) print("IIB Cmd Alarms: " + str(round(self.read_bsmp_variable(58,'uint32_t'),3))) self.SetSlaveAdd(add_mod_a+1) print('\n *** MODULE B ***') soft_itlks = self.read_bsmp_variable(31,'uint32_t') print("\nSoft Interlocks: " + str(soft_itlks)) if(soft_itlks): self.decode_interlocks(soft_itlks, list_fac_2s_acdc_soft_interlocks) print('') hard_itlks = self.read_bsmp_variable(32,'uint32_t') print("Hard Interlocks: " + str(hard_itlks)) if(hard_itlks): self.decode_interlocks(hard_itlks, list_fac_2s_acdc_hard_interlocks) iib_is_itlks = self.read_bsmp_variable(45,'uint32_t') print("\nIIB IS Interlocks: " + str(iib_is_itlks)) if(iib_is_itlks): self.decode_interlocks(iib_is_itlks, list_fac_2s_acdc_iib_is_interlocks) iib_is_alarms = self.read_bsmp_variable(46,'uint32_t') print("IIB IS Alarms: " + str(iib_is_alarms)) if(iib_is_alarms): self.decode_interlocks(iib_is_alarms, list_fac_2s_acdc_iib_is_alarms) iib_cmd_itlks = self.read_bsmp_variable(57,'uint32_t') print("\nIIB Cmd Interlocks: " + str(iib_cmd_itlks)) if(iib_cmd_itlks): self.decode_interlocks(iib_cmd_itlks, list_fac_2s_acdc_iib_cmd_interlocks) iib_cmd_alarms = self.read_bsmp_variable(58,'uint32_t') print("IIB Cmd Alarms: " + str(iib_cmd_alarms)) if(iib_cmd_alarms): self.decode_interlocks(iib_cmd_alarms, list_fac_2s_acdc_iib_cmd_alarms) print("\nCapBank Voltage: " + str(round(self.read_bsmp_variable(33,'float'),3)) + " V") print("Rectifier Current: " + str(round(self.read_bsmp_variable(34,'float'),3)) + " A") print("Duty-Cycle: " + str(round(self.read_bsmp_variable(35,'float'),3)) + " %") if(iib): print("\nIIB IS Input Current: " + str(round(self.read_bsmp_variable(36,'float'),3)) + " A") print("IIB IS Input Voltage: " + str(round(self.read_bsmp_variable(37,'float'),3)) + " V") print("IIB IS IGBT Temp: " + str(round(self.read_bsmp_variable(38,'float'),3)) + " °C") print("IIB IS Driver Voltage: " + str(round(self.read_bsmp_variable(39,'float'),3)) + " V") print("IIB IS Driver Current: " + str(round(self.read_bsmp_variable(40,'float'),3)) + " A") print("IIB IS Inductor Temp: " + str(round(self.read_bsmp_variable(41,'float'),3)) + " °C") print("IIB IS Heat-Sink Temp: " + str(round(self.read_bsmp_variable(42,'float'),3)) + " °C") print("IIB IS Board Temp: " + str(round(self.read_bsmp_variable(43,'float'),3)) + " °C") print("IIB IS Board RH: " + str(round(self.read_bsmp_variable(44,'float'),3)) + " %") print("IIB IS Interlocks: " + str(round(self.read_bsmp_variable(45,'uint32_t'),3))) print("IIB IS Alarms: " + str(round(self.read_bsmp_variable(46,'uint32_t'),3))) print("\nIIB Cmd Load Voltage: " + str(round(self.read_bsmp_variable(47,'float'),3)) + " V") print("IIB Cmd CapBank Voltage: " + str(round(self.read_bsmp_variable(48,'float'),3)) + " V") print("IIB Cmd Rectifier Inductor Temp: " + str(round(self.read_bsmp_variable(49,'float'),3)) + " °C") print("IIB Cmd Rectifier Heat-Sink Temp: " + str(round(self.read_bsmp_variable(50,'float'),3)) + " °C") print("IIB Cmd External Boards Voltage: " + str(round(self.read_bsmp_variable(51,'float'),3)) + " V") print("IIB Cmd Auxiliary Board Current: " + str(round(self.read_bsmp_variable(52,'float'),3)) + " A") print("IIB Cmd IDB Board Current: " + str(round(self.read_bsmp_variable(53,'float'),3)) + " A") print("IIB Cmd Ground Leakage Current: " + str(round(self.read_bsmp_variable(54,'float'),3)) + " A") print("IIB Cmd Board Temp: " + str(round(self.read_bsmp_variable(55,'float'),3)) + " °C") print("IIB Cmd Board RH: " + str(round(self.read_bsmp_variable(56,'float'),3)) + " %") print("IIB Cmd Interlocks: " + str(round(self.read_bsmp_variable(57,'uint32_t'),3))) print("IIB Cmd Alarms: " + str(round(self.read_bsmp_variable(58,'uint32_t'),3))) time.sleep(dt) self.SetSlaveAdd(old_add) except: self.SetSlaveAdd(old_add) def read_vars_fac_2s_dcdc(self, n = 1, com_add = 1, dt = 0.5, iib = 0): old_add = self.GetSlaveAdd() iib_offset = 14*(iib-1) try: for i in range(n): self.SetSlaveAdd(com_add) print('\n--- Measurement #' + str(i+1) + ' ------------------------------------------\n') self.read_vars_common() print("\nSync Pulse Counter: " + str(round(self.read_bsmp_variable(5,'uint32_t'),3))) soft_itlks = self.read_bsmp_variable(31,'uint32_t') print("\nSoft Interlocks: " + str(soft_itlks)) if(soft_itlks): self.decode_interlocks(soft_itlks, list_fac_2s_dcdc_soft_interlocks) print('') hard_itlks = self.read_bsmp_variable(32,'uint32_t') print("Hard Interlocks: " + str(hard_itlks)) if(hard_itlks): self.decode_interlocks(hard_itlks, list_fac_2s_dcdc_hard_interlocks) print("\nLoad Current: " + str(round(self.read_bsmp_variable(33,'float'),3)) + " A") print("Load Current DCCT 1: " + str(round(self.read_bsmp_variable(34,'float'),3)) + " A") print("Load Current DCCT 2: " + str(round(self.read_bsmp_variable(35,'float'),3)) + " A") print("\nCapBank Voltage 1: " + str(round(self.read_bsmp_variable(36,'float'),3)) + " V") print("CapBank Voltage 2: " + str(round(self.read_bsmp_variable(37,'float'),3)) + " V") print("\nDuty-Cycle 1: " + str(round(self.read_bsmp_variable(38,'float'),3)) + " %") print("Duty-Cycle 2: " + str(round(self.read_bsmp_variable(39,'float'),3)) + " %") if(iib): print("\nIIB CapBank Voltage: " + str(round(self.read_bsmp_variable(40 + iib_offset,'float'),3)) + " V") print("IIB Input Current: " + str(round(self.read_bsmp_variable(41 + iib_offset,'float'),3)) + " A") print("IIB Output Current: " + str(round(self.read_bsmp_variable(42 + iib_offset,'float'),3)) + " A") print("IIB IGBT Leg 1 Temp: " + str(round(self.read_bsmp_variable(43 + iib_offset,'float'),3)) + " °C") print("IIB IGBT Leg 2 Temp: " + str(round(self.read_bsmp_variable(44 + iib_offset,'float'),3)) + " °C") print("IIB Inductor Temp: " + str(round(self.read_bsmp_variable(45 + iib_offset,'float'),3)) + " °C") print("IIB Heat-Sink Temp: " + str(round(self.read_bsmp_variable(46 + iib_offset,'float'),3)) + " °C") print("IIB Driver Voltage: " + str(round(self.read_bsmp_variable(47 + iib_offset,'float'),3)) + " V") print("IIB Driver Current 1: " + str(round(self.read_bsmp_variable(48 + iib_offset,'float'),3)) + " A") print("IIB Driver Current 2: " + str(round(self.read_bsmp_variable(49 + iib_offset,'float'),3)) + " A") print("IIB Board Temp: " + str(round(self.read_bsmp_variable(50 + iib_offset,'float'),3)) + " °C") print("IIB Board RH: " + str(round(self.read_bsmp_variable(51 + iib_offset,'float'),3)) + " %") iib_itlks = self.read_bsmp_variable(52 + iib_offset,'uint32_t') print("\nIIB Interlocks: " + str(iib_itlks)) if(iib_itlks): self.decode_interlocks(iib_itlks, list_fac_2s_dcdc_iib_interlocks) iib_alarms = self.read_bsmp_variable(53 + iib_offset,'uint32_t') print("IIB Alarms: " + str(iib_alarms)) if(iib_alarms): self.decode_interlocks(iib_alarms, list_fac_2s_dcdc_iib_alarms) time.sleep(dt) self.SetSlaveAdd(old_add) except: self.SetSlaveAdd(old_add) def read_vars_fac_2p4s_acdc(self, n = 1, add_mod_a = 1, dt = 0.5, iib = 0): self.read_vars_fac_2s_acdc(n, add_mod_a, dt, iib) def read_vars_fac_2p4s_dcdc(self, n = 1, com_add = 1, dt = 0.5, iib = 0): old_add = self.GetSlaveAdd() try: for i in range(n): self.SetSlaveAdd(com_add) print('\n--- Measurement #' + str(i+1) + ' ------------------------------------------\n') self.read_vars_common() print("\nSync Pulse Counter: " + str(round(self.read_bsmp_variable(5,'uint32_t'),3))) soft_itlks = self.read_bsmp_variable(31,'uint32_t') print("\nSoft Interlocks: " + str(soft_itlks)) if(soft_itlks): self.decode_interlocks(soft_itlks, list_fac_2p4s_dcdc_soft_interlocks) print('') hard_itlks = self.read_bsmp_variable(32,'uint32_t') print("Hard Interlocks: " + str(hard_itlks)) if(hard_itlks): self.decode_interlocks(hard_itlks, list_fac_2p4s_dcdc_hard_interlocks) print("\nLoad Current: " + str(round(self.read_bsmp_variable(33,'float'),3))) print("Load Current DCCT 1: " + str(round(self.read_bsmp_variable(34,'float'),3))) print("Load Current DCCT 2: " + str(round(self.read_bsmp_variable(35,'float'),3))) print("\nArm Current 1: " + str(round(self.read_bsmp_variable(36,'float'),3))) print("Arm Current 2: " + str(round(self.read_bsmp_variable(37,'float'),3))) print("\nCapBank Voltage 1: " + str(round(self.read_bsmp_variable(38,'float'),3))) print("CapBank Voltage 2: " + str(round(self.read_bsmp_variable(39,'float'),3))) print("CapBank Voltage 3: " + str(round(self.read_bsmp_variable(40,'float'),3))) print("CapBank Voltage 4: " + str(round(self.read_bsmp_variable(41,'float'),3))) print("CapBank Voltage 5: " + str(round(self.read_bsmp_variable(42,'float'),3))) print("CapBank Voltage 6: " + str(round(self.read_bsmp_variable(43,'float'),3))) print("CapBank Voltage 7: " + str(round(self.read_bsmp_variable(44,'float'),3))) print("CapBank Voltage 8: " + str(round(self.read_bsmp_variable(45,'float'),3))) print("\nDuty-Cycle 1: " + str(round(self.read_bsmp_variable(46,'float'),3))) print("Duty-Cycle 2: " + str(round(self.read_bsmp_variable(47,'float'),3))) print("Duty-Cycle 3: " + str(round(self.read_bsmp_variable(48,'float'),3))) print("Duty-Cycle 4: " + str(round(self.read_bsmp_variable(49,'float'),3))) print("Duty-Cycle 5: " + str(round(self.read_bsmp_variable(50,'float'),3))) print("Duty-Cycle 6: " + str(round(self.read_bsmp_variable(51,'float'),3))) print("Duty-Cycle 7: " + str(round(self.read_bsmp_variable(52,'float'),3))) print("Duty-Cycle 8: " + str(round(self.read_bsmp_variable(53,'float'),3))) if(iib): print("\nIIB CapBank Voltage: " + str(round(self.read_bsmp_variable(54,'float'),3)) + " V") print("IIB Input Current: " + str(round(self.read_bsmp_variable(55, 'float'),3)) + " A") print("IIB Output Current: " + str(round(self.read_bsmp_variable(56,'float'),3)) + " A") print("IIB IGBT Leg 1 Temp: " + str(round(self.read_bsmp_variable(57,'float'),3)) + " °C") print("IIB IGBT Leg 2 Temp: " + str(round(self.read_bsmp_variable(58,'float'),3)) + " °C") print("IIB Inductor Temp: " + str(round(self.read_bsmp_variable(59,'float'),3)) + " °C") print("IIB Heat-Sink Temp: " + str(round(self.read_bsmp_variable(60,'float'),3)) + " °C") print("IIB Driver Voltage: " + str(round(self.read_bsmp_variable(61,'float'),3)) + " V") print("IIB Driver Current 1: " + str(round(self.read_bsmp_variable(62,'float'),3)) + " A") print("IIB Driver Current 2: " + str(round(self.read_bsmp_variable(63,'float'),3)) + " A") print("IIB Board Temp: " + str(round(self.read_bsmp_variable(64,'float'),3)) + " °C") print("IIB Board RH: " + str(round(self.read_bsmp_variable(65,'float'),3)) + " %") iib_itlks = self.read_bsmp_variable(66,'uint32_t') print("\nIIB Interlocks: " + str(iib_itlks)) if(iib_itlks): self.decode_interlocks(iib_itlks, list_fac_2p4s_dcdc_iib_interlocks) iib_alarms = self.read_bsmp_variable(67,'uint32_t') print("IIB Alarms: " + str(iib_alarms)) if(iib_alarms): self.decode_interlocks(iib_alarms, list_fac_2p4s_dcdc_iib_alarms) print("\nIIB CapBank Voltage: " + str(round(self.read_bsmp_variable(68,'float'),3)) + " V") print("IIB Input Current: " + str(round(self.read_bsmp_variable(69,'float'),3)) + " A") print("IIB Output Current: " + str(round(self.read_bsmp_variable(70,'float'),3)) + " A") print("IIB IGBT Leg 1 Temp: " + str(round(self.read_bsmp_variable(71,'float'),3)) + " °C") print("IIB IGBT Leg 2 Temp: " + str(round(self.read_bsmp_variable(72,'float'),3)) + " °C") print("IIB Inductor Temp: " + str(round(self.read_bsmp_variable(73,'float'),3)) + " °C") print("IIB Heat-Sink Temp: " + str(round(self.read_bsmp_variable(74,'float'),3)) + " °C") print("IIB Driver Voltage: " + str(round(self.read_bsmp_variable(75,'float'),3)) + " V") print("IIB Driver Current 1: " + str(round(self.read_bsmp_variable(76,'float'),3)) + " A") print("IIB Driver Current 2: " + str(round(self.read_bsmp_variable(77,'float'),3)) + " A") print("IIB Board Temp: " + str(round(self.read_bsmp_variable(78,'float'),3)) + " °C") print("IIB Board RH: " + str(round(self.read_bsmp_variable(79,'float'),3)) + " %") iib_itlks = self.read_bsmp_variable(80,'uint32_t') print("\nIIB Interlocks: " + str(iib_itlks)) if(iib_itlks): self.decode_interlocks(iib_itlks, list_fac_2p4s_dcdc_iib_interlocks) iib_alarms = self.read_bsmp_variable(81,'uint32_t') print("IIB Alarms: " + str(iib_alarms)) if(iib_alarms): self.decode_interlocks(iib_alarms, list_fac_2p4s_dcdc_iib_alarms) time.sleep(dt) self.SetSlaveAdd(old_add) except: self.SetSlaveAdd(old_add) def read_vars_fap(self, n = 1, com_add = 1, dt = 0.5, iib = 1): old_add = self.GetSlaveAdd() try: for i in range(n): self.SetSlaveAdd(com_add) print('\n--- Measurement #' + str(i+1) + ' ------------------------------------------\n') self.read_vars_common() soft_itlks = self.read_bsmp_variable(31,'uint32_t') print("\nSoft Interlocks: " + str(soft_itlks)) if(soft_itlks): self.decode_interlocks(soft_itlks, list_fap_soft_interlocks) print('') hard_itlks = self.read_bsmp_variable(32,'uint32_t') print("Hard Interlocks: " + str(hard_itlks)) if(hard_itlks): self.decode_interlocks(hard_itlks, list_fap_hard_interlocks) iib_itlks = self.read_bsmp_variable(56,'uint32_t') print("\nIIB Interlocks: " + str(iib_itlks)) if(iib_itlks): self.decode_interlocks(iib_itlks, list_fap_iib_interlocks) iib_alarms = self.read_bsmp_variable(57,'uint32_t') print("\nIIB Alarms: " + str(iib_alarms)) if(iib_alarms): self.decode_interlocks(iib_alarms, list_fap_iib_alarms) iload = self.read_bsmp_variable(33,'float') print("\nLoad Current: " + str(round(iload,3)) + " A") print("Load Current DCCT 1: " + str(round(self.read_bsmp_variable(34,'float'),3)) + " A") print("Load Current DCCT 2: " + str(round(self.read_bsmp_variable(35,'float'),3)) + " A") if not iload == 0: print("\nLoad Resistance: " + str(abs(round(self.read_bsmp_variable(43,'float') / iload ,3))) + " Ohm") else: print("\nLoad Resistance: 0 Ohm") print("Load Power: " + str(abs(round(self.read_bsmp_variable(43,'float') * self.read_bsmp_variable(33,'float'),3))) + " W") print("\nDC-Link Voltage: " + str(round(self.read_bsmp_variable(36,'float'),3)) + " V") print("\nIGBT 1 Current: " + str(round(self.read_bsmp_variable(37,'float'),3)) + " A") print("IGBT 2 Current: " + str(round(self.read_bsmp_variable(38,'float'),3)) + " A") print("\nIGBT 1 Duty-Cycle: " + str(round(self.read_bsmp_variable(39,'float'),3)) + " %") print("IGBT 2 Duty-Cycle: " + str(round(self.read_bsmp_variable(40,'float'),3)) + " %") print("Differential Duty-Cycle: " + str(round(self.read_bsmp_variable(41,'float'),3)) + " %") if(iib): print("\nIIB Input Voltage: " + str(round(self.read_bsmp_variable(42,'float'),3)) + " V") print("IIB Output Voltage: " + str(round(self.read_bsmp_variable(43,'float'),3)) + " V") print("IIB IGBT 1 Current: " + str(round(self.read_bsmp_variable(44,'float'),3)) + " A") print("IIB IGBT 2 Current: " + str(round(self.read_bsmp_variable(45,'float'),3)) + " A") print("IIB IGBT 1 Temp: " + str(round(self.read_bsmp_variable(46,'float'),3)) + " °C") print("IIB IGBT 2 Temp: " + str(round(self.read_bsmp_variable(47,'float'),3)) + " °C") print("IIB Driver Voltage: " + str(round(self.read_bsmp_variable(48,'float'),3)) + " V") print("IIB Driver Current 1: " + str(round(self.read_bsmp_variable(49,'float'),3)) + " A") print("IIB Driver Current 2: " + str(round(self.read_bsmp_variable(50,'float'),3)) + " A") print("IIB Inductor Temp: " + str(round(self.read_bsmp_variable(51,'float'),3)) + " °C") print("IIB Heat-Sink Temp: " + str(round(self.read_bsmp_variable(52,'float'),3)) + " °C") print("IIB Ground Leakage Current: " + str(round(self.read_bsmp_variable(53,'float'),3)) + " A") print("IIB Board Temp: " + str(round(self.read_bsmp_variable(54,'float'),3)) + " °C") print("IIB Board RH: " + str(round(self.read_bsmp_variable(55,'float'),3)) + " %") print("IIB Interlocks: " + str(round(self.read_bsmp_variable(56,'uint32_t'),3))) print("IIB Alarms: " + str(round(self.read_bsmp_variable(57,'uint32_t'),3))) time.sleep(dt) self.SetSlaveAdd(old_add) except: self.SetSlaveAdd(old_add) def read_vars_fap_4p(self, n = 1, com_add = 1, dt = 0.5, iib = 0): old_add = self.GetSlaveAdd() iib_offset = 16*(iib-1) try: for i in range(n): self.SetSlaveAdd(com_add) print('\n--- Measurement #' + str(i+1) + ' ------------------------------------------\n') self.read_vars_common() soft_itlks = self.read_bsmp_variable(31,'uint32_t') print("\nSoft Interlocks: " + str(soft_itlks)) if(soft_itlks): self.decode_interlocks(soft_itlks, list_fap_4p_soft_interlocks) print('') hard_itlks = self.read_bsmp_variable(32,'uint32_t') print("Hard Interlocks: " + str(hard_itlks)) if(hard_itlks): self.decode_interlocks(hard_itlks, list_fap_4p_hard_interlocks) for j in range(4): iib_itlks = self.read_bsmp_variable(72 + j*16,'uint32_t') print("\nIIB " + str(j+1) + " Interlocks: " + str(iib_itlks)) if(iib_itlks): self.decode_interlocks(iib_itlks, list_fap_4p_iib_interlocks) iib_alarms = self.read_bsmp_variable(73 + j*16,'uint32_t') print("IIB " + str(j+1) + " Alarms: " + str(iib_alarms)) if(iib_alarms): self.decode_interlocks(iib_alarms, list_fap_4p_iib_alarms) print("\n Mean Load Current: " + str(round(self.read_bsmp_variable(33,'float'),3)) + " A") print("Load Current 1: " + str(round(self.read_bsmp_variable(34,'float'),3)) + " A") print("Load Current 2: " + str(round(self.read_bsmp_variable(35,'float'),3)) + " A") print("Load Voltage: " + str(round(self.read_bsmp_variable(36,'float'),3)) + " V") print("\nIGBT 1 Current Mod 1: " + str(round(self.read_bsmp_variable(37,'float'),3)) + " A") print("IGBT 2 Current Mod 1: " + str(round(self.read_bsmp_variable(38,'float'),3)) + " A") print("IGBT 1 Current Mod 2: " + str(round(self.read_bsmp_variable(39,'float'),3)) + " A") print("IGBT 2 Current Mod 2: " + str(round(self.read_bsmp_variable(40,'float'),3)) + " A") print("IGBT 1 Current Mod 3: " + str(round(self.read_bsmp_variable(41,'float'),3)) + " A") print("IGBT 2 Current Mod 3: " + str(round(self.read_bsmp_variable(42,'float'),3)) + " A") print("IGBT 1 Current Mod 4: " + str(round(self.read_bsmp_variable(43,'float'),3)) + " A") print("IGBT 2 Current Mod 4: " + str(round(self.read_bsmp_variable(44,'float'),3)) + " A") print("\nDC-Link Voltage Mod 1: " + str(round(self.read_bsmp_variable(45,'float'),3)) + " V") print("DC-Link Voltage Mod 2: " + str(round(self.read_bsmp_variable(46,'float'),3)) + " V") print("DC-Link Voltage Mod 3: " + str(round(self.read_bsmp_variable(47,'float'),3)) + " V") print("DC-Link Voltage Mod 4: " + str(round(self.read_bsmp_variable(48,'float'),3)) + " V") print("\nMean Duty-Cycle: " + str(round(self.read_bsmp_variable(49,'float'),3)) + " %") print("IGBT 1 Duty-Cycle Mod 1: " + str(round(self.read_bsmp_variable(50,'float'),3)) + " %") print("IGBT 2 Duty-Cycle Mod 1: " + str(round(self.read_bsmp_variable(51,'float'),3)) + " %") print("IGBT 1 Duty-Cycle Mod 2: " + str(round(self.read_bsmp_variable(52,'float'),3)) + " %") print("IGBT 2 Duty-Cycle Mod 2: " + str(round(self.read_bsmp_variable(53,'float'),3)) + " %") print("IGBT 1 Duty-Cycle Mod 3: " + str(round(self.read_bsmp_variable(54,'float'),3)) + " %") print("IGBT 2 Duty-Cycle Mod 3: " + str(round(self.read_bsmp_variable(55,'float'),3)) + " %") print("IGBT 1 Duty-Cycle Mod 4: " + str(round(self.read_bsmp_variable(56,'float'),3)) + " %") print("IGBT 2 Duty-Cycle Mod 4: " + str(round(self.read_bsmp_variable(57,'float'),3)) + " %") if not iib == 0: print("\nIIB " + str(iib) + " Input Voltage: " + str(round(self.read_bsmp_variable(58 + iib_offset,'float'),3)) + " V") print("IIB " + str(iib) + " Output Voltage: " + str(round(self.read_bsmp_variable(59 + iib_offset,'float'),3)) + " V") print("IIB " + str(iib) + " IGBT 1 Current: " + str(round(self.read_bsmp_variable(60 + iib_offset,'float'),3)) + " A") print("IIB " + str(iib) + " IGBT 2 Current: " + str(round(self.read_bsmp_variable(61 + iib_offset,'float'),3)) + " A") print("IIB " + str(iib) + " IGBT 1 Temp: " + str(round(self.read_bsmp_variable(62 + iib_offset,'float'),3)) + " °C") print("IIB " + str(iib) + " IGBT 2 Temp: " + str(round(self.read_bsmp_variable(63 + iib_offset,'float'),3)) + " °C") print("IIB " + str(iib) + " Driver Voltage: " + str(round(self.read_bsmp_variable(64 + iib_offset,'float'),3)) + " V") print("IIB " + str(iib) + " Driver Current 1: " + str(round(self.read_bsmp_variable(65 + iib_offset,'float'),3)) + " A") print("IIB " + str(iib) + " Driver Current 2: " + str(round(self.read_bsmp_variable(66 + iib_offset,'float'),3)) + " A") print("IIB " + str(iib) + " Inductor Temp: " + str(round(self.read_bsmp_variable(67 + iib_offset,'float'),3)) + " °C") print("IIB " + str(iib) + " Heat-Sink Temp: " + str(round(self.read_bsmp_variable(68 + iib_offset,'float'),3)) + " °C") print("IIB " + str(iib) + " Ground Leakage Current: " + str(round(self.read_bsmp_variable(69 + iib_offset,'float'),3)) + " A") print("IIB " + str(iib) + " Board Temp: " + str(round(self.read_bsmp_variable(70 + iib_offset,'float'),3)) + " °C") print("IIB " + str(iib) + " Board RH: " + str(round(self.read_bsmp_variable(71 + iib_offset,'float'),3)) + " %") print("IIB " + str(iib) + " Interlocks: " + str(round(self.read_bsmp_variable(72 + iib_offset,'uint32_t'),3))) print("IIB " + str(iib) + " Alarms: " + str(round(self.read_bsmp_variable(73 + iib_offset,'uint32_t'),3))) time.sleep(dt) self.SetSlaveAdd(old_add) except Exception as e: print(e) self.SetSlaveAdd(old_add) def read_vars_fap_2p2s(self, n = 1, com_add = 1, dt = 0.5, iib = 0): old_add = self.GetSlaveAdd() iib_offset = 16*(iib-1) try: for i in range(n): self.SetSlaveAdd(com_add) print('\n--- Measurement #' + str(i+1) + ' ------------------------------------------\n') self.read_vars_common() soft_itlks = self.read_bsmp_variable(31,'uint32_t') print("\nSoft Interlocks: " + str(soft_itlks)) if(soft_itlks): self.decode_interlocks(soft_itlks, list_fap_2p2s_soft_interlocks) print('') hard_itlks = self.read_bsmp_variable(32,'uint32_t') print("Hard Interlocks: " + str(hard_itlks)) if(hard_itlks): self.decode_interlocks(hard_itlks, list_fap_2p2s_hard_interlocks) for j in range(4): iib_itlks = self.read_bsmp_variable(78 + j*16,'uint32_t') print("\nIIB " + str(j+1) + " Interlocks: " + str(iib_itlks)) if(iib_itlks): self.decode_interlocks(iib_itlks, list_fap_4p_iib_interlocks) iib_alarms = self.read_bsmp_variable(79 + j*16,'uint32_t') print("IIB " + str(j+1) + " Alarms: " + str(iib_alarms)) if(iib_alarms): self.decode_interlocks(iib_alarms, list_fap_4p_iib_alarms) print("\nMean Load Current: " + str(round(self.read_bsmp_variable(33,'float'),3)) + " A") print("Load Current 1: " + str(round(self.read_bsmp_variable(34,'float'),3)) + " A") print("Load Current 2: " + str(round(self.read_bsmp_variable(35,'float'),3)) + " A") print("\nArm Current 1: " + str(round(self.read_bsmp_variable(36,'float'),3)) + " A") print("Arm Current 2: " + str(round(self.read_bsmp_variable(37,'float'),3)) + " A") print("\nIGBT 1 Current Mod 1: " + str(round(self.read_bsmp_variable(38,'float'),3)) + " A") print("IGBT 2 Current Mod 1: " + str(round(self.read_bsmp_variable(39,'float'),3)) + " A") print("IGBT 1 Current Mod 2: " + str(round(self.read_bsmp_variable(40,'float'),3)) + " A") print("IGBT 2 Current Mod 2: " + str(round(self.read_bsmp_variable(41,'float'),3)) + " A") print("IGBT 1 Current Mod 3: " + str(round(self.read_bsmp_variable(42,'float'),3)) + " A") print("IGBT 2 Current Mod 3: " + str(round(self.read_bsmp_variable(43,'float'),3)) + " A") print("IGBT 1 Current Mod 4: " + str(round(self.read_bsmp_variable(44,'float'),3)) + " A") print("IGBT 2 Current Mod 4: " + str(round(self.read_bsmp_variable(45,'float'),3)) + " A") print("\nDC-Link Voltage Mod 1: " + str(round(self.read_bsmp_variable(50,'float'),3)) + " V") print("DC-Link Voltage Mod 2: " + str(round(self.read_bsmp_variable(51,'float'),3)) + " V") print("DC-Link Voltage Mod 3: " + str(round(self.read_bsmp_variable(52,'float'),3)) + " V") print("DC-Link Voltage Mod 4: " + str(round(self.read_bsmp_variable(53,'float'),3)) + " V") print("\nMean Duty-Cycle: " + str(round(self.read_bsmp_variable(54,'float'),3)) + " %") print("Differential Duty-Cycle: " + str(round(self.read_bsmp_variable(55,'float'),3)) + " %") print("\nIGBT 1 Duty-Cycle Mod 1: " + str(round(self.read_bsmp_variable(56,'float'),3)) + " %") print("IGBT 2 Duty-Cycle Mod 1: " + str(round(self.read_bsmp_variable(57,'float'),3)) + " %") print("IGBT 1 Duty-Cycle Mod 2: " + str(round(self.read_bsmp_variable(58,'float'),3)) + " %") print("IGBT 2 Duty-Cycle Mod 2: " + str(round(self.read_bsmp_variable(59,'float'),3)) + " %") print("IGBT 1 Duty-Cycle Mod 3: " + str(round(self.read_bsmp_variable(60,'float'),3)) + " %") print("IGBT 2 Duty-Cycle Mod 3: " + str(round(self.read_bsmp_variable(61,'float'),3)) + " %") print("IGBT 1 Duty-Cycle Mod 4: " + str(round(self.read_bsmp_variable(62,'float'),3)) + " %") print("IGBT 2 Duty-Cycle Mod 4: " + str(round(self.read_bsmp_variable(63,'float'),3)) + " %") if not iib == 0: print("\nIIB " + str(iib) + " Input Voltage: " + str(round(self.read_bsmp_variable(64 + iib_offset,'float'),3)) + " V") print("IIB " + str(iib) + " Output Voltage: " + str(round(self.read_bsmp_variable(65 + iib_offset,'float'),3)) + " V") print("IIB " + str(iib) + " IGBT 1 Current: " + str(round(self.read_bsmp_variable(66 + iib_offset,'float'),3)) + " A") print("IIB " + str(iib) + " IGBT 2 Current: " + str(round(self.read_bsmp_variable(67 + iib_offset,'float'),3)) + " A") print("IIB " + str(iib) + " IGBT 1 Temp: " + str(round(self.read_bsmp_variable(68 + iib_offset,'float'),3)) + " °C") print("IIB " + str(iib) + " IGBT 2 Temp: " + str(round(self.read_bsmp_variable(69 + iib_offset,'float'),3)) + " °C") print("IIB " + str(iib) + " Driver Voltage: " + str(round(self.read_bsmp_variable(70 + iib_offset,'float'),3)) + " V") print("IIB " + str(iib) + " Driver Current 1: " + str(round(self.read_bsmp_variable(71 + iib_offset,'float'),3)) + " A") print("IIB " + str(iib) + " Driver Current 2: " + str(round(self.read_bsmp_variable(72 + iib_offset,'float'),3)) + " A") print("IIB " + str(iib) + " Inductor Temp: " + str(round(self.read_bsmp_variable(73 + iib_offset,'float'),3)) + " °C") print("IIB " + str(iib) + " Heat-Sink Temp: " + str(round(self.read_bsmp_variable(74 + iib_offset,'float'),3)) + " °C") print("IIB " + str(iib) + " Ground Leakage Current: " + str(round(self.read_bsmp_variable(75 + iib_offset,'float'),3)) + " A") print("IIB " + str(iib) + " Board Temp: " + str(round(self.read_bsmp_variable(76 + iib_offset,'float'),3)) + " °C") print("IIB " + str(iib) + " Board RH: " + str(round(self.read_bsmp_variable(77 + iib_offset,'float'),3)) + " %") print("IIB " + str(iib) + " Interlocks: " + str(round(self.read_bsmp_variable(78 + iib_offset,'uint32_t'),3))) print("IIB " + str(iib) + " Alarms: " + str(round(self.read_bsmp_variable(79 + iib_offset,'uint32_t'),3))) time.sleep(dt) self.SetSlaveAdd(old_add) except Exception as e: print(e) self.SetSlaveAdd(old_add) def read_vars_fap_225A(self, n = 1, com_add = 1, dt = 0.5): old_add = self.GetSlaveAdd() try: for i in range(n): self.SetSlaveAdd(com_add) print('\n--- Measurement #' + str(i+1) + ' ------------------------------------------\n') self.read_vars_common() soft_itlks = self.read_bsmp_variable(31,'uint32_t') print("\nSoft Interlocks: " + str(soft_itlks)) if(soft_itlks): self.decode_interlocks(soft_itlks, list_fap_225A_soft_interlocks) print('') hard_itlks = self.read_bsmp_variable(32,'uint32_t') print("Hard Interlocks: " + str(hard_itlks)) if(hard_itlks): self.decode_interlocks(hard_itlks, list_fap_225A_hard_interlocks) print("\nLoad Current: " + str(round(self.read_bsmp_variable(33,'float'),3)) + " A") print("\nIGBT 1 Current: " + str(round(self.read_bsmp_variable(34,'float'),3)) + " A") print("IGBT 2 Current: " + str(round(self.read_bsmp_variable(35,'float'),3)) + " A") print("\nIGBT 1 Duty-Cycle: " + str(round(self.read_bsmp_variable(36,'float'),3)) + " %") print("IGBT 2 Duty-Cycle: " + str(round(self.read_bsmp_variable(37,'float'),3)) + " %") print("Differential Duty-Cycle: " + str(round(self.read_bsmp_variable(38,'float'),3)) + " %") time.sleep(dt) self.SetSlaveAdd(old_add) except: self.SetSlaveAdd(old_add) def read_vars_fbp_2s_ufjf(self, n = 1, com_add = 1, dt = 0.5): old_add = self.GetSlaveAdd() try: for i in range(n): self.SetSlaveAdd(com_add) print('\n--- Measurement #' + str(i+1) + ' ------------------------------------------\n') self.read_vars_common() soft_itlks = self.read_bsmp_variable(31,'uint32_t') print("\nSoft Interlocks: " + str(soft_itlks)) if(soft_itlks): self.decode_interlocks(soft_itlks, list_fbp_soft_interlocks) print('') hard_itlks = self.read_bsmp_variable(32,'uint32_t') print("Hard Interlocks: " + str(hard_itlks)) if(hard_itlks): self.decode_interlocks(hard_itlks, list_fbp_hard_interlocks) print("\nLoad Current: " + str(round(self.read_bsmp_variable(33,'float'),3)) + " A") print("Load Error: " + str(round(self.read_bsmp_variable(34,'float'),3)) + " A") print("\nMod 1 Load Voltage: " + str(round(self.read_bsmp_variable(36,'float'),3)) + " V") print("Mod 3 Load Voltage: " + str(round(self.read_bsmp_variable(40,'float'),3)) + " V") #print("\nMod 1 DC-Link Voltage: " + str(round(self.read_bsmp_variable(29,'float'),3)) + " V") #print("Mod 1 Temperature: " + str(round(self.read_bsmp_variable(31,'float'),3)) + " °C") #print("\nMod 3 DC-Link Voltage: " + str(round(self.read_bsmp_variable(33,'float'),3)) + " V") #print("Mod 3 Temperature: " + str(round(self.read_bsmp_variable(35,'float'),3)) + " °C") print("\nMod 1 Duty-Cycle: " + str(round(self.read_bsmp_variable(32,'float'),3)) + " %") print("Mod 3 Duty-Cycle: " + str(round(self.read_bsmp_variable(36,'float'),3)) + " %") time.sleep(dt) self.SetSlaveAdd(old_add) except: self.SetSlaveAdd(old_add) def read_vars_fac_2p_acdc_imas(self, n = 1, add_mod_a = 2, dt = 0.5, iib = 0): old_add = self.GetSlaveAdd() try: for i in range(n): self.SetSlaveAdd(add_mod_a) print('\n--- Measurement #' + str(i+1) + ' ------------------------------------------\n') self.read_vars_common() print('\n *** MODULE A ***') soft_itlks = self.read_bsmp_variable(31,'uint32_t') print("\nSoft Interlocks: " + str(soft_itlks)) if(soft_itlks): self.decode_interlocks(soft_itlks, list_fac_2p_acdc_imas_soft_interlocks) print('') hard_itlks = self.read_bsmp_variable(32,'uint32_t') print("Hard Interlocks: " + str(hard_itlks)) if(hard_itlks): self.decode_interlocks(hard_itlks, list_fac_2p_acdc_imas_hard_interlocks) print("\nCapBank Voltage: " + str(round(self.read_bsmp_variable(33,'float'),3)) + " V") print("Rectifier Current: " + str(round(self.read_bsmp_variable(34,'float'),3)) + " A") print("Duty-Cycle: " + str(round(self.read_bsmp_variable(35,'float'),3)) + " %") self.SetSlaveAdd(add_mod_a+1) print('\n *** MODULE B ***') soft_itlks = self.read_bsmp_variable(31,'uint32_t') print("\nSoft Interlocks: " + str(soft_itlks)) if(soft_itlks): self.decode_interlocks(soft_itlks, list_fac_2p_acdc_imas_soft_interlocks) print('') hard_itlks = self.read_bsmp_variable(32,'uint32_t') print("Hard Interlocks: " + str(hard_itlks)) if(hard_itlks): self.decode_interlocks(hard_itlks, list_fac_2p_acdc_imas_hard_interlocks) print("\nCapBank Voltage: " + str(round(self.read_bsmp_variable(33,'float'),3)) + " V") print("Rectifier Current: " + str(round(self.read_bsmp_variable(34,'float'),3)) + " A") print("Duty-Cycle: " + str(round(self.read_bsmp_variable(35,'float'),3)) + " %") time.sleep(dt) self.SetSlaveAdd(old_add) except: self.SetSlaveAdd(old_add) raise def read_vars_fac_2p_dcdc_imas(self, n = 1, com_add = 1, dt = 0.5, iib = 0): old_add = self.GetSlaveAdd() try: for i in range(n): self.SetSlaveAdd(com_add) print('\n--- Measurement #' + str(i+1) + ' ------------------------------------------\n') self.read_vars_common() print("\nSync Pulse Counter: " + str(round(self.read_bsmp_variable(5,'uint32_t'),3))) soft_itlks = self.read_bsmp_variable(31,'uint32_t') print("\nSoft Interlocks: " + str(soft_itlks)) if(soft_itlks): self.decode_interlocks(soft_itlks, list_fac_2p_dcdc_imas_soft_interlocks) print('') hard_itlks = self.read_bsmp_variable(32,'uint32_t') print("Hard Interlocks: " + str(hard_itlks)) if(hard_itlks): self.decode_interlocks(hard_itlks, list_fac_2p_dcdc_imas_hard_interlocks) print("\nLoad Current: " + str(round(self.read_bsmp_variable(33,'float'),3)) + ' A') print("Load Current Error: " + str(round(self.read_bsmp_variable(34,'float'),3)) + ' A') print("\nArm 1 Current: " + str(round(self.read_bsmp_variable(35,'float'),3)) + ' A') print("Arm 2 Current: " + str(round(self.read_bsmp_variable(36,'float'),3)) + ' A') print("Arms Current Diff: " + str(round(self.read_bsmp_variable(37,'float'),3)) + ' A') print("\nCapBank Voltage 1: " + str(round(self.read_bsmp_variable(38,'float'),3)) + ' V') print("CapBank Voltage 2: " + str(round(self.read_bsmp_variable(39,'float'),3)) + ' V') print("\nDuty-Cycle 1: " + str(round(self.read_bsmp_variable(40,'float'),3)) + ' %') print("Duty-Cycle 2: " + str(round(self.read_bsmp_variable(41,'float'),3)) + ' %') print("Differential Duty-Cycle: " + str(round(self.read_bsmp_variable(42,'float'),3)) + ' %') time.sleep(dt) self.SetSlaveAdd(old_add) except: self.SetSlaveAdd(old_add) raise def check_param_bank(self, param_file): fbp_param_list = [] max_sampling_freq = 600000 c28_sysclk = 150e6 with open(param_file,newline='') as f: reader = csv.reader(f) for row in reader: fbp_param_list.append(row) for param in fbp_param_list: if str(param[0]) == 'Num_PS_Modules' and param[1] > 4: print("Invalid " + str(param[0]) + ": " + str(param[1]) + ". Maximum is 4") elif str(param[0]) == 'Freq_ISR_Controller' and param[1] > 6000000: print("Invalid " + str(param[0]) + ": " + str(param[1]) + ". Maximum is 4" ) else: for n in range(64): try: print(str(param[0]) + "["+ str(n) + "]: " + str(param[n+1])) print(self.set_param(str(param[0]),n,float(param[n+1]))) except: break def set_param_bank(self, param_file): fbp_param_list = [] with open(param_file,newline='') as f: reader = csv.reader(f) for row in reader: fbp_param_list.append(row) for param in fbp_param_list: if str(param[0]) == 'PS_Name': print(str(param[0]) + "[0]: " + str(param[1])) print(self.set_ps_name(str(param[1]))) else: for n in range(64): try: print(str(param[0]) + "["+ str(n) + "]: " + str(param[n+1])) print(self.set_param(str(param[0]),n,float(param[n+1]))) except: break #self.save_param_bank() def get_default_ramp_waveform(self, interval=500, nrpts=4000, ti=None, fi=None, forms=None): from siriuspy.magnet.util import get_default_ramp_waveform return get_default_ramp_waveform(interval, nrpts, ti, fi, forms) def save_ramp_waveform(self, ramp): filename = input('Digite o nome do arquivo: ') with open( filename + '.csv', 'w', newline='') as f: writer = csv.writer(f, delimiter=';') writer.writerow(ramp) def save_ramp_waveform_col(self, ramp): filename = input('Digite o nome do arquivo: ') with open( filename + '.csv', 'w', newline='') as f: writer = csv.writer(f) for val in ramp: writer.writerow([val]) def read_vars_fac_n(self, n = 1, dt = 0.5): old_add = self.GetSlaveAdd() try: for i in range(n): print('\n--- Measurement #' + str(i+1) + ' ------------------------------------------\n') self.SetSlaveAdd(1) self.read_vars_fac_dcdc() print('\n-----------------------\n') self.SetSlaveAdd(2) self.read_vars_fac_acdc() time.sleep(dt) self.SetSlaveAdd(old_add) except: self.SetSlaveAdd(old_add) def get_step_buffer_fbp_ufjf(self, net1, net2, i_0, i_f, dly): self.set_param('Analog_Var_Max',4,net1) self.set_param('Analog_Var_Max',5,net2) self.set_slowref(i_0) time.sleep(0.5) self.enable_buf_samples() time.sleep(dly) self.set_slowref(i_f) self.disable_buf_samples() buf = self.read_buf_samples_ctom() buf1 = buf[0:4096:2] buf2 = buf[1:4096:2] fig = plt.figure() ax1 = fig.add_subplot(2,1,1) ax2 = fig.add_subplot(2,1,2) ax1.plot(buf1) ax1.grid() ax2.plot(buf2) ax2.grid() fig.show() return [buf1,buf2] def set_buf_samples_freq(self, fs): self.set_param('Freq_TimeSlicer',1,fs) self.save_param_eeprom('Freq_TimeSlicer',1) self.reset_udc() def calc_pi(self, r_load, l_load, f_bw, v_dclink, send_drs = 0, dsp_id = 0): kp = 2*3.1415*f_bw*l_load/v_dclink ki = kp*r_load/l_load print('\n Kp = ' + str(kp)) print(' Ki = ' + str(ki) + '\n') if send_drs: self.set_dsp_coeffs(3,dsp_id,[kp,ki,0.95,-0.95]) return [kp,ki] def config_dsp_modules_drs_fap_tests(self): kp_load = 0 ki_load = 20.95 kp_share = 0.000032117 ki_share = 0.0012 drs.set_dsp_coeffs(3,0,[kp_load,ki_load,0.6,0]) drs.set_dsp_coeffs(3,1,[kp_share,ki_share,0.0015,-0.0015]) drs.save_dsp_modules_eeprom() def set_prbs_sampling_freq(self,freq, type_memory): self.set_param('Freq_TimeSlicer',0,freq) self.set_param('Freq_TimeSlicer',1,freq) self.save_param_bank(type_memory) def get_dsp_modules_bank(self, list_dsp_classes = [1,2,3,4,5,6], print_modules = 1): dsp_modules_bank = [] for dsp_class in list_dsp_classes: for dsp_id in range(num_dsp_modules[dsp_class]): dsp_module = [dsp_classes_names[dsp_class], dsp_class, dsp_id] for dsp_coeff in range(num_coeffs_dsp_modules[dsp_class]): try: coeff = self.get_dsp_coeff(dsp_class,dsp_id,dsp_coeff) if dsp_class == 3 and dsp_coeff == 1: coeff *= self.get_param('Freq_ISR_Controller',0) dsp_module.append(coeff) except: dsp_module.append('nan') dsp_modules_bank.append(dsp_module) if(print_modules): print(dsp_module) return dsp_modules_bank def store_dsp_modules_bank_csv(self, bank): filename = input('Digite o nome do arquivo: ') with open( filename + '.csv', 'w', newline='') as f: writer = csv.writer(f, delimiter=',') for dsp_module in bank: writer.writerow(dsp_module) def set_dsp_modules_bank(self, dsp_modules_file, save_eeprom = 0): dsp_modules_row = [] with open(dsp_modules_file,newline='') as f: reader = csv.reader(f) for dsp_module in reader: if not dsp_module == []: if not dsp_module[0][0] == '#': list_coeffs = [] for coeff in dsp_module[3:3+num_coeffs_dsp_modules[int(dsp_module[1])]]: list_coeffs.append(float(coeff)) print(str(int(dsp_module[1])) + ' ' + str(int(dsp_module[2])) + ' ' + str(list_coeffs)) self.set_dsp_coeffs(int(dsp_module[1]),int(dsp_module[2]),list_coeffs) if(save_eeprom): self.save_dsp_modules_eeprom() else: print('\n *** Aviso: Os coeficientes configurados não foram salvos na memória EEPROM. Caso deseje salvar, utilize o argumento save_eeprom = 1') def set_param_bank(self, param_file): fbp_param_list = [] with open(param_file,newline='') as f: reader = csv.reader(f) for row in reader: fbp_param_list.append(row) for param in fbp_param_list: if str(param[0]) == 'PS_Name': print(str(param[0]) + "[0]: " + str(param[1])) print(self.set_ps_name(str(param[1]))) else: for n in range(64): try: print(str(param[0]) + "["+ str(n) + "]: " + str(param[n+1])) print(self.set_param(str(param[0]),n,float(param[n+1]))) except: break #self.save_param_bank() def select_param_bank(self, cfg_dsp_modules = 0): add = int(input('\n Digite o endereco serial atual do controlador a ser configurado: ')) oldadd = self.GetSlaveAdd() self.SetSlaveAdd(add) areas = ['IA','LA','PA'] ps_models = ['fbp','fbp_dclink','fap','fap_4p','fap_2p4s','fac','fac_2s'] ps_folders = ['fbp','fbp_dclink','fap','fap',] la_fap = ['TB-Fam:PS-B','TS-01:PS-QF1A','TS-01:PS-QF1B','TS-02:PS-QD2', 'TS-02:PS-QF2','TS-03:PS-QF3','TS-04:PS-QD4A','TS-04:PS-QD4B', 'TS-04:PS-QF4'] print('\n Selecione area: \n') print(' 0: Sala de racks') print(' 1: Linhas de transporte') print(' 2: Sala de fontes\n') area = int(input(' Digite o numero correspondente: ')) if area == 0: sector = input('\n Digite o setor da sala de racks [1 a 20]: ') if int(sector) < 10: sector = '0' + sector rack = input('\n Escolha o rack em que a fonte se encontra [1/2/3]: ') #if (rack != '1') and (rack != '2'): if not ((rack == '1') or (rack == '2') or (sector == '09' and rack == '3')): print(' \n *** RACK INEXISTENTE ***\n') return print('\n Escolha o tipo de fonte: \n') print(' 0: FBP') print(' 1: FBP-DCLink\n') ps_model = int(input(' Digite o numero correspondente: ')) if ps_model == 0: crate = '_crate_' + input('\n Digite a posicao do bastidor, de cima para baixo. Leve em conta os bastidores que ainda nao foram instalados : ') elif ps_model == 1: crate = '' else: print(' \n *** TIPO DE FONTE INEXISTENTE ***\n') return file_dir = '../ps_parameters/IA-' + sector + '/' + ps_models[ps_model] + '/' file_name = 'parameters_' + ps_models[ps_model] + '_IA-' + sector + 'RaPS0' + rack + crate + '.csv' file_path = file_dir + file_name print('\n Banco de parametros a ser utilizado: ' + file_path) elif area == 1: print('\n Escolha o tipo de fonte: \n') print(' 0: FBP') print(' 1: FBP-DCLink') print(' 2: FAP\n') ps_model = int(input(' Digite o numero correspondente: ')) if ps_model == 0 or ps_model == 1: crate = input('\n Digite a posicao do bastidor, de cima para baixo. Leve em conta os bastidores que ainda nao foram instalados : ') ps_name = '_LA-RaPS06_crate_' + crate file_dir = '../ps_parameters/LA/' + ps_models[ps_model] + '/' file_name = 'parameters_' + ps_models[ps_model] + ps_name + '.csv' file_path = file_dir + file_name elif ps_model == 2: ps_list = [] file_dir = '../ps_parameters/LA/fap/' for entry in os.listdir(file_dir): if os.path.isfile(os.path.join(file_dir, entry)): ps_list.append(entry) print('\n ### Lista de fontes FAP da linha de transporte ### \n') for idx, ps in enumerate(ps_list): print(' ' + str(idx) + ': ' + ps) ps_idx = int(input('\n Escolha o índice da fonte correspondente: ')) file_path = file_dir + ps_list[ps_idx] else: print(' \n *** TIPO DE FONTE INEXISTENTE ***\n') return print('\n Banco de parametros a ser utilizado: ' + file_path) elif area == 2: print('\n Escolha o tipo de fonte: \n') print(' 0: FAC') print(' 1: FAP\n') ps_model = int(input(' Digite o numero correspondente: ')) if ps_model == 0: ps_list = [] file_dir = '../ps_parameters/PA/fac/' for entry in os.listdir(file_dir): if os.path.isfile(os.path.join(file_dir, entry)): ps_list.append(entry) print('\n ### Lista de bastidores de controle FAC da sala de fontes ### \n') for idx, ps in enumerate(ps_list): print(' ', idx, ': ', ps) ps_idx = int(input('\n Escolha o índice da fonte correspondente: ')) file_path = file_dir + ps_list[ps_idx] elif ps_model == 1: ps_list = [] file_dir = '../ps_parameters/PA/fap/' for entry in os.listdir(file_dir): if os.path.isfile(os.path.join(file_dir, entry)): ps_list.append(entry) print('\n ### Lista de bastidores de controle FAP da sala de fontes ### \n') for idx, ps in enumerate(ps_list): print(' ', idx, ': ', ps) ps_idx = int(input('\n Escolha o índice da fonte correspondente: ')) file_path = file_dir + ps_list[ps_idx] else: print(' \n *** TIPO DE FONTE INEXISTENTE ***\n') return print('\n Banco de parametros a ser utilizado: ' + file_path) else: print(' \n *** SALA INEXISTENTE ***\n') return r = input('\n Tem certeza que deseja prosseguir? [Y/N]: ') if (r != 'Y') and (r != 'y'): print(' \n *** OPERAÇÃO CANCELADA ***\n') return self.SetSlaveAdd(add) if ps_model == 0 and cfg_dsp_modules == 1: print('\n Enviando parametros de controle para controlador ...') dsp_file_dir = '../dsp_parameters/IA-' + sector + '/' + ps_models[ps_model] + '/' dsp_file_name = 'dsp_parameters_' + ps_models[ps_model] + '_IA-' + sector + 'RaPS0' + rack + crate + '.csv' dsp_file_path = dsp_file_dir + dsp_file_name self.set_dsp_modules_bank(dsp_file_path) print('\n Gravando parametros de controle na memoria ...') time.sleep(1) self.save_dsp_modules_eeprom() print('\n Enviando parametros de operacao para controlador ...\n') time.sleep(1) self.set_param_bank(file_path) print('\n Gravando parametros de operacao na memoria EEPROM onboard ...') self.save_param_bank(2) time.sleep(5) print('\n Resetando UDC ...') self.reset_udc() time.sleep(2) print('\n Pronto! Não se esqueça de utilizar o novo endereço serial para se comunicar com esta fonte! :)\n') self.SetSlaveAdd(oldadd) def get_siggen_vars(self): print('\n### SigGen Variables ###\n') print('Enable: ' + str((round(self.read_bsmp_variable(6,'uint16_t'),3)))) print('Type: ' + ListSigGenTypes_v2_1[int(round(self.read_bsmp_variable(7,'uint16_t'),3))]) print('Num Cycles: ' + str(round(self.read_bsmp_variable(8,'uint16_t'),3))) print('Index: ' + str(round(self.read_bsmp_variable(9,'float'),3))) print('Frequency: ' + str(round(self.read_bsmp_variable(10,'float'),3))) print('Amplitude: ' + str(round(self.read_bsmp_variable(11,'float'),3))) print('Offset: ' + str(round(self.read_bsmp_variable(12,'float'),3))) self.read_var(self.index_to_hex(13)) reply_msg = self.ser.read(21) val = struct.unpack('BBHffffB',reply_msg) print('Aux Param 0: ' + str(val[3])) print('Aux Param 1: ' + str(val[4])) print('Aux Param 2: ' + str(val[5])) print('Aux Param 3: ' + str(val[6])) def firmware_initialization(self): print("\n ### Inicialização de firmware ### \n") print("\n Lendo status...") print(self.read_ps_status()) print("\n Lendo versão de firmware...") self.read_udc_version() print("\n Desbloqueando UDC...") print(self.unlock_udc(0xFFFF)) print("\n Habilitando EEPROM onboard...") self.enable_onboard_eeprom() print("\n Alterando senha...") print(self.set_param('Password',0,0xCAFE)) print(self.save_param_eeprom('Password',0,2)) print("\n Configurando banco de parâmetros...") self.select_param_bank() print("\n ### Fim da inicialização de firmware ### \n") def cfg_hensys_ps_model(self): list_files = ['fbp_dclink/parameters_fbp_dclink_hensys.csv', 'fac/parameters_fac_acdc_hensys.csv', 'fac/parameters_fac_dcdc_hensys.csv', 'fac/parameters_fac_2s_acdc_hensys.csv', 'fac/parameters_fac_2s_dcdc_hensys.csv', 'fac/parameters_fac_2p4s_acdc_hensys.csv', 'fac/parameters_fac_2p4s_dcdc_hensys.csv', 'fap/parameters_fap_hensys.csv', 'fap/parameters_fap_2p2s_hensys.csv', 'fap/parameters_fap_4p_hensys.csv'] print('\n Desbloqueando UDC ...') print(self.unlock_udc(0xCAFE)) print('\n *** Escolha o modelo de fonte a ser configurado ***\n') print(' 0: FBP-DClink') print(' 1: FAC-ACDC') print(' 2: FAC-DCDC') print(' 3: FAC-2S-ACDC') print(' 4: FAC-2S-DCDC') print(' 5: FAC-2P4S-ACDC') print(' 6: FAC-2P4S-DCDC') print(' 7: FAP') print(' 8: FAP-2P2S') print(' 9: FAP-4P') model_idx = int(input('\n Digite o índice correspondente: ')) file_path = '../ps_parameters/development/' + list_files[model_idx] print('\n Banco de parametros a ser utilizado: ' + file_path) r = input('\n Tem certeza que deseja prosseguir? [Y/N]: ') if (r != 'Y') and (r != 'y'): print(' \n *** OPERAÇÃO CANCELADA ***\n') return print('\n Enviando parametros de operacao para controlador ...\n') time.sleep(1) self.set_param_bank(file_path) print('\n Gravando parametros de operacao na memoria EEPROM onboard ...') self.save_param_bank(2) time.sleep(5) print('\n Resetando UDC ...') self.reset_udc() time.sleep(2) print('\n Pronto! Nao se esqueca de utilizar o novo endereco serial para se comunicar com esta fonte! :)\n') def test_bid_board(self, password): r = input("\n Antes de iniciar, certifique-se que o bastidor foi energizado sem a placa BID.\n Para prosseguir, conecte a placa BID a ser testada e pressione qualquer tecla... ") print("\n Desbloqueando UDC ...") print(self.unlock_udc(password)) print("\n Carregando banco de parametros da memoria onboard ...") print(self.load_param_bank(type_memory = 2)) print("\n Banco de parametros da memoria onboard:\n") max_param = ListParameters.index('Scope_Source') param_bank_onboard = [] for param in ListParameters[0:max_param]: val = self.get_param(param,0) print(param + ':',val) param_bank_onboard.append(val) print("\n Salvando banco de parametros na memoria offboard ...") print(self.save_param_bank(type_memory = 1)) time.sleep(5) print("\n Resetando UDC ...") self.reset_udc() time.sleep(3) self.read_ps_status() print("\n Desbloqueando UDC ...") print(self.unlock_udc(password)) print("\n Carregando banco de parametros da memoria offboard ...") print(self.load_param_bank(type_memory = 1)) self.read_ps_status() print("\n Verificando banco de parametros offboard apos reset ... \n") try: param_bank_offboard = [] for param in ListParameters[0:max_param]: val = self.get_param(param,0) print(param, val) param_bank_offboard.append(val) if param_bank_onboard == param_bank_offboard: print("\n Placa BID aprovada!\n") else: print("\n Placa BID reprovada!\n") except: print(" Placa BID reprovada!\n") def upload_parameters_bid(self, password): print("\n Desbloqueando UDC ...") print(self.unlock_udc(password)) print("\n Carregando banco de parametros da memoria offboard ...") print(self.load_param_bank(type_memory = 1)) time.sleep(1) print("\n Salvando banco de parametros na memoria onboard ...") print(self.save_param_bank(type_memory = 2)) time.sleep(5) print("\n Carregando coeficientes de controle da memoria offboard ...") print(self.load_dsp_modules_eeprom(type_memory = 1)) time.sleep(1) print("\n Salvando coeficientes de controle na memoria onboard ...\n") print(self.save_dsp_modules_eeprom(type_memory = 2)) def download_parameters_bid(self,password): print("\n Desbloqueando UDC ...") print(self.unlock_udc(password)) print("\n Carregando banco de parametros da memoria onboard ...") print(self.load_param_bank(type_memory = 2)) time.sleep(1) print("\n Salvando banco de parametros na memoria offboard ...") print(self.save_param_bank(type_memory = 1)) time.sleep(5) print("\n Carregando coeficientes de controle da memoria onboard ...") print(self.load_dsp_modules_eeprom(type_memory = 2)) time.sleep(1) print("\n Salvando coeficientes de controle na memoria offboard ...") print(self.save_dsp_modules_eeprom(type_memory = 1))
50.598044
265
0.55056
26,490
217,268
4.279464
0.040619
0.036626
0.060972
0.075862
0.799555
0.775482
0.749495
0.735302
0.718197
0.701781
0
0.032604
0.311808
217,268
4,293
266
50.60983
0.725131
0.018908
0
0.550821
0
0.002303
0.187365
0.016792
0
0
0.000085
0
0
1
0.072272
false
0.006047
0.003167
0.000576
0.136769
0.197812
0
0
0
null
0
0
0
0
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
a2a8931a51fd34396e672c721c5f10973faf1824
33
py
Python
inferno/trainers/callbacks/__init__.py
svenpeter42/inferno
6bcae839f7989666acbf02c2fca87f0b528d9247
[ "Apache-2.0" ]
null
null
null
inferno/trainers/callbacks/__init__.py
svenpeter42/inferno
6bcae839f7989666acbf02c2fca87f0b528d9247
[ "Apache-2.0" ]
1
2017-12-20T21:36:48.000Z
2017-12-20T21:36:48.000Z
inferno/trainers/callbacks/__init__.py
svenpeter42/inferno
6bcae839f7989666acbf02c2fca87f0b528d9247
[ "Apache-2.0" ]
1
2021-01-27T12:29:30.000Z
2021-01-27T12:29:30.000Z
from .base import CallbackEngine
16.5
32
0.848485
4
33
7
1
0
0
0
0
0
0
0
0
0
0
0
0.121212
33
1
33
33
0.965517
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
a2c1e4722a0feff570186eafcc1bdae39438b977
122
py
Python
gcn/predictors/__init__.py
CaiYufan-sjtu/GCNOIE
c84afca5b66d75c7108b2719241e2907700b4111
[ "MIT" ]
null
null
null
gcn/predictors/__init__.py
CaiYufan-sjtu/GCNOIE
c84afca5b66d75c7108b2719241e2907700b4111
[ "MIT" ]
null
null
null
gcn/predictors/__init__.py
CaiYufan-sjtu/GCNOIE
c84afca5b66d75c7108b2719241e2907700b4111
[ "MIT" ]
null
null
null
from gcn.predictors.predictor import GCN_Predictor from gcn.predictors.open_information_extraction import OpenIePredictor
40.666667
70
0.901639
15
122
7.133333
0.6
0.130841
0.317757
0
0
0
0
0
0
0
0
0
0.065574
122
2
71
61
0.938596
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
a2cff3c026153900f65aed2d98bb9d095069327f
37
py
Python
mod_pbxproj/__init__.py
crankycoder/mod_pbxproj
82ebde6965ee0f4718c2298859e22c710ae9a206
[ "BSD-3-Clause" ]
13
2020-05-24T23:52:48.000Z
2020-12-01T02:43:03.000Z
mod_pbxproj/__init__.py
crankycoder/mod_pbxproj
82ebde6965ee0f4718c2298859e22c710ae9a206
[ "BSD-3-Clause" ]
3
2020-05-26T22:19:49.000Z
2020-12-01T09:31:25.000Z
mod_pbxproj/__init__.py
crankycoder/mod_pbxproj
82ebde6965ee0f4718c2298859e22c710ae9a206
[ "BSD-3-Clause" ]
3
2020-05-26T01:35:20.000Z
2020-05-26T13:51:07.000Z
from mod_pbxproj import XcodeProject
18.5
36
0.891892
5
37
6.4
1
0
0
0
0
0
0
0
0
0
0
0
0.108108
37
1
37
37
0.969697
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
a2f92e7d1d58283fa0126a14833e963fde0a68ed
786
py
Python
terrascript/oneandone/r.py
amlodzianowski/python-terrascript
1111affe6cd30d9b8b7bc74ae4e27590f7d4dc49
[ "BSD-2-Clause" ]
null
null
null
terrascript/oneandone/r.py
amlodzianowski/python-terrascript
1111affe6cd30d9b8b7bc74ae4e27590f7d4dc49
[ "BSD-2-Clause" ]
null
null
null
terrascript/oneandone/r.py
amlodzianowski/python-terrascript
1111affe6cd30d9b8b7bc74ae4e27590f7d4dc49
[ "BSD-2-Clause" ]
null
null
null
# terrascript/oneandone/r.py import terrascript class oneandone_server(terrascript.Resource): pass class oneandone_firewall_policy(terrascript.Resource): pass class oneandone_private_network(terrascript.Resource): pass class oneandone_public_ip(terrascript.Resource): pass class oneandone_shared_storage(terrascript.Resource): pass class oneandone_monitoring_policy(terrascript.Resource): pass class oneandone_loadbalancer(terrascript.Resource): pass class oneandone_vpn(terrascript.Resource): pass class oneandone_ssh_key(terrascript.Resource): pass class oneandone_block_storage(terrascript.Resource): pass class oneandone_image(terrascript.Resource): pass class oneandone_baremetal(terrascript.Resource): pass
15.115385
56
0.790076
85
786
7.082353
0.294118
0.27907
0.458472
0.511628
0.719269
0.289037
0
0
0
0
0
0
0.143766
786
51
57
15.411765
0.894502
0.033079
0
0.48
0
0
0
0
0
0
0
0
0
1
0
true
0.48
0.04
0
0.52
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
0
0
0
0
0
5
0c178a1069f39c518ddfd8a2916f2fbf97dfd531
44
py
Python
FEM/Utils/__init__.py
ZibraMax/FEM
b868c60408a4f83dec4bb424d66be0b20e2ac71b
[ "MIT" ]
10
2021-03-21T18:38:40.000Z
2022-02-22T01:32:06.000Z
FEM/Utils/__init__.py
ZibraMax/FEM
b868c60408a4f83dec4bb424d66be0b20e2ac71b
[ "MIT" ]
null
null
null
FEM/Utils/__init__.py
ZibraMax/FEM
b868c60408a4f83dec4bb424d66be0b20e2ac71b
[ "MIT" ]
1
2022-02-08T04:40:59.000Z
2022-02-08T04:40:59.000Z
"""Utilities """ from .polygonal import *
7.333333
24
0.636364
4
44
7
1
0
0
0
0
0
0
0
0
0
0
0
0.181818
44
5
25
8.8
0.777778
0.204545
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
0c3bf75f340487eca11d6757cd68e1e3d0293969
80
py
Python
run.py
gems-uff/sms
01cfa84bd467617c58f58da04711c5097dd93fe6
[ "MIT" ]
null
null
null
run.py
gems-uff/sms
01cfa84bd467617c58f58da04711c5097dd93fe6
[ "MIT" ]
null
null
null
run.py
gems-uff/sms
01cfa84bd467617c58f58da04711c5097dd93fe6
[ "MIT" ]
null
null
null
from app import create_app from config import Config app = create_app(Config)
13.333333
26
0.8
13
80
4.769231
0.384615
0.290323
0
0
0
0
0
0
0
0
0
0
0.1625
80
5
27
16
0.925373
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.666667
0
0.666667
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
5
0c40165cbb0b8d0079584a6e0a1e0a508475fc56
18,475
py
Python
lg_common/src/lg_common/interactive_messages_factory.py
carlosvquezada/lg_ros_nodes
7560e99272d06ef5c80a5444131dad72c078a718
[ "Apache-2.0" ]
null
null
null
lg_common/src/lg_common/interactive_messages_factory.py
carlosvquezada/lg_ros_nodes
7560e99272d06ef5c80a5444131dad72c078a718
[ "Apache-2.0" ]
null
null
null
lg_common/src/lg_common/interactive_messages_factory.py
carlosvquezada/lg_ros_nodes
7560e99272d06ef5c80a5444131dad72c078a718
[ "Apache-2.0" ]
null
null
null
import sys import json import rospy from interactivespaces_msgs.msg import GenericMessage class InteractiveSpacesMessagesFactory: """ This class contains easy access to test messages """ def __init__(self): self.publisher = None self.test_one_browser_with_extension_msg = self._create_message(""" { "description": "one browser with extension", "duration": 100, "name": "one browser with extension", "resource_uri": "/director_api/scene/one_browser_with_extension/", "slug": "one_browser_with_extension", "windows": [ { "activity": "browser", "activity_config": { "google_chrome":{ "extensions": [ "test_extension1" ] } }, "assets": [ "http://127.0.0.1:8008/lg_common/webapps/example/index.html" ], "height": 333, "presentation_viewport": "center", "width": 333, "x_coord": 22, "y_coord": 22 } ] } """) self.test_one_browser_with_allowed_urls_msg = self._create_message(""" { "description": "one browser with allowed urls", "duration": 100, "name": "one browser with allowed urls", "resource_uri": "/director_api/scene/one_browser_with_allowed_urls/", "slug": "one_browser_with_allowed_urls", "windows": [ { "activity": "browser", "activity_config": { "google_chrome":{ "allowed_urls": ["google.com", "endpoint.com"] } }, "assets": [ "https://maps.google.com" ], "height": 333, "presentation_viewport": "center", "width": 333, "x_coord": 22, "y_coord": 22 } ] } """) self.test_one_browser_with_two_extensions_msg = self._create_message(""" { "description": "one browser with extension", "duration": 100, "name": "one browser with extension", "resource_uri": "/director_api/scene/one_browser_with_extension/", "slug": "one_browser_with_extension", "windows": [ { "activity": "browser", "activity_config": { "google_chrome":{ "extensions": [ "test_extension1", "test_extension2" ] } }, "assets": [ "https://maps.google.com" ], "height": 333, "presentation_viewport": "center", "width": 333, "x_coord": 22, "y_coord": 22 } ] } """) self.test_one_browser_with_two_extensions_and_preloading_msg = self._create_message(""" { "description": "one_browser_tiwh_two_extensions_and_preloading", "duration": 100, "name": "one_browser_tiwh_two_extensions_and_preloading", "resource_uri": "/director_api/scene/one_browser_tiwh_two_extensions_and_preloading/", "slug": "one_browser_tiwh_two_extensions_and_preloading", "windows": [ { "activity": "browser", "activity_config": { "preload": true, "google_chrome":{ "extensions": [ "test_extension1", "test_extension2" ] } }, "assets": [ "http://127.0.0.1:8008/lg_common/webapps/window_ready_mock/test.html" ], "height": 333, "presentation_viewport": "center", "width": 333, "x_coord": 22, "y_coord": 22 } ] } """) self.test_one_browser_with_custom_cmdargs_msg = self._create_message(""" { "description": "one browser with extension", "duration": 100, "name": "one browser with extension", "resource_uri": "/director_api/scene/one_browser_with_extension/", "slug": "one_browser_with_extension", "windows": [ { "activity": "browser", "activity_config": { "google_chrome":{ "command_line_args": [ "--disable-out-of-process-pac", "--enable-benchmarking", "--enable-crash-reporter" ] } }, "assets": [ "https://maps.google.com" ], "height": 333, "presentation_viewport": "center", "width": 333, "x_coord": 22, "y_coord": 22 } ] } """) self.test_one_browser_with_custom_user_agent_msg = self._create_message(""" { "description": "custom user agent", "duration": 100, "name": "custom_user_agent", "resource_uri": "/director_api/scene/one_browser_with_custom_user_agent/", "slug": "one_browser_with_custom_user_agent", "windows": [ { "activity": "browser", "activity_config": { "google_chrome":{ "user_agent": "loltestlmfaorofl" } }, "assets": [ "https://maps.google.com" ], "height": 333, "presentation_viewport": "center", "width": 333, "x_coord": 22, "y_coord": 22 } ] } """) self.test_one_browser_with_custom_binary_msg = self._create_message(""" { "description": "custom binary", "duration": 100, "name": "custom_user_agent", "resource_uri": "/director_api/scene/one_browser_with_custom_binary/", "slug": "one_browser_with_custom_binary", "windows": [ { "activity": "browser", "activity_config": { "google_chrome":{ "version": "beta" } }, "assets": [ "https://maps.google.com" ], "height": 333, "presentation_viewport": "center", "width": 333, "x_coord": 22, "y_coord": 22 } ] } """) self.test_one_browser_on_center_alt_slug_msg = self._create_message(""" { "description": "one_browser_on_center_alt_slug", "duration": 100, "name": "one_browser_on_center_alt_slug", "resource_uri": "/director_api/scene/one_browser_on_center_alt_slug/", "slug": "one_browser_on_center_alt_slug", "windows": [ { "activity": "browser", "activity_config": { }, "assets": [ "http://127.0.0.1:8008/lg_common/webapps/example/index.html" ], "height": 333, "presentation_viewport": "center", "width": 333, "x_coord": 22, "y_coord": 22 } ] } """) self.test_one_browser_on_center_msg = self._create_message(""" { "description": "one_browser_on_center", "duration": 100, "name": "custom_user_agent", "resource_uri": "/director_api/scene/one_browser_on_center/", "slug": "one_browser_on_center", "windows": [ { "activity": "browser", "activity_config": { }, "assets": [ "http://127.0.0.1:8008/lg_common/webapps/example/index.html" ], "height": 333, "presentation_viewport": "center", "width": 333, "x_coord": 22, "y_coord": 22 } ] } """) self.test_no_browsers_msg = self._create_message(""" { "description": "no_browsers", "duration": 100, "name": "no_browsers", "resource_uri": "/director_api/scene/no_browsers/", "slug": "no_browsers", "windows": [ ] } """) self.test_one_browser_with_preloading_and_wrong_url_msg = self._create_message(""" { "description": "one_browser_with_preloading_and_wrong_url", "duration": 100, "name": "one_browser_with_preloading_and_wrong_url", "resource_uri": "/director_api/scene/one_browser_with_preloading_and_wrong_url/", "slug": "one_browser_with_preloading_and_wrong_url", "windows": [ { "activity": "browser", "activity_config": { "preload": true }, "assets": [ "http://asdasdasdaqweqwenonexistentpage.com" ], "height": 333, "presentation_viewport": "center", "width": 333, "x_coord": 22, "y_coord": 22 } ] } """) self.test_one_browser_with_preloading_msg = self._create_message(""" { "description": "one_browser_with_preloading", "duration": 100, "name": "one_browser_with_preloading", "resource_uri": "/director_api/scene/one_browser_with_preloading/", "slug": "one_browser_with_preloading", "windows": [ { "activity": "browser", "activity_config": { "preload": true }, "assets": [ "http://127.0.0.1:8008/lg_common/webapps/window_ready_mock/test.html" ], "height": 333, "presentation_viewport": "center", "width": 333, "x_coord": 22, "y_coord": 22 } ] } """) self.test_one_browser_with_preloading_alt_slug_msg = self._create_message(""" { "description": "one_browser_with_preloading_alt_slug", "duration": 100, "name": "one_browser_with_preloading_alt_slug", "resource_uri": "/director_api/scene/one_browser_with_preloading_alt_slug/", "slug": "one_browser_with_preloading_alt_slug", "windows": [ { "activity": "browser", "activity_config": { "preload": true }, "assets": [ "http://127.0.0.1:8008/lg_common/webapps/window_ready_mock/test.html" ], "height": 333, "presentation_viewport": "center", "width": 333, "x_coord": 22, "y_coord": 22 } ] } """) self.test_two_browsers_with_preloading_mix_msg = self._create_message(""" { "description": "one_two_browsers_with_preloading_mix", "duration": 100, "name": "two_browsers_with_preloading_mix", "resource_uri": "/director_api/scene/two_browsers_with_preloading_mix/", "slug": "two_browsers_with_preloading_mix", "windows": [ { "activity": "browser", "activity_config": { "preload": true }, "assets": [ "http://127.0.0.1:8008/lg_common/webapps/window_ready_mock/test.html" ], "height": 100, "presentation_viewport": "center", "width": 100, "x_coord": 300, "y_coord": 300 }, { "activity": "browser", "activity_config": { "preload": false }, "assets": [ "http://127.0.0.1:8008/lg_common/webapps/window_ready_mock/test.html" ], "height": 333, "presentation_viewport": "center", "width": 333, "x_coord": 22, "y_coord": 22 } ] } """) self.test_two_browsers_with_preloading_mix_alt_slug_msg = self._create_message(""" { "description": "one_two_browsers_with_preloading_mix_alt_slug", "duration": 100, "name": "two_browsers_with_preloading_mix_alt_slug", "resource_uri": "/director_api/scene/two_browsers_with_preloading_mix_alt_slug/", "slug": "two_browsers_with_preloading_mix_alt_slug", "windows": [ { "activity": "browser", "activity_config": { "preload": true }, "assets": [ "http://127.0.0.1:8008/lg_common/webapps/window_ready_mock/test.html" ], "height": 100, "presentation_viewport": "center", "width": 100, "x_coord": 300, "y_coord": 300 }, { "activity": "browser", "activity_config": { "preload": false }, "assets": [ "http://127.0.0.1:8008/lg_common/webapps/window_ready_mock/test.html" ], "height": 333, "presentation_viewport": "center", "width": 333, "x_coord": 22, "y_coord": 22 } ] } """) self.test_four_browsers_with_preloading_mix_msg = self._create_message(""" { "description": "four_browsers_with_preloading_mix", "duration": 100, "name": "four_browsers_with_preloading_mix", "resource_uri": "/director_api/scene/four_browsers_with_preloading_mix/", "slug": "four_browsers_with_preloading_mix", "windows": [ { "activity": "browser", "activity_config": { "preload": true }, "assets": [ "http://127.0.0.1:8008/lg_common/webapps/window_ready_mock/test.html" ], "height": 100, "presentation_viewport": "center", "width": 100, "x_coord": 300, "y_coord": 300 }, { "activity": "browser", "activity_config": { "preload": false }, "assets": [ "http://127.0.0.1:8008/lg_common/webapps/window_ready_mock/test.html" ], "height": 333, "presentation_viewport": "center", "width": 333, "x_coord": 22, "y_coord": 22 }, { "activity": "browser", "activity_config": { "preload": true }, "assets": [ "http://127.0.0.1:8008/lg_common/webapps/window_ready_mock/test.html" ], "height": 100, "presentation_viewport": "left", "width": 100, "x_coord": 300, "y_coord": 300 }, { "activity": "browser", "activity_config": { "preload": false }, "assets": [ "http://127.0.0.1:8008/lg_common/webapps/window_ready_mock/test.html" ], "height": 333, "presentation_viewport": "left", "width": 333, "x_coord": 22, "y_coord": 22 } ] } """) self.test_one_browser_with_preloading_and_custom_preloading_event_msg = self._create_message(""" { "description": "one_browser_with_preloading_and_custom_preloading_event", "duration": 100, "name": "one_browser_with_preloading_and_custom_preloading_event", "resource_uri": "/director_api/scene/one_browser_with_preloading_and_custom_preloading_event/", "slug": "one_browser_with_preloading_and_custom_preloading_event", "windows": [ { "activity": "browser", "activity_config": { "preload": true, "custom_preload_event": true }, "assets": [ "http://127.0.0.1:8008/lg_common/webapps/window_ready_mock/custom_event.html?use_app_event=1" ], "height": 333, "presentation_viewport": "center", "width": 333, "x_coord": 22, "y_coord": 22 } ] } """) def emit_message(self, ivar_name): """ emits message using instance variable name """ if not self.publisher: self.publisher = rospy.Publisher( '/director/scene', GenericMessage, queue_size=3 ) rospy.init_node("ispaces_messages_factory") message = self._get_message(ivar_name) print "message string: %s" % message self.publisher.publish(message) return True def _create_message(self, msg_string): message = GenericMessage() message.type = 'json' try: message_json = json.loads(msg_string) message.message = json.dumps(message_json) return message except ValueError: print "Could not decode json message from InteractiveSpacesMessagesFactory" sys.exit(1) def _init_publisher(self): pass def _get_message(self, message_name): """ Returns message as json """ return getattr(self, message_name) if __name__ == "__main__": try: messages = InteractiveSpacesMessagesFactory() message_name = sys.argv[1] print "Emitting %s message" % message_name messages.emit_message(message_name) except IndexError: print "" print "This file, if called directly, will emit an interactivespaces.msgs.GenericMessage" print "" print "You must provide message name to emit:\n%s" % \ '\n'.join(["- " + ivar for ivar in dir(messages) if ivar.startswith('test_')]) print "" print "NOTE: methods beginning with 'test' are used by test suite" print "" sys.exit(1)
32.298951
109
0.489743
1,629
18,475
5.181093
0.108656
0.07109
0.077962
0.072156
0.81955
0.784953
0.755569
0.682583
0.610071
0.541232
0
0.037837
0.386306
18,475
571
110
32.355517
0.706562
0
0
0.557762
0
0.027076
0.840256
0.164007
0
0
0
0
0
0
null
null
0.001805
0.00722
null
null
0.018051
0
0
0
null
0
0
0
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
5
0c48a33b78a498aba31c48f55f1b63e9dd1582f4
11,825
py
Python
calliope_app/api/tests/test_urls.py
NREL/engage
c25bacc1e98f84671ba0c0e53fc98bace090a4d8
[ "BSD-3-Clause" ]
3
2021-01-25T18:13:00.000Z
2021-04-30T12:17:42.000Z
calliope_app/api/tests/test_urls.py
NREL/engage
c25bacc1e98f84671ba0c0e53fc98bace090a4d8
[ "BSD-3-Clause" ]
8
2020-12-11T22:28:17.000Z
2022-03-05T02:08:27.000Z
calliope_app/api/tests/test_urls.py
NREL/engage
c25bacc1e98f84671ba0c0e53fc98bace090a4d8
[ "BSD-3-Clause" ]
1
2021-09-15T22:15:12.000Z
2021-09-15T22:15:12.000Z
""" Unit tests for Django app "api" urls. """ import uuid from django.conf import settings from django.test import TestCase from django.urls import reverse, resolve from django.utils import translation class APIUserURLTestCase(TestCase): def test_user_registration(self): view_name = "user_registration" for language_code, _ in settings.LANGUAGES: with translation.override(language_code): url = f"/{language_code}/api/user_registration/" self.assertEqual(reverse(view_name), url) self.assertEqual(resolve(url).view_name, view_name) def test_user_activation(self): activation_uuid = str(uuid.uuid4()) view_name = "user_activation" for language_code, _ in settings.LANGUAGES: with translation.override(language_code): url = f"/{language_code}/api/user_activation/{activation_uuid}" self.assertEqual( reverse(view_name, kwargs={"activation_uuid": activation_uuid}), url ) self.assertEqual(resolve(url).view_name, view_name) class APIModelURLTestCase(TestCase): def test_add_model(self): view_name = "add_model" for language_code, _ in settings.LANGUAGES: with translation.override(language_code): url = f"/{language_code}/api/add_model/" self.assertEqual(reverse(view_name), url) self.assertEqual(resolve(url).view_name, view_name) def test_remove_model(self): view_name = "remove_model" for language_code, _ in settings.LANGUAGES: with translation.override(language_code): url = f"/{language_code}/api/remove_model/" self.assertEqual(reverse(view_name), url) self.assertEqual(resolve(url).view_name, view_name) def test_duplicate_model(self): view_name = "duplicate_model" for language_code, _ in settings.LANGUAGES: with translation.override(language_code): url = f"/{language_code}/api/duplicate_model/" self.assertEqual(reverse(view_name), url) self.assertEqual(resolve(url).view_name, view_name) def test_add_collaborator(self): view_name = "add_collaborator" for language_code, _ in settings.LANGUAGES: with translation.override(language_code): url = f"/{language_code}/api/add_collaborator/" self.assertEqual(reverse(view_name), url) self.assertEqual(resolve(url).view_name, view_name) def testt_add_model_comment(self): view_name = "add_model_comment" for language_code, _ in settings.LANGUAGES: with translation.override(language_code): url = f"/{language_code}/api/add_model_comment/" self.assertEqual(reverse(view_name), url) self.assertEqual(resolve(url).view_name, view_name) class APILocationURLTestCase(TestCase): def test_update_location(self): view_name = "update_location" for language_code, _ in settings.LANGUAGES: with translation.override(language_code): url = f"/{language_code}/api/update_location/" self.assertEqual(reverse(view_name), url) self.assertEqual(resolve(url).view_name, view_name) def test_delete_location(self): view_name = "delete_location" for language_code, _ in settings.LANGUAGES: with translation.override(language_code): url = f"/{language_code}/api/delete_location/" self.assertEqual(reverse(view_name), url) self.assertEqual(resolve(url).view_name, view_name) class APIParameterURLTestCase(TestCase): def test_convert_to_timeseries(self): view_name = "convert_to_timeseries" for language_code, _ in settings.LANGUAGES: with translation.override(language_code): url = f"/{language_code}/api/convert_to_timeseries/" self.assertEqual(reverse(view_name), url) self.assertEqual(resolve(url).view_name, view_name) def test_update_favorite(self): view_name = "update_favorite" for language_code, _ in settings.LANGUAGES: with translation.override(language_code): url = f"/{language_code}/api/update_favorite/" self.assertEqual(reverse(view_name), url) self.assertEqual(resolve(url).view_name, view_name) class APITechnologyURLTestCase(TestCase): def test_add_technology(self): view_name = "add_technology" for language_code, _ in settings.LANGUAGES: with translation.override(language_code): url = f"/{language_code}/api/add_technology/" self.assertEqual(reverse(view_name), url) self.assertEqual(resolve(url).view_name, view_name) def test_delete_technology(self): view_name = "delete_technology" for language_code, _ in settings.LANGUAGES: with translation.override(language_code): url = f"/{language_code}/api/delete_technology/" self.assertEqual(reverse(view_name), url) self.assertEqual(resolve(url).view_name, view_name) def test_update_tech_params(self): view_name = "update_tech_params" for language_code, _ in settings.LANGUAGES: with translation.override(language_code): url = f"/{language_code}/api/update_tech_params/" self.assertEqual(reverse(view_name), url) self.assertEqual(resolve(url).view_name, view_name) class APILocTechURLTestCase(TestCase): def test_add_loc_tech(self): view_name = "add_loc_tech" for language_code, _ in settings.LANGUAGES: with translation.override(language_code): url = f"/{language_code}/api/add_loc_tech/" self.assertEqual(reverse(view_name), url) self.assertEqual(resolve(url).view_name, view_name) def test_delete_loc_tech(self): view_name = "delete_loc_tech" for language_code, _ in settings.LANGUAGES: with translation.override(language_code): url = f"/{language_code}/api/delete_loc_tech/" self.assertEqual(reverse(view_name), url) self.assertEqual(resolve(url).view_name, view_name) def test_update_loc_tech_params(self): view_name = "update_loc_tech_params" for language_code, _ in settings.LANGUAGES: with translation.override(language_code): url = f"/{language_code}/api/update_loc_tech_params/" self.assertEqual(reverse(view_name), url) self.assertEqual(resolve(url).view_name, view_name) class APIScenarioURLTestCase(TestCase): def test_add_scenario(self): view_name = "add_scenario" for language_code, _ in settings.LANGUAGES: with translation.override(language_code): url = f"/{language_code}/api/add_scenario/" self.assertEqual(reverse(view_name), url) self.assertEqual(resolve(url).view_name, view_name) def test_toggle_scenario_loc_tech(self): view_name = "toggle_scenario_loc_tech" for language_code, _ in settings.LANGUAGES: with translation.override(language_code): url = f"/{language_code}/api/toggle_scenario_loc_tech/" self.assertEqual(reverse(view_name), url) self.assertEqual(resolve(url).view_name, view_name) def test_update_scenario_params(self): view_name = "update_scenario_params" for language_code, _ in settings.LANGUAGES: with translation.override(language_code): url = f"/{language_code}/api/update_scenario_params/" self.assertEqual(reverse(view_name), url) self.assertEqual(resolve(url).view_name, view_name) def test_delete_scenario(self): view_name = "delete_scenario" for language_code, _ in settings.LANGUAGES: with translation.override(language_code): url = f"/{language_code}/api/delete_scenario/" self.assertEqual(reverse(view_name), url) self.assertEqual(resolve(url).view_name, view_name) class APIFileURLTestCase(TestCase): def test_upload_file(self): view_name = "upload_file" for language_code, _ in settings.LANGUAGES: with translation.override(language_code): url = f"/{language_code}/api/upload_file/" self.assertEqual(reverse(view_name), url) self.assertEqual(resolve(url).view_name, view_name) def test_delete_file(self): view_name = "delete_file" for language_code, _ in settings.LANGUAGES: with translation.override(language_code): url = f"/{language_code}/api/delete_file/" self.assertEqual(reverse(view_name), url) self.assertEqual(resolve(url).view_name, view_name) def test_upload_timeseries(self): view_name = "upload_timeseries" for language_code, _ in settings.LANGUAGES: with translation.override(language_code): url = f"/{language_code}/api/upload_timeseries/" self.assertEqual(reverse(view_name), url) self.assertEqual(resolve(url).view_name, view_name) def test_delete_timeseries(self): view_name = "delete_timeseries" for language_code, _ in settings.LANGUAGES: with translation.override(language_code): url = f"/{language_code}/api/delete_timeseries/" self.assertEqual(reverse(view_name), url) self.assertEqual(resolve(url).view_name, view_name) class APIRunURLTestCase(TestCase): def test_build(self): view_name = "build" for language_code, _ in settings.LANGUAGES: with translation.override(language_code): url = f"/{language_code}/api/build/" self.assertEqual(reverse(view_name), url) self.assertEqual(resolve(url).view_name, view_name) def test_optimize(self): view_name = "optimize" for language_code, _ in settings.LANGUAGES: with translation.override(language_code): url = f"/{language_code}/api/optimize/" self.assertEqual(reverse(view_name), url) self.assertEqual(resolve(url).view_name, view_name) def test_delete_run(self): view_name = "delete_run" for language_code, _ in settings.LANGUAGES: with translation.override(language_code): url = f"/{language_code}/api/delete_run/" self.assertEqual(reverse(view_name), url) self.assertEqual(resolve(url).view_name, view_name) def test_update_run_description(self): view_name = "update_run_description" for language_code, _ in settings.LANGUAGES: with translation.override(language_code): url = f"/{language_code}/api/update_run_description/" self.assertEqual(reverse(view_name), url) self.assertEqual(resolve(url).view_name, view_name) def test_download(self): view_name = "download" for language_code, _ in settings.LANGUAGES: with translation.override(language_code): url = f"/{language_code}/api/download/" self.assertEqual(reverse(view_name), url) self.assertEqual(resolve(url).view_name, view_name)
39.155629
88
0.641099
1,323
11,825
5.436886
0.055933
0.133463
0.062561
0.070902
0.798832
0.773808
0.766023
0.766023
0.766023
0.766023
0
0.000115
0.26537
11,825
301
89
39.285714
0.827904
0.003129
0
0.524229
0
0
0.134635
0.104839
0
0
0
0
0.264317
1
0.132159
false
0
0.022026
0
0.193833
0
0
0
0
null
0
0
0
0
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
a753a8170b3bb06b0d8295bb938258d900fe2c90
158
py
Python
bkash/_constants.py
aniruddha-adhikary/bkash-api-client-python
dc702e0444a9f4716ff5fb20fff7ae494a0482cb
[ "MIT" ]
19
2018-05-19T13:57:04.000Z
2021-07-05T12:18:28.000Z
bkash/_constants.py
Revel109/bkash-api-client-python
dc702e0444a9f4716ff5fb20fff7ae494a0482cb
[ "MIT" ]
null
null
null
bkash/_constants.py
Revel109/bkash-api-client-python
dc702e0444a9f4716ff5fb20fff7ae494a0482cb
[ "MIT" ]
4
2018-05-19T13:31:51.000Z
2019-10-03T10:49:43.000Z
API_VERSION = '0.40.0' SANDBOX_BASE = 'https://{service}.sandbox.bka.sh/v{version}/{path}' PRODUCTION_BASE = 'https://{service}.pay.bka.sh/v{version}/{path}'
39.5
67
0.696203
25
158
4.28
0.56
0.168224
0.299065
0.242991
0.317757
0
0
0
0
0
0
0.026846
0.056962
158
3
68
52.666667
0.691275
0
0
0
0
0
0.64557
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
a76692a63d328faec5fe0e20b873396c72b65186
2,755
py
Python
tests/test_views.py
cocodelabs/api.palaverapp.com
cb517a2cd1dea12fadf4f72147fecf0105cbd717
[ "BSD-3-Clause" ]
3
2016-07-03T21:19:18.000Z
2021-07-10T18:32:16.000Z
tests/test_views.py
cocodelabs/api.palaverapp.com
cb517a2cd1dea12fadf4f72147fecf0105cbd717
[ "BSD-3-Clause" ]
66
2015-03-27T21:52:11.000Z
2021-09-06T17:56:59.000Z
tests/test_views.py
cocodelabs/api.palaverapp.com
cb517a2cd1dea12fadf4f72147fecf0105cbd717
[ "BSD-3-Clause" ]
1
2021-07-28T19:45:31.000Z
2021-07-28T19:45:31.000Z
import json import unittest from rivr.test import Client from palaverapi import app from palaverapi.models import Device, Token class ViewTests(unittest.TestCase): def setUp(self) -> None: self.client = Client(app) def test_status(self) -> None: assert self.client.get('/').status_code == 204 def test_register(self) -> None: response = self.client.post( '/1/devices', headers={'Content-Type': 'application/json'}, body=json.dumps({'device_token': 'test_token'}).encode('utf-8'), ) self.assertEqual(response.status_code, 201) self.assertEqual(response.headers['Content-Type'], 'application/json') self.assertEqual( response.content, '{"device_token": "test_token", "push_token": "ec1752bd70320e4763f7165d73e2636cca9e25cf"}', ) device = Device.get(apns_token='test_token') assert device push_token = ( Token.select() .where( Token.device == device, Token.token == 'ec1752bd70320e4763f7165d73e2636cca9e25cf', ) .get() ) token = ( Token.select() .where(Token.device == device, Token.token == 'test_token') .get() ) token.delete_instance() push_token.delete_instance() device.delete_instance() def test_returns_200_when_re_registering(self) -> None: response = self.client.post( '/1/devices', headers={'Content-Type': 'application/json'}, body=json.dumps({'device_token': 'test_token'}).encode('utf-8'), ) response = self.client.post( '/1/devices', headers={'Content-Type': 'application/json'}, body=json.dumps({'device_token': 'test_token'}).encode('utf-8'), ) self.assertEqual(response.status_code, 200) self.assertEqual(response.headers['Content-Type'], 'application/json') self.assertEqual( response.content, '{"device_token": "test_token", "push_token": "ec1752bd70320e4763f7165d73e2636cca9e25cf"}', ) device = Device.get(apns_token='test_token') assert device push_token = ( Token.select() .where( Token.device == device, Token.token == 'ec1752bd70320e4763f7165d73e2636cca9e25cf', ) .get() ) token = ( Token.select() .where(Token.device == device, Token.token == 'test_token') .get() ) push_token.delete_instance() token.delete_instance() device.delete_instance()
30.955056
103
0.563702
256
2,755
5.917969
0.203125
0.072607
0.083168
0.09571
0.784158
0.784158
0.732673
0.732673
0.732673
0.732673
0
0.063975
0.307804
2,755
88
104
31.306818
0.730467
0
0
0.666667
0
0
0.198911
0.060254
0
0
0
0
0.12
1
0.053333
false
0
0.066667
0
0.133333
0
0
0
0
null
0
0
0
0
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
a779d99fe199a05d0492065bd295925196caedd2
313
py
Python
generated-libraries/python/netapp/aggr/aggrraidtype.py
radekg/netapp-ontap-lib-get
6445ebb071ec147ea82a486fbe9f094c56c5c40d
[ "MIT" ]
2
2017-03-28T15:31:26.000Z
2018-08-16T22:15:18.000Z
generated-libraries/python/netapp/aggr/aggrraidtype.py
radekg/netapp-ontap-lib-get
6445ebb071ec147ea82a486fbe9f094c56c5c40d
[ "MIT" ]
null
null
null
generated-libraries/python/netapp/aggr/aggrraidtype.py
radekg/netapp-ontap-lib-get
6445ebb071ec147ea82a486fbe9f094c56c5c40d
[ "MIT" ]
null
null
null
class Aggrraidtype(basestring): """ raid_dp|raid4 Possible values: <ul> <li> "raid_dp" , <li> "raid4" , <li> "raid0" , <li> "mixed_raid_type" </ul> """ @staticmethod def get_api_name(): return "aggrraidtype"
18.411765
31
0.453674
28
313
4.857143
0.678571
0.088235
0
0
0
0
0
0
0
0
0
0.016393
0.415335
313
16
32
19.5625
0.726776
0.472843
0
0
0
0
0.099174
0
0
0
0
0
0
1
0.25
true
0
0
0.25
0.75
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
1
0
0
1
1
0
0
5
a78a06e5ebf48d0f7d299088d305b63532e04717
120
py
Python
modern3.py
yanapermana/metadecryptor
7c3e11ddb8ae05c19dbebd8ed2c744ff86ceaa2f
[ "BSD-3-Clause" ]
49
2015-07-03T21:21:45.000Z
2022-03-31T04:04:42.000Z
modern3.py
hangetzzu/metadecryptor
7c3e11ddb8ae05c19dbebd8ed2c744ff86ceaa2f
[ "BSD-3-Clause" ]
3
2015-11-03T03:49:25.000Z
2019-11-04T16:03:18.000Z
modern3.py
hangetzzu/metadecryptor
7c3e11ddb8ae05c19dbebd8ed2c744ff86ceaa2f
[ "BSD-3-Clause" ]
17
2015-07-05T15:24:18.000Z
2022-01-17T22:33:26.000Z
from check_RSA3 import * class Modern3: def __init__(self): pass def check_RSAs(self, target): check_RSA(target)
15
30
0.741667
18
120
4.555556
0.722222
0
0
0
0
0
0
0
0
0
0
0.02
0.166667
120
8
31
15
0.8
0
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0.166667
0.166667
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
1
0
0
5
a7adba42a75cf5b5fc19f5d82e67f3d347b31aae
66
py
Python
build/lib/pyconfluent/__init__.py
newellp2019/pyconfluent
b1de0b8255678c2e6a3a7d016df57b9f40cdc861
[ "MIT" ]
null
null
null
build/lib/pyconfluent/__init__.py
newellp2019/pyconfluent
b1de0b8255678c2e6a3a7d016df57b9f40cdc861
[ "MIT" ]
null
null
null
build/lib/pyconfluent/__init__.py
newellp2019/pyconfluent
b1de0b8255678c2e6a3a7d016df57b9f40cdc861
[ "MIT" ]
null
null
null
from .ksql import KSQL from .schema_registry import SchemaRegistry
33
43
0.863636
9
66
6.222222
0.666667
0
0
0
0
0
0
0
0
0
0
0
0.106061
66
2
43
33
0.949153
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5