markdown stringlengths 0 1.02M | code stringlengths 0 832k | output stringlengths 0 1.02M | license stringlengths 3 36 | path stringlengths 6 265 | repo_name stringlengths 6 127 |
|---|---|---|---|---|---|
Create a pandas dataframe with all the columns: | data_df = pd.DataFrame(data, columns=['patientunitstayid', 'ts', 'int_col', 'float_col', 'cat_1_bool_1',
'cat_1_bool_2', 'cat_2_bool_1', 'cat_3_bool_1',
'cat_3_bool_2', 'cat_3_bool_3', 'cat_3_bool_4',
'de... | _____no_output_____ | MIT | notebooks/.ipynb_checkpoints/large-dataset-testing-checkpoint.ipynb | AndreCNF/data-utils |
Save in batch files: | du.data_processing.save_chunked_data(data_df, file_name='dmy_large_data', batch_size=1,
id_column=id_column, data_path=data_path)
pd.read_feather(f'{data_path}dmy_large_data_2.ftr') | _____no_output_____ | MIT | notebooks/.ipynb_checkpoints/large-dataset-testing-checkpoint.ipynb | AndreCNF/data-utils |
Defining the dataset object | dataset = du.datasets.Large_Dataset(files_name='dmy_large_data', process_pipeline=utils.eICU_process_pipeline,
id_column=id_column, initial_analysis=utils.eICU_initial_analysis,
files_path=data_path, dataset_mode=dataset_mode, ml_core=ml_core,
... | _____no_output_____ | MIT | notebooks/.ipynb_checkpoints/large-dataset-testing-checkpoint.ipynb | AndreCNF/data-utils |
Separating into train and validation sets | (train_dataloader, val_dataloader, test_dataloader,
train_indeces, val_indeces, test_indeces) = du.machine_learning.create_train_sets(dataset,
test_train_ratio=test_train_ratio,
... | _____no_output_____ | MIT | notebooks/.ipynb_checkpoints/large-dataset-testing-checkpoint.ipynb | AndreCNF/data-utils |
Training models Vanilla RNN Creating the model Model parameters: | n_hidden = 10 # Number of hidden units
n_layers = 3 # Number of LSTM layers
p_dropout = 0.2 # Probability of dropout
embedding_dim = [3, 2, 4] # List of embedding dimensions
if use_delta_ts == 'normalized':
# Coun... | _____no_output_____ | MIT | notebooks/.ipynb_checkpoints/large-dataset-testing-checkpoint.ipynb | AndreCNF/data-utils |
Instantiating the model: | model = Models.VanillaRNN(n_inputs, n_hidden, n_outputs, n_layers, p_dropout,
embed_features=embed_features, n_embeddings=n_embeddings,
embedding_dim=embedding_dim, total_length=100000)
model | _____no_output_____ | MIT | notebooks/.ipynb_checkpoints/large-dataset-testing-checkpoint.ipynb | AndreCNF/data-utils |
Define the name that will be given to the models that will be saved: | model_name = 'rnn'
if dataset_mode == 'pre-embedded':
model_name = model_name + '_pre_embedded'
elif dataset_mode == 'learn embedding':
model_name = model_name + '_with_embedding'
elif dataset_mode == 'one hot encoded':
model_name = model_name + '_one_hot_encoded'
if use_delta_ts is not False:
model_nam... | _____no_output_____ | MIT | notebooks/.ipynb_checkpoints/large-dataset-testing-checkpoint.ipynb | AndreCNF/data-utils |
Training and testing the model | next(model.parameters())
model = du.deep_learning.train(model, train_dataloader, val_dataloader, test_dataloader, dataset=dataset,
padding_value=padding_value, batch_size=batch_size, n_epochs=n_epochs, lr=lr,
models_path=f'{project_path}models/', model_name=... | _____no_output_____ | MIT | notebooks/.ipynb_checkpoints/large-dataset-testing-checkpoint.ipynb | AndreCNF/data-utils |
Hyperparameter optimization | config_name = input('Hyperparameter optimization configuration file name:')
val_loss_min, exp_name_min = du.machine_learning.optimize_hyperparameters(Models.VanillaRNN,
train_dataloader=train_dataloader,
... | _____no_output_____ | MIT | notebooks/.ipynb_checkpoints/large-dataset-testing-checkpoint.ipynb | AndreCNF/data-utils |
**QC of ETL starting with GDC release 24 clinical tables**This notebook focuses on the QC of program **MMRF** data_category clinicalThis program has a total of five clinical tables present in this releaseTables listed below ---- `isb-project-zero.GDC_Clinical_Data.rel24_clin_MMRF`- `isb-project-zero.GDC_Clinical_Data.r... | from google.colab import auth
try:
auth.authenticate_user()
print('You have been successfully authenticated!')
except:
print('You have not been authenticated.')
from google.cloud import bigquery
try:
project_id = 'isb-project-zero' # Update your_project_number with your project number
client = bigquery.Client... | Collecting pypika
[?25l Downloading https://files.pythonhosted.org/packages/ea/22/63a4b2194462c54de8450de3d61eb44eddc2e7a85b06792603af09c606e1/PyPika-0.37.7.tar.gz (53kB)
[K |██████▏ | 10kB 12.7MB/s eta 0:00:01
[K |████████████▍ | 20kB 1.8MB/s eta 0:00:01
[K |... | Apache-2.0 | GDC_release_24/QC- ETL of GDC release 24 MMRF clincal tables.ipynb | madelyngreyes/ETLNextGenQCNotebooks |
READY TO BEGIN TESTING Clin MMRF **Testing Full ID** `isb-project-zero.GDC_Clinical_Data.rel23_clin_MMRF`[Table location](https://console.cloud.google.com/bigquery?authuser=1&folder=&organizationId=&project=isb-project-zero&p=isb-project-zero&d=GDC_Clinical_Data&t=rel23_clin_MMRF&page=table)Source : GDC APIRelease ver... | #return all table information for rel24_clin_MMRF
clin_table = Table('`isb-project-zero`.GDC_Clinical_Data.INFORMATION_SCHEMA.TABLES')
clin_query = Query.from_(clin_table) \
.select(' table_catalog, table_schema, table_name, table_type ') \
.where(clin_table.table_name=='rel24_clin_... | Are there any empty cells in the table schema?
| Apache-2.0 | GDC_release_24/QC- ETL of GDC release 24 MMRF clincal tables.ipynb | madelyngreyes/ETLNextGenQCNotebooks |
FIELD Descriptions pulled example below | #list of field descriptions for table rel24_clin_MMRF
clin_table = Table('`isb-project-zero`.GDC_Clinical_Data.INFORMATION_SCHEMA.COLUMN_FIELD_PATHS')
clin_query = Query.from_(clin_table) \
.select('table_name, column_name, description') \
.where(clin_table.table_name=='rel24_clin_M... | Are there any empty cells in the table schema?
table_name ... description
0 rel24_clin_MMRF ...
1 rel24_clin_MMRF ...
2 rel24_clin_MMRF ... Total child record ... | Apache-2.0 | GDC_release_24/QC- ETL of GDC release 24 MMRF clincal tables.ipynb | madelyngreyes/ETLNextGenQCNotebooks |
test 2 - row number verification**2. Look at table row number and size**Do these metrics make sense? | %%bigquery --project isb-project-zero
SELECT COUNT(submitter_id)
FROM `isb-project-zero.GDC_Clinical_Data.rel24_clin_MMRF`
%%bigquery --project isb-project-zero
SELECT COUNT(case_id)
FROM `isb-project-zero.GDC_Clinical_Data.rel23_clin_MMRF`
%%bigquery --project isb-project-zero
SELECT *
FROM `isb-project-zero.GDC_Clini... | _____no_output_____ | Apache-2.0 | GDC_release_24/QC- ETL of GDC release 24 MMRF clincal tables.ipynb | madelyngreyes/ETLNextGenQCNotebooks |
test 3 - manual verification**3. Scroll through table manually**See if anything stands out - empty columns, etc.The BigQuery table search user interface is useful in for this test run. The test tier points to the isb-etl-open. ISB-CGC BigQuery table search [test tier](https://isb-cgc-test.appspot.com/bq_meta_search/).... | # clinical case_id counts table reuslts below
# Query below will display the number of cases presents in this table.
clin_table = Table('`isb-project-zero.GDC_Clinical_Data.rel24_clin_MMRF`')
clin_query = Query.from_(clin_table) \
.select(' DISTINCT case_id, count(*) as count') \
.... | _____no_output_____ | Apache-2.0 | GDC_release_24/QC- ETL of GDC release 24 MMRF clincal tables.ipynb | madelyngreyes/ETLNextGenQCNotebooks |
test 5 - duplication verifcation**5. Check for any duplicate rows present in the table** | %%bigquery --project isb-project-zero
SELECT count(submitter_id) AS count
FROM `isb-project-zero.GDC_Clinical_Data.rel24_clin_MMRF`
GROUP BY submitter_id, case_id, diag__treat__count, fam_hist__count, follow__count, primary_site, disease_type, index_date, demo__demographic_id, demo__gender, demo__race, demo__ethnicity... | _____no_output_____ | Apache-2.0 | GDC_release_24/QC- ETL of GDC release 24 MMRF clincal tables.ipynb | madelyngreyes/ETLNextGenQCNotebooks |
test 6 - case_id master clinical data table count verifcation**6. Verify case_id count of table against master rel_clinical_data table** | # case_id count from the program MMRF clinical table
%%bigquery --project isb-project-zero
select distinct case_id, count(case_id) as count
from `isb-project-zero.GDC_Clinical_Data.rel24_clin_MMRF`
group by case_id
order by count
# case_id count from the master clinical table
%%bigquery --project isb-project-zero
... | _____no_output_____ | Apache-2.0 | GDC_release_24/QC- ETL of GDC release 24 MMRF clincal tables.ipynb | madelyngreyes/ETLNextGenQCNotebooks |
Clin MMRF_diag__treat**Testing Full ID** `isb-project-zero.GDC_Clinical_Data.rel24_clin_MMRF_diag__treat`[Table location](https://console.cloud.google.com/bigquery?authuser=1&folder=&organizationId=&project=isb-project-zero&p=isb-project-zero&d=GDC_Clinical_Data&t=rel24_clin_MMRF_diag__treat&page=table)Source : GDC API... | #return all table information for rel24_clin_MMRF_diag__treat
clin_table = Table('`isb-project-zero`.GDC_Clinical_Data.INFORMATION_SCHEMA.TABLES')
clin_query = Query.from_(clin_table) \
.select(' table_catalog, table_schema, table_name, table_type ') \
.where(clin_table.table_name==... | Are there any empty cells in the table schema?
| Apache-2.0 | GDC_release_24/QC- ETL of GDC release 24 MMRF clincal tables.ipynb | madelyngreyes/ETLNextGenQCNotebooks |
FIELD Descriptions pulled example below | #list of field descriptions for table rel24_clin_MMRF_diag__treat
clin_table = Table('`isb-project-zero`.GDC_Clinical_Data.INFORMATION_SCHEMA.COLUMN_FIELD_PATHS')
clin_query = Query.from_(clin_table) \
.select('table_name, column_name, description') \
.where(clin_table.table_name=='... | table_name ... description
0 rel24_clin_MMRF_diag__treat ...
1 rel24_clin_MMRF_diag__treat ... Reference to ancestor diag__diagnosis_id, loca...
2 rel24_clin_MMRF_diag__treat ... Reference to ances... | Apache-2.0 | GDC_release_24/QC- ETL of GDC release 24 MMRF clincal tables.ipynb | madelyngreyes/ETLNextGenQCNotebooks |
test 2 - row number verification**2. Look at table row number and size**Do these metrics make sense? | %%bigquery --project isb-project-zero
SELECT COUNT(case_id)
FROM `isb-project-zero.GDC_Clinical_Data.rel24_clin_MMRF_diag__treat`
%%bigquery --project isb-project-zero
SELECT COUNT(case_id)
FROM `isb-project-zero.GDC_Clinical_Data.rel23_clin_MMRF_diag__treat`
%%bigquery --project isb-project-zero
SELECT *
FROM `isb-pro... | _____no_output_____ | Apache-2.0 | GDC_release_24/QC- ETL of GDC release 24 MMRF clincal tables.ipynb | madelyngreyes/ETLNextGenQCNotebooks |
test 3 - manual verification**3. Scroll through table manually**See if anything stands out - empty columns, etc.The BigQuery table search user interface is useful in for this test run. The test tier points to the isb-etl-open. ISB-CGC BigQuery table search [test tier](https://isb-cgc-test.appspot.com/bq_meta_search/).... | # clinical case_id counts table reuslts below
# Query below will display the number of cases presents in this table.
clin_table = Table('`isb-project-zero.GDC_Clinical_Data.rel24_clin_MMRF_diag__treat`')
clin_query = Query.from_(clin_table) \
.select(' DISTINCT case_id, count(*) as count') \
... | _____no_output_____ | Apache-2.0 | GDC_release_24/QC- ETL of GDC release 24 MMRF clincal tables.ipynb | madelyngreyes/ETLNextGenQCNotebooks |
test 5 - duplication verifcation**5. Check for any duplicate rows present in the table** | %%bigquery --project isb-project-zero
SELECT count(case_id) AS count
FROM `isb-project-zero.GDC_Clinical_Data.rel24_clin_MMRF_diag__treat`
group by diag__treat__treatment_id, diag__diagnosis_id, case_id, diag__treat__days_to_treatment_start, diag__treat__treatment_type, diag__treat__treatment_or_therapy, diag__treat__... | _____no_output_____ | Apache-2.0 | GDC_release_24/QC- ETL of GDC release 24 MMRF clincal tables.ipynb | madelyngreyes/ETLNextGenQCNotebooks |
test 6 - case_id master clinical data table count verifcation**6. Verify case_id count of table against master rel_clinical_data table** | # case_id count from the program MMRF clinical table
%%bigquery --project isb-project-zero
select distinct case_id, count(case_id) as count
from `isb-project-zero.GDC_Clinical_Data.rel24_clin_MMRF`
group by case_id
order by count
# case_id count from the program MMRF_diag__treat clinical table
%%bigquery --project ... | _____no_output_____ | Apache-2.0 | GDC_release_24/QC- ETL of GDC release 24 MMRF clincal tables.ipynb | madelyngreyes/ETLNextGenQCNotebooks |
Clin MMRF_fam_hist**Testing Full ID** `isb-project-zero.GDC_Clinical_Data.rel24_clin_MMRF_fam_hist`[Table location](https://console.cloud.google.com/bigquery?project=high-transit-276919&authuser=2&p=isb-project-zero&d=GDC_metadata&t=rel24_fam_histpage=table)Source : GDC APIRelease version : v24 test 1 - schema verifica... | #return all table information for rel24_clin_MMRF_fam_hist
clin_table = Table('`isb-project-zero`.GDC_Clinical_Data.INFORMATION_SCHEMA.TABLES')
clin_query = Query.from_(clin_table) \
.select(' table_catalog, table_schema, table_name, table_type ') \
.where(clin_table.table_name=='re... | Are there any empty cells in the table schema?
| Apache-2.0 | GDC_release_24/QC- ETL of GDC release 24 MMRF clincal tables.ipynb | madelyngreyes/ETLNextGenQCNotebooks |
FIELD Descriptions pulled example below | #list of field descriptions for table rel24_clin_MMRF_fam_hist
clin_table = Table('`isb-project-zero`.GDC_Clinical_Data.INFORMATION_SCHEMA.COLUMN_FIELD_PATHS')
clin_query = Query.from_(clin_table) \
.select('table_name, column_name, description') \
.where(clin_table.table_name=='rel... | table_name ... description
0 rel24_clin_MMRF_fam_hist ...
1 rel24_clin_MMRF_fam_hist ... Reference to ancestor case_id, located in rel2...
2 rel24_clin_MMRF_fam_hist ... The yes/no/unknown indicator used ... | Apache-2.0 | GDC_release_24/QC- ETL of GDC release 24 MMRF clincal tables.ipynb | madelyngreyes/ETLNextGenQCNotebooks |
test 2 - row number verification**2. Look at table row number and size**Do these metrics make sense? | %%bigquery --project isb-project-zero
SELECT COUNT(case_id)
FROM `isb-project-zero.GDC_Clinical_Data.rel24_clin_MMRF_fam_hist`
%%bigquery --project isb-project-zero
SELECT COUNT(case_id)
FROM `isb-project-zero.GDC_Clinical_Data.rel23_clin_MMRF_fam_hist`
%%bigquery --project isb-project-zero
SELECT *
FROM `isb-project-z... | _____no_output_____ | Apache-2.0 | GDC_release_24/QC- ETL of GDC release 24 MMRF clincal tables.ipynb | madelyngreyes/ETLNextGenQCNotebooks |
test 3 - manual verification**3. Scroll through table manually**See if anything stands out - empty columns, etc.The BigQuery table search user interface is useful in for this test run. The test tier points to the isb-etl-open. ISB-CGC BigQuery table search [test tier](https://isb-cgc-test.appspot.com/bq_meta_search/).... | # clinical case_id counts table reuslts below
# Query below will display the number of cases presents in this table.
clin_table = Table('`isb-project-zero.GDC_Clinical_Data.rel24_clin_MMRF_fam_hist`')
clin_query = Query.from_(clin_table) \
.select(' DISTINCT case_id, count(*) as count') \
... | _____no_output_____ | Apache-2.0 | GDC_release_24/QC- ETL of GDC release 24 MMRF clincal tables.ipynb | madelyngreyes/ETLNextGenQCNotebooks |
test 5 - duplication verifcation**5. Check for any duplicate rows present in the table** | %%bigquery --project isb-project-zero
SELECT count(case_id) AS count
FROM `isb-project-zero.GDC_Clinical_Data.rel24_clin_MMRF_fam_hist`
group by fam_hist__family_history_id, case_id, fam_hist__relative_with_cancer_history, fam_hist__relationship_primary_diagnosis, fam_hist__relationship_type, fam_hist__relationship_ge... | _____no_output_____ | Apache-2.0 | GDC_release_24/QC- ETL of GDC release 24 MMRF clincal tables.ipynb | madelyngreyes/ETLNextGenQCNotebooks |
test 6 - case_id master clinical data table count verifcation**6. Verify case_id count of table against master rel_clinical_data table** | # case_id count from the program MMRF clinical table
%%bigquery --project isb-project-zero
select distinct case_id, count(case_id) as count
from `isb-project-zero.GDC_Clinical_Data.rel24_clin_MMRF`
group by case_id
order by count
# case_id count from the program MMRF_fam_hist clinical table
%%bigquery --project isb... | _____no_output_____ | Apache-2.0 | GDC_release_24/QC- ETL of GDC release 24 MMRF clincal tables.ipynb | madelyngreyes/ETLNextGenQCNotebooks |
Clin MMRF_follow**Testing Full ID** `isb-project-zero.GDC_Clinical_Data.rel23_clin_MMRF_follow`[Table location](https://console.cloud.google.com/bigquery?project=high-transit-276919&authuser=2&p=isb-project-zero&d=GDC_metadata&t=rel23_fileData_legacy&page=table)Source : GDC APIRelease version : v24 test 1 - schema veri... | #return all table information for rel24_clin_MMRF_follow
clin_table = Table('`isb-project-zero`.GDC_Clinical_Data.INFORMATION_SCHEMA.TABLES')
clin_query = Query.from_(clin_table) \
.select(' table_catalog, table_schema, table_name, table_type ') \
.where(clin_table.table_name=='rel2... | Are there any empty cells in the table schema?
| Apache-2.0 | GDC_release_24/QC- ETL of GDC release 24 MMRF clincal tables.ipynb | madelyngreyes/ETLNextGenQCNotebooks |
FIELD Descriptions pulled example below | #list of field descriptions for table rel24_clin_MMRF_follow
clin_table = Table('`isb-project-zero`.GDC_Clinical_Data.INFORMATION_SCHEMA.COLUMN_FIELD_PATHS')
clin_query = Query.from_(clin_table) \
.select('table_name, column_name, description') \
.where(clin_table.table_name=='rel24... | table_name ... description
0 rel24_clin_MMRF_follow ... Reference to ancestor follow__follow_up_id, lo...
1 rel24_clin_MMRF_follow ... Reference to ancestor case_id, located in rel2...
2 rel24_clin_MMRF_follow ... Total child record count (located in cases... | Apache-2.0 | GDC_release_24/QC- ETL of GDC release 24 MMRF clincal tables.ipynb | madelyngreyes/ETLNextGenQCNotebooks |
test 2 - row number verification**2. Look at table row number and size**Do these metrics make sense? | %%bigquery --project isb-project-zero
SELECT COUNT(case_id)
FROM `isb-project-zero.GDC_Clinical_Data.rel24_clin_MMRF_follow`
%%bigquery --project isb-project-zero
SELECT COUNT(case_id)
FROM `isb-project-zero.GDC_Clinical_Data.rel23_clin_MMRF_follow`
%%bigquery --project isb-project-zero
SELECT *
FROM `isb-project-zero.... | _____no_output_____ | Apache-2.0 | GDC_release_24/QC- ETL of GDC release 24 MMRF clincal tables.ipynb | madelyngreyes/ETLNextGenQCNotebooks |
test 3 - manual verification**3. Scroll through table manually**See if anything stands out - empty columns, etc.The BigQuery table search user interface is useful in for this test run. The test tier points to the isb-etl-open. ISB-CGC BigQuery table search [test tier](https://isb-cgc-test.appspot.com/bq_meta_search/).... | # clinical case_id counts table reuslts below
# Query below will display the number of cases presents in this table.
clin_table = Table('`isb-project-zero.GDC_Clinical_Data.rel24_clin_MMRF_follow`')
clin_query = Query.from_(clin_table) \
.select(' DISTINCT case_id, count(*) as count') \
... | _____no_output_____ | Apache-2.0 | GDC_release_24/QC- ETL of GDC release 24 MMRF clincal tables.ipynb | madelyngreyes/ETLNextGenQCNotebooks |
test 5 - duplication verifcation**5. Check for any duplicate rows present in the table** | %%bigquery --project isb-project-zero
SELECT count(case_id) AS count
FROM `isb-project-zero.GDC_Clinical_Data.rel24_clin_MMRF_follow`
group by follow__follow_up_id, case_id, follow__mol_test__count, follow__days_to_follow_up, follow__height, follow__weight, follow__ecog_performance_status, follow__state, follow__creat... | _____no_output_____ | Apache-2.0 | GDC_release_24/QC- ETL of GDC release 24 MMRF clincal tables.ipynb | madelyngreyes/ETLNextGenQCNotebooks |
test 6 - case_id master clinical data table count verifcation**6. Verify case_id count of table against master rel_clinical_data table** | # case_id count from the program MMRF clinical table
%%bigquery --project isb-project-zero
select distinct case_id, count(case_id) as count
from `isb-project-zero.GDC_Clinical_Data.rel24_clin_MMRF`
group by case_id
order by count
# case_id count from the program MMRF_follow clinical table
%%bigquery --project isb-p... | _____no_output_____ | Apache-2.0 | GDC_release_24/QC- ETL of GDC release 24 MMRF clincal tables.ipynb | madelyngreyes/ETLNextGenQCNotebooks |
Clin MMRF_follow__mol_test**Testing Full ID** `isb-project-zero.GDC_Clinical_Data.rel24_clin_MMRF_follow__mol_test`[Table location](https://console.cloud.google.com/bigquery?project=high-transit-276919&authuser=2&p=isb-project-zero&d=GDC_metadata&t=rel23_fileData_slide2caseIDmap&page=table)Source : GDC APIRelease versi... | #return all table information for rel24_clin_MMRF_follow__mol_test
clin_table = Table('`isb-project-zero`.GDC_Clinical_Data.INFORMATION_SCHEMA.TABLES')
clin_query = Query.from_(clin_table) \
.select(' table_catalog, table_schema, table_name, table_type ') \
.where(clin_table.table_n... | Are there any empty cells in the table schema?
| Apache-2.0 | GDC_release_24/QC- ETL of GDC release 24 MMRF clincal tables.ipynb | madelyngreyes/ETLNextGenQCNotebooks |
FIELD Descriptions pulled example below | #list of field descriptions for table rel24_clin_MMRF_follow__mol_test
clin_table = Table('`isb-project-zero`.GDC_Clinical_Data.INFORMATION_SCHEMA.COLUMN_FIELD_PATHS')
clin_query = Query.from_(clin_table) \
.select('table_name, column_name, description') \
.where(clin_table.table_na... | table_name ... description
0 rel24_clin_MMRF_follow__mol_test ...
1 rel24_clin_MMRF_follow__mol_test ... Reference to ancestor follow__follow_up_id, lo...
2 rel24_clin_MMRF_follow__mol_test ...... | Apache-2.0 | GDC_release_24/QC- ETL of GDC release 24 MMRF clincal tables.ipynb | madelyngreyes/ETLNextGenQCNotebooks |
test 2 - row number verification**2. Look at table row number and size**Do these metrics make sense? | %%bigquery --project isb-project-zero
SELECT COUNT(case_id)
FROM `isb-project-zero.GDC_Clinical_Data.rel24_clin_MMRF_follow__mol_test`
%%bigquery --project isb-project-zero
SELECT COUNT(case_id)
FROM `isb-project-zero.GDC_Clinical_Data.rel23_clin_MMRF_follow__mol_test`
%%bigquery --project isb-project-zero
SELECT *
FRO... | _____no_output_____ | Apache-2.0 | GDC_release_24/QC- ETL of GDC release 24 MMRF clincal tables.ipynb | madelyngreyes/ETLNextGenQCNotebooks |
test 3 - manual verification**3. Scroll through table manually**See if anything stands out - empty columns, etc.The BigQuery table search user interface is useful in for this test run. The test tier points to the isb-etl-open. ISB-CGC BigQuery table search [test tier](https://isb-cgc-test.appspot.com/bq_meta_search/).... | # clinical case_id counts table reuslts below
# Query below will display the number of cases presents in this table.
clin_table = Table('`isb-project-zero.GDC_Clinical_Data.rel24_clin_MMRF_follow__mol_test`')
clin_query = Query.from_(clin_table) \
.select(' DISTINCT case_id, count(*) as count') \
... | _____no_output_____ | Apache-2.0 | GDC_release_24/QC- ETL of GDC release 24 MMRF clincal tables.ipynb | madelyngreyes/ETLNextGenQCNotebooks |
test 5 - duplication verifcation**5. Check for any duplicate rows present in the table** | %%bigquery --project isb-project-zero
SELECT count(case_id) AS count
FROM `isb-project-zero.GDC_Clinical_Data.rel24_clin_MMRF_follow__mol_test`
group by follow__mol_test__molecular_test_id, follow__follow_up_id, case_id, follow__mol_test__biospecimen_type, follow__mol_test__laboratory_test, follow__mol_test__test_resu... | _____no_output_____ | Apache-2.0 | GDC_release_24/QC- ETL of GDC release 24 MMRF clincal tables.ipynb | madelyngreyes/ETLNextGenQCNotebooks |
test 6 - case_id master clinical data table count verifcation**6. Verify case_id count of table against master rel_clinical_data table** | # case_id count from the program MMRF clinical table
%%bigquery --project isb-project-zero
select distinct case_id, count(case_id) as count
from `isb-project-zero.GDC_Clinical_Data.rel24_clin_MMRF`
group by case_id
order by count
# case_id count from the program MMRF_follow clinical table
%%bigquery --project isb-p... | _____no_output_____ | Apache-2.0 | GDC_release_24/QC- ETL of GDC release 24 MMRF clincal tables.ipynb | madelyngreyes/ETLNextGenQCNotebooks |
VocabularyThis is useful only for the decoder; we get the vocab from the complete data | df = pd.read_csv("data.csv")
df = df.sample(frac=1, random_state=100).reset_index(drop=True)
df.head()
# df = df.iloc[0:10,:]
text = []
for i in range(len(df)):
t = df.loc[i][6]
text.append((t, df.loc[i][5]))
df.head()
pad_word = "<pad>"
bos_word = "<s>"
eos_word = "</s>"
unk_word = "<unk>"
pad_id = 0
bos_id = 1
e... | Total words in the vocabulary = 56347
| MIT | bert_embed_seq2seq.ipynb | arodriguezca/NLP-dataset |
Create chunks for each publication | # Every publication input will be mapped into a variable numbers of chunks (split by sentence) that are less than chunk_max_len
# These can then be batched by encoding strings, then padding them
chunk_max_len = 512
publication_ids = df['Id']
dataset_label = df['cleaned_label']
chunked_text = [[]] * len(df.index) # publ... | 4 ["In its original form, the amyloid cascade hypothesis of Alzheimer's disease holds that fibrillar deposits of amyloid are an early, driving force in pathological events leading ultimately to neuronal death. Early clinicopathologic investigations highlighted a number of inconsistencies leading to an updated hypothesi... | MIT | bert_embed_seq2seq.ipynb | arodriguezca/NLP-dataset |
Create dataset For each publication, it will return a tensor with all the chunks insideTherefore, each pass of our bi-LSTM will work with one single publication (with all the chunks inside that publication) | from transformers import BertModel, BertTokenizerFast
bert_model = BertModel.from_pretrained('bert-base-uncased').to(device)
bert_model.eval()
tokenizer = BertTokenizerFast.from_pretrained('bert-base-uncased')
from torch.nn.utils.rnn import pad_sequence
from torch.utils.data import Dataset, DataLoader
class ChunkedDa... | _____no_output_____ | MIT | bert_embed_seq2seq.ipynb | arodriguezca/NLP-dataset |
Seq2seq model Uses Bert word embeddingsMakes two predictions for each chunk |
import torch.nn as nn
class Seq2seq(nn.Module):
def __init__(self, vocab, bert_dim = 300, emb_dim = 300, hidden_dim = 300, num_layers = 2, dropout=0.1):
super().__init__()
"""
@author: Alexander Rodriguez
bert_dim: dimension of Bert embeddings
emb_dim: dimen... | tensor([[ 1, 1, 1, 1, 1, 1, 1, 1],
[ 32, 32, 180, 180, 304, 304, 3313, 3313],
[ 33, 33, 2, 2, 305, 305, 73, 73],
[ 42, 42, 0, 0, 2073, 2073, 2708, 2708],
[ 43, 43, 0, 0, 2074, 2074, 3314, 3314],
[ 44, 44, 0, ... | MIT | bert_embed_seq2seq.ipynb | arodriguezca/NLP-dataset |
EvaluationThis come is from Alex Wang, I haven't checked it. Load model | model = Seq2seq(vocab,bert_dim=768,emb_dim=256,hidden_dim=256,num_layers=2).to(device)
model.load_state_dict(torch.load("bert_word_seq2seq_model_2.pt"))
print(chunked_text[0])
print(sent)
def predict_greedy(model, sentence, max_length=100):
"""Make predictions for the given input using greedy inference.
Ar... | _____no_output_____ | MIT | bert_embed_seq2seq.ipynb | arodriguezca/NLP-dataset |
TRAINING PERFORMANCE | print("training performance")
print("micro F score")
print(fp)
print(fn)
print(tp/(tp + 1/2*(fp+fn)))
print("accuracy")
print(tp/(tp+fn))
print(len(df))
predictions = []
for i in range(2000, 3000):
temp = []
for j in chunked_text[i]:
x = predict_beam(model, j)
if x:
temp.append(x[0])
predic... | [['adni'], ['adni'], ['adni', 'adni'], ['trends in international mathematics and science study'], ['adni'], [], ['adni'], ['baltimore longitudinal study of aging', 'baltimore longitudinal study of aging blsa'], ['baltimore longitudinal study of aging'], ['coastal change analysis program'], ['census change agriculture',... | MIT | bert_embed_seq2seq.ipynb | arodriguezca/NLP-dataset |
Checking Classifer Accuracy | len(chunked_text)
count = 0
for i in predictions:
if not i:
count += 1
print(count)
testing = {}
for i in range(0, len(predictions)):
if publication_ids[2000+i] not in testing.keys():
pred = predictions[i]
print(pred)
print(df.loc[2000+i][5])
testing[publication_ids[2000+i]] = (pred, [df.... | _____no_output_____ | MIT | bert_embed_seq2seq.ipynb | arodriguezca/NLP-dataset |
Testing Performance | print("testing performance")
print("micro F score")
print(fp)
print(fn)
print(tp/(tp + 1/2*(fp+fn)))
print("accuracy")
print(tp/(tp+fn)) | testing performance
micro F score
291
356
0.6656330749354005
accuracy
0.644
| MIT | bert_embed_seq2seq.ipynb | arodriguezca/NLP-dataset |
[this doc on github](https://github.com/dotnet/interactive/tree/master/samples/notebooks/fsharp/Docs) Object formatters Default formatting behaviors When you return a value or a display a value in a .NET notebook, the default formatting behavior is to try to provide some useful information about the object. If it's an... | display ["hello"; "world"]
Enumerable.Range(1, 5) | _____no_output_____ | MIT | samples/notebooks/fsharp/Docs/Object Formatters.ipynb | haraldsteinlechner/interactive |
As you can see, the same basic structure is used whether you pass the object to the `display` method or return it as the cell's value.Similarly to the behavior for `IEnumerable` objects, you'll also see table output for dictionaries, but for each value in the dictionary, the key is provided rather than the index within... | // Cannot simply use 'dict' here, see https://github.com/dotnet/interactive/issues/12
let d = dict [("zero", 0); ("one", 1); ("two", 2)]
System.Collections.Generic.Dictionary<string, int>(d) | _____no_output_____ | MIT | samples/notebooks/fsharp/Docs/Object Formatters.ipynb | haraldsteinlechner/interactive |
The default formatting behavior for other types of objects is to produce a table showing their properties and the values of those properties. | type Person = { FirstName: string; LastName: string; Age: int }
// Evaluate a new person
{ FirstName = "Mitch"; LastName = "Buchannon"; Age = 42 } | _____no_output_____ | MIT | samples/notebooks/fsharp/Docs/Object Formatters.ipynb | haraldsteinlechner/interactive |
When you have a collection of such objects, you can see the values listed for each item in the collection: | let people =
[
{ FirstName = "Mitch"; LastName = "Buchannon"; Age = 42 }
{ FirstName = "Hobie "; LastName = "Buchannon"; Age = 23 }
{ FirstName = "Summer"; LastName = "Quinn"; Age = 25 }
{ FirstName = "C.J."; LastName = "Parker"; Age = 23 }
]
people | _____no_output_____ | MIT | samples/notebooks/fsharp/Docs/Object Formatters.ipynb | haraldsteinlechner/interactive |
Now let's try something a bit more complex. Let's look at a graph of objects. We'll redefine the `Person` class to allow a reference to a collection of other `Person` instances. | type Person =
{ FirstName: string
LastName: string
Age: int
Friends: ResizeArray<Person> }
let mitch = { FirstName = "Mitch"; LastName = "Buchannon"; Age = 42; Friends = ResizeArray() }
let hobie = { FirstName = "Hobie "; LastName = "Buchannon"; Age = 23; Friends = ResizeArray() }
let summer = {... | _____no_output_____ | MIT | samples/notebooks/fsharp/Docs/Object Formatters.ipynb | haraldsteinlechner/interactive |
That's a bit hard to read, right? The defaut formatting behaviors are thorough, but that doesn't always mean they're as useful as they might be. In order to give you more control in these kinds of cases, the object formatters can be customized from within the .NET notebook. Custom formatters Let's clean up the output ... | Formatter<ResizeArray<Person>>.Register(
fun people writer ->
for person in people do
writer.Write("person")
, mimeType = "text/plain")
people | _____no_output_____ | MIT | samples/notebooks/fsharp/Docs/Object Formatters.ipynb | haraldsteinlechner/interactive |
You might have noticed that `people` is of type `ResizeArray`, but the table output still includes columns for `LastName`, `Age`, and `Friends`. What's going on here?Notice that the custom formatter we just registered was registered for the mime type `"text/plain"`. The top-level formatter that's used when we call `dis... | Formatter<Person>.Register(
fun person writer ->
writer.Write(person.FirstName)
, mimeType = "text/plain");
people | _____no_output_____ | MIT | samples/notebooks/fsharp/Docs/Object Formatters.ipynb | haraldsteinlechner/interactive |
MAT281 - Laboratorio N°06 Problema 01 El **Iris dataset** es un conjunto de datos que contine una muestras de tres especies de Iris (Iris setosa, Iris virginica e Iris versicolor). Se midió cuatro rasgos de cada muestra: el largo y ancho del sépalo y pétalo, en centímetros.Lo primero es cargar el conjunto de datos y... | # librerias
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
pd.set_option('display.max_columns', 500) # Ver más columnas de los dataframes
# Ver gráficos de matplotlib en jupyter notebook/lab
%matplotlib inline
# cargar datos
df = pd.read_csv(os.path.join("d... | _____no_output_____ | MIT | labs/lab_06.ipynb | maryonmorales/MAT-281_MaryonMorales |
Bases del experimentoLo primero es identificar las variables que influyen en el estudio y la naturaleza de esta.* **species**: * Descripción: Nombre de la especie de Iris. * Tipo de dato: *string* * Limitantes: solo existen tres tipos (setosa, virginia y versicolor).* **sepalLength**: * Descripción: lar... | df['species'].fillna('default',inplace=True)
df
df['species'].value_counts()
#Veamos los valores que puede tomar species
df['species'].value_counts().index
#Dejamos todo sin espacios ni mayúscula
df['species'].astype('str')
df['species'] = df['species'].str.lower().str.strip()
df['species'].value_counts().index | _____no_output_____ | MIT | labs/lab_06.ipynb | maryonmorales/MAT-281_MaryonMorales |
2. Realizar un gráfico de box-plot sobre el largo y ancho de los petalos y sépalos. Reemplace por **0** los valores nan. | df['sepalLength'].fillna(0,inplace=True)
df['sepalWidth'].fillna(0,inplace=True)
df['petalLength'].fillna(0,inplace=True)
df['petalWidth'].fillna(0,inplace=True)
df_1=df.drop(['species'], axis=1)
sns.boxplot(data=df_1)
| _____no_output_____ | MIT | labs/lab_06.ipynb | maryonmorales/MAT-281_MaryonMorales |
3. Anteriormente se define un rango de valores válidos para los valores del largo y ancho de los petalos y sépalos. Agregue una columna denominada **label** que identifique cuál de estos valores esta fuera del rango de valores válidos. | lista_label = []
for i in range(len(df)):
if df['sepalLength'][i]<4.0 or df['sepalLength'][i]>7.0:
lista_label.append("sepalLength")
elif df['sepalWidth'][i]<2.0 or df['sepalWidth'][i]>4.5:
lista_label.append("sepalWidth")
elif df['petalLength'][i]<1.0 or df['petalLength']... | _____no_output_____ | MIT | labs/lab_06.ipynb | maryonmorales/MAT-281_MaryonMorales |
4. Realice un gráfico de *sepalLength* vs *petalLength* y otro de *sepalWidth* vs *petalWidth* categorizados por la etiqueta **label**. Concluya sus resultados. | # tamano del grafico
plt.figure(figsize=(10, 5))
# graficar
sns.scatterplot(
x='petalLength',
y='sepalLength',
data=df,
hue='label',
)
# tamano del grafico
plt.figure(figsize=(10, 5))
# graficar
sns.scatterplot(
x='petalWidth',
y='sepalWidth',
data=df... | _____no_output_____ | MIT | labs/lab_06.ipynb | maryonmorales/MAT-281_MaryonMorales |
Vemos en ambos gráficos que los largos y anchos de los sépalos y los pétalos están en su mayoría dentro de los rangos, además podemos observar que la columna sepalLength es la que mas errada está. 5. Filtre los datos válidos y realice un gráfico de *sepalLength* vs *petalLength* categorizados por la etiqueta **species*... | mask_sl = df['sepalLength']<=7.0
mask_sl1 = df['sepalLength']>=4.0
mask_sw = df['sepalWidth']<=4.5
mask_sw1 = df['sepalWidth']>=2.0
mask_pl = df['petalLength']<=7.0
mask_pl1 = df['petalLength']>=1.0
mask_pw = df['petalWidth']<=2.5
mask_pw1 = df['petalWidth']>=0.1
df_filtrado = df[mask_sl & mask_sw & mask_pl & m... | _____no_output_____ | MIT | labs/lab_06.ipynb | maryonmorales/MAT-281_MaryonMorales |
Polarization**Prerequisite: Basic Introduction**In this notebook parameterization of the polarization primitives and few methods derived from the primitives are presented. In particular, setting up of* General parameters* Current/voltage range* Current/voltage limits* Online display* Tolerance limitsis explained in de... | from zahner_potentiostat.scpi_control.searcher import SCPIDeviceSearcher
from zahner_potentiostat.scpi_control.serial_interface import SerialCommandInterface, SerialDataInterface
from zahner_potentiostat.scpi_control.control import *
from zahner_potentiostat.scpi_control.datahandler import DataManager
from zahner_poten... | _____no_output_____ | MIT | Examples/Polarizations/Polarizations.ipynb | Zahner-elektrik/Zahner-Remote-Python |
Setting up general parametersAt first, general parameters are set which will be used in all primitives to be executed.[setRaiseonErrorEnabled(True)](https://doc.zahner.de/zahner_potentiostat/scpi_control/control.html?highlight=setraiseonerrorenabledzahner_potentiostat.scpi_control.control.SCPIDevice.setRaiseOnErrorEna... | ZahnerPP2x2.setRaiseOnErrorEnabled(True)
ZahnerPP2x2.setSamplingFrequency(50) | _____no_output_____ | MIT | Examples/Polarizations/Polarizations.ipynb | Zahner-elektrik/Zahner-Remote-Python |
The **mains power-line frequency** of the device is pre-set to the customer's mains frequency before delivery.To ensure the correct frequency value, the user must also provide the **mains power-line frequency** with which the device will be operated. **The mains frequency is stored in the device's internal memory and r... | ZahnerPP2x2.setLineFrequency(50) | _____no_output_____ | MIT | Examples/Polarizations/Polarizations.ipynb | Zahner-elektrik/Zahner-Remote-Python |
Each potentiostat is factory-calibrated before delivery. The calibration is carried out after potentiostat's warm-up time of 30 minutes.With the following primitive, the users may calibrate the potentiostat again. However it is strongly recommended to start calibration after a warm up time of 30 minutes. The calibratio... | ZahnerPP2x2.calibrateOffsets() | _____no_output_____ | MIT | Examples/Polarizations/Polarizations.ipynb | Zahner-elektrik/Zahner-Remote-Python |
Set current ranging parametersIn the following code, at first, autoranging of the current range is carried out.If possible, **autoranging should be avoided**, as autoranges provide noisy measurement results, since the shunt change causes disturbances. It also takes time for the measuring device to find the correct cur... | ZahnerPP2x2.setAutorangingEnabled(True)
ZahnerPP2x2.setInterpolationEnabled(True)
ZahnerPP2x2.setShuntIndex(1)
#or
ZahnerPP2x2.setCurrentRange(20)
ZahnerPP2x2.setMinimumShuntIndex(1)
ZahnerPP2x2.setMaximumShuntIndex(3) | _____no_output_____ | MIT | Examples/Polarizations/Polarizations.ipynb | Zahner-elektrik/Zahner-Remote-Python |
Set voltage rangeThe voltage range index must be selected manually. This is not switched automatically. The range can be set like the current by shunt index or by desired maximum working range. The maximum voltages for each range can be found in the manual of the potentiostat. | ZahnerPP2x2.setVoltageRangeIndex(0)
#or
ZahnerPP2x2.setVoltageRange(2.5) | _____no_output_____ | MIT | Examples/Polarizations/Polarizations.ipynb | Zahner-elektrik/Zahner-Remote-Python |
Set current and voltage limits**The voltage limits are always absolute values and not related to the OCV.** If the limits are exceeded, the potentiostat switches off and the device assumes an error state. Danger: Limits are monitored only in primitives. If only the potentiostat is switched on, neither measurement n... | ZahnerPP2x2.setMinimumCurrentGlobal(-30)
ZahnerPP2x2.setMaximumCurrentGlobal(30)
ZahnerPP2x2.setGlobalCurrentCheckEnabled(True)
ZahnerPP2x2.setMinimumVoltageGlobal(0)
ZahnerPP2x2.setMaximumVoltageGlobal(2.5)
ZahnerPP2x2.setGlobalVoltageCheckEnabled(True) | _____no_output_____ | MIT | Examples/Polarizations/Polarizations.ipynb | Zahner-elektrik/Zahner-Remote-Python |
Starting the live data displayWith the following command, a plotting window can be opened, in which the measured voltage and current values from the measuring device are displayed live.The function executionInNotebook() is used to check if the execution is taking place in Jupyter notebook or not. As the Jupyter cannot... | onlineDisplay = None
if executionInNotebook() == False:
onlineDisplay = OnlineDisplay(ZahnerPP2x2.getDataReceiver()) | _____no_output_____ | MIT | Examples/Polarizations/Polarizations.ipynb | Zahner-elektrik/Zahner-Remote-Python |
Polarisation at OCV/OCP with change tolerance abortAs a first example, a potential jump is output at the open circuit voltage/potential of a supercap, then polarization is performed until the current change is below a defined value. In the following, OCV is always used, which is the same as OCP.For this measurement, ... | ZahnerPP2x2.setAutorangingEnabled(False)
ZahnerPP2x2.setShuntIndex(1) | _____no_output_____ | MIT | Examples/Polarizations/Polarizations.ipynb | Zahner-elektrik/Zahner-Remote-Python |
Setting the measurement on the OCVIn order to measure with a defined potential, potentiostatic mode is chosen. | ZahnerPP2x2.setCoupling(COUPLING.POTENTIOSTATIC) | _____no_output_____ | MIT | Examples/Polarizations/Polarizations.ipynb | Zahner-elektrik/Zahner-Remote-Python |
The first command [setVoltageRelation()](https://doc.zahner.de/zahner_potentiostat/scpi_control/control.htmlzahner_potentiostat.scpi_control.control.SCPIDevice.setVoltageRelation) sets the voltage value, assigned to the [setVoltageValue()](https://doc.zahner.de/zahner_potentiostat/scpi_control/control.htmlzahner_potent... | ZahnerPP2x2.setVoltageRelation(RELATION.OCV)
ZahnerPP2x2.setVoltageParameterRelation("OCV") | _____no_output_____ | MIT | Examples/Polarizations/Polarizations.ipynb | Zahner-elektrik/Zahner-Remote-Python |
Setting up tolerance limitsIn the subsection, the tolerance limits are defined. The tolerance limit refers to the complementary quantity (current in the potentiostatic and the voltage in the galvanostatic mode). In the OCV scan, this value also refers to the voltage.The absolute tolerance is defined as a change in amp... | ZahnerPP2x2.setAbsoluteTolerance(0.001)
ZahnerPP2x2.setRelativeTolerance(0.000)
ZahnerPP2x2.setToleranceBreakEnabled(True) | _____no_output_____ | MIT | Examples/Polarizations/Polarizations.ipynb | Zahner-elektrik/Zahner-Remote-Python |
A minumum and maximum time can also be defined in regards to the tolerance limits. The minimum time provides the times for which the test object should be polarized. If the voltage or current tolerance is met before the minimum defined time is passed then the polarization is carried out till the minimum time is passed.... | ZahnerPP2x2.setMinimumTimeParameter(10) | _____no_output_____ | MIT | Examples/Polarizations/Polarizations.ipynb | Zahner-elektrik/Zahner-Remote-Python |
If the tolerance is not reached, the polarization should be terminated after the maximum time at the latest.Here the second input possibility of the time is selected. Either the time is entered in seconds as a floating point number or as a string. As string, the user has the possibility to enter a time unit (s, min, m... | ZahnerPP2x2.setMaximumTimeParameter("1 m") | _____no_output_____ | MIT | Examples/Polarizations/Polarizations.ipynb | Zahner-elektrik/Zahner-Remote-Python |
Execute the primitivesNext, the voltage is set, which is outputted when the pot is switched on.The potentiostat is turned on before the primitives, then it stays on after the primitives as long as no global limits are exceeded in the primitive. | ZahnerPP2x2.setVoltageValue(0) | _____no_output_____ | MIT | Examples/Polarizations/Polarizations.ipynb | Zahner-elektrik/Zahner-Remote-Python |
Now the open circuit voltage is measured, which is used as a reference for the commands related to the | print("open circuit reference voltage: " + str(ZahnerPP2x2.measureOCV()) + " V")
ZahnerPP2x2.setPotentiostatEnabled(True)
ZahnerPP2x2.setVoltageParameter(0.1) #OCV + 0.1
ZahnerPP2x2.measurePolarization()
ZahnerPP2x2.setVoltageParameter(0) #OCV
ZahnerPP2x2.measurePolarization()
... | _____no_output_____ | MIT | Examples/Polarizations/Polarizations.ipynb | Zahner-elektrik/Zahner-Remote-Python |
Plot the data | dataReceiver = ZahnerPP2x2.getDataReceiver()
dataManager = DataManager(dataReceiver)
dataManager.plotTIUData() | _____no_output_____ | MIT | Examples/Polarizations/Polarizations.ipynb | Zahner-elektrik/Zahner-Remote-Python |
Reset configurationsNow the specific example configurations are reset to the default configuration, which are not needed for the next example. | ZahnerPP2x2.setToleranceBreakEnabled(False)
ZahnerPP2x2.setVoltageRelation(RELATION.ZERO)
ZahnerPP2x2.setVoltageParameterRelation(RELATION.ZERO)
dataReceiver.deletePoints()
ZahnerPP2x2.setAutorangingEnabled(True) | _____no_output_____ | MIT | Examples/Polarizations/Polarizations.ipynb | Zahner-elektrik/Zahner-Remote-Python |
Polarization - aborted with charge limitThe following example shows how polarizing primitives can be aborted on reaching a chargelimit.The settings of the global limits of current and voltage remain to protect the supercapacitor. Setting up the measurementHere galvanostatic measurement is performed, which makes it ea... | ZahnerPP2x2.setCoupling(COUPLING.GALVANOSTATIC) | _____no_output_____ | MIT | Examples/Polarizations/Polarizations.ipynb | Zahner-elektrik/Zahner-Remote-Python |
Setting up the charge conditionsThe supercapacitor is charged by 100 As and then discharged by 50 As. | ZahnerPP2x2.setMaximumCharge(100)
ZahnerPP2x2.setMinimumCharge(-50)
ZahnerPP2x2.setChargeBreakEnabled(True) | _____no_output_____ | MIT | Examples/Polarizations/Polarizations.ipynb | Zahner-elektrik/Zahner-Remote-Python |
Execute the primitivesThe maximum time is set to 2 minutes.Charging to 100 As with 2 A charging current should take 50 seconds. Similarly discharging to -50 As with -2 A discharging currents should take 25 seconds. | ZahnerPP2x2.setMaximumTimeParameter("2 m") | _____no_output_____ | MIT | Examples/Polarizations/Polarizations.ipynb | Zahner-elektrik/Zahner-Remote-Python |
Set the current to 2 A and measure the polarization to charge the supercapacitor. | ZahnerPP2x2.setCurrentParameter(2)
ZahnerPP2x2.measurePolarization() | _____no_output_____ | MIT | Examples/Polarizations/Polarizations.ipynb | Zahner-elektrik/Zahner-Remote-Python |
Set a discharge current of -2 A. The charging and discharging parameters can be customized individually. | ZahnerPP2x2.setCurrentParameter(-2)
ZahnerPP2x2.measurePolarization() | _____no_output_____ | MIT | Examples/Polarizations/Polarizations.ipynb | Zahner-elektrik/Zahner-Remote-Python |
Plot the dataThe dataManager measured data can be easily plotted. | dataManager.plotTIUData() | _____no_output_____ | MIT | Examples/Polarizations/Polarizations.ipynb | Zahner-elektrik/Zahner-Remote-Python |
The voltage jump at 50 s (observed at the current polarity change) is due to the internal resistance of the supercapacitor, which is about 4 mΩ. Reset configurationsAgain the configurations are reset to the default configuration, which are not needed for the next example. | ZahnerPP2x2.setChargeBreakEnabled(False)
dataReceiver.deletePoints() | _____no_output_____ | MIT | Examples/Polarizations/Polarizations.ipynb | Zahner-elektrik/Zahner-Remote-Python |
Charging and discharging routinesThe following example shows how to charge and discharge a supercapacitor with the polarization primitive.The settings of the global limits of current and voltage remain to protect the supercapacitor. Setting the measurementThe supercapacitor is galvanostatically charged. | ZahnerPP2x2.setCoupling(COUPLING.GALVANOSTATIC) | _____no_output_____ | MIT | Examples/Polarizations/Polarizations.ipynb | Zahner-elektrik/Zahner-Remote-Python |
Setting the reversal potentialsThe supercapactor is cycled between 1 V and 2 V. To realize this, the functional voltage drop is set to 1 V and 2 V for the polarization primitive.Here, at the beginning of the primitive the minimum and maximum values must also be observed. Depending on test object, the minimum voltage... | ZahnerPP2x2.setMinimumVoltageParameter(1)
ZahnerPP2x2.setMaximumVoltageParameter(2)
ZahnerPP2x2.setMinMaxVoltageParameterCheckEnabled(True) | _____no_output_____ | MIT | Examples/Polarizations/Polarizations.ipynb | Zahner-elektrik/Zahner-Remote-Python |
Charging the super capacitor with 10 A current will charge the capacitor to 2 V in 20 seconds hence the maximum charging time is set to 30 seconds.For safety, a maximum time must always be specified with this primitive can be switched off. | ZahnerPP2x2.setMaximumTimeParameter("30 s") | _____no_output_____ | MIT | Examples/Polarizations/Polarizations.ipynb | Zahner-elektrik/Zahner-Remote-Python |
Execute the primitives | ZahnerPP2x2.setCurrentParameter(10)
ZahnerPP2x2.measurePolarization() | _____no_output_____ | MIT | Examples/Polarizations/Polarizations.ipynb | Zahner-elektrik/Zahner-Remote-Python |
After charging the possibly empty electrolytic capacitor, now the lower voltage limit can be adjusted. | ZahnerPP2x2.setMinimumVoltageParameter(1) | _____no_output_____ | MIT | Examples/Polarizations/Polarizations.ipynb | Zahner-elektrik/Zahner-Remote-Python |
Afterwards, two cycles of charging nad discharging are carried out. | cycles = 2
for i in range(cycles):
ZahnerPP2x2.setCurrentParameter(-10)
ZahnerPP2x2.measurePolarization()
ZahnerPP2x2.setCurrentParameter(10)
ZahnerPP2x2.measurePolarization() | _____no_output_____ | MIT | Examples/Polarizations/Polarizations.ipynb | Zahner-elektrik/Zahner-Remote-Python |
At the end, the supercapcitor will have a voltage of 1 V. | ZahnerPP2x2.setCurrentParameter(-10)
ZahnerPP2x2.measurePolarization() | _____no_output_____ | MIT | Examples/Polarizations/Polarizations.ipynb | Zahner-elektrik/Zahner-Remote-Python |
Instead of manually composing the charge or discharge with primitives, user may also use the charge [measureCharge()](https://doc.zahner.de/zahner_potentiostat/scpi_control/control.htmlzahner_potentiostat.scpi_control.control.SCPIDevice.measureCharge) and discharge [measureDischarge()](https://doc.zahner.de/zahner_pote... | dataManager.plotTIUData() | _____no_output_____ | MIT | Examples/Polarizations/Polarizations.ipynb | Zahner-elektrik/Zahner-Remote-Python |
Reset configurationsNow the specific example configurations are reset to the default configuration, which are not needed for the next example. | ZahnerPP2x2.setMinMaxVoltageParameterCheckEnabled(False)
dataReceiver.deletePoints() | _____no_output_____ | MIT | Examples/Polarizations/Polarizations.ipynb | Zahner-elektrik/Zahner-Remote-Python |
Open circuit voltage scanThe following example shows how to record the open circuit voltage scan.In principle, the open circuit voltage scan [measureOCVScan()](https://doc.zahner.de/zahner_potentiostat/scpi_control/control.htmlzahner_potentiostat.scpi_control.control.SCPIDevice.measureOCVScan) is same as a galvanostat... | ZahnerPP2x2.setMaximumTimeParameter("2 min")
ZahnerPP2x2.setSamplingFrequency(1) | _____no_output_____ | MIT | Examples/Polarizations/Polarizations.ipynb | Zahner-elektrik/Zahner-Remote-Python |
Execute the primitiveThe primitve can simply be started, nothing else needs to be configured. | ZahnerPP2x2.measureOCVScan() | _____no_output_____ | MIT | Examples/Polarizations/Polarizations.ipynb | Zahner-elektrik/Zahner-Remote-Python |
Plot the data | dataManager.plotTIUData() | _____no_output_____ | MIT | Examples/Polarizations/Polarizations.ipynb | Zahner-elektrik/Zahner-Remote-Python |
Close the connectionClosing the online display when it has been opened and close the connection to the device. | if onlineDisplay != None:
onlineDisplay.close()
ZahnerPP2x2.close()
print("finish") | finish
| MIT | Examples/Polarizations/Polarizations.ipynb | Zahner-elektrik/Zahner-Remote-Python |
Deployment of the source code**The following instruction is not needed by the user.**It automatically extracts the pure python code from the jupyter notebook to provide it for the user. Thus the user does not need jupyter itself and does not have to copy the code manually.The code is stored in a notebook-like file wi... | if executionInNotebook() == True:
notebookCodeToPython("Polarizations.ipynb") | _____no_output_____ | MIT | Examples/Polarizations/Polarizations.ipynb | Zahner-elektrik/Zahner-Remote-Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.