<jupyter_start><jupyter_text>Upgrade RuntimeThis cell ensures the runtime supports `asyncio` async/await, and is needed on Google Colab. If the runtime is upgraded, you will be prompted to restart it, which you should do before continuing execution.<jupyter_code>!pip install "ipython>=7"<jupyter_output><empty_output><jupyter_text>Set Up Environment  Import required libraries<jupyter_code>!pip install -q canopy
import canopy
import logging
import nest_asyncio

logging.basicConfig(level=logging.INFO)
nest_asyncio.apply()<jupyter_output><empty_output><jupyter_text>Authenticate<jupyter_code>authentication_data = canopy.prompt_for_authentication()
session = canopy.Session(authentication_data)<jupyter_output><empty_output><jupyter_text>Set Up Example  Run a simulation using default configs<jupyter_code>default_car_name = 'Canopy F1 Car 2019'
default_weather_name = '25 deg, dry'
   
logging.info('Loading configs...')

default_car = await canopy.load_default_config(session, 'car', default_car_name)
default_weather = await canopy.load_default_config(session, 'weather', default_weather_name)

logging.info('Creating study...')

study_id = await canopy.create_study(
    session,
    'apexSim',
    'Python API Test Study',
    [
        default_car,
        default_weather,
    ])

logging.info('Waiting for study to complete...')

wait_result = await canopy.wait_for_study(
    session,
    study_id,
    timeout_seconds=60)

logging.info('Sim Version: {}'.format(wait_result.document.sim_version))    
logging.info('Succeded Simulations: {}/{}'.format(
    wait_result.succeeded_simulation_count, 
    wait_result.simulation_count))<jupyter_output>INFO:root:Loading configs...
INFO:root:Creating study...
INFO:root:Waiting for study to complete...
INFO:root:Sim Version: 1.3371
INFO:root:Succeded Simulations: 1/1<jupyter_text>Example: Load all channel data_Note:_ For performance reasons it is usually recommended to load only the channels you need. However loading all channels is possible by first fetching the channel list from the vector metadata.<jupyter_code>job_metadata = await canopy.load_study_job(
    session,
    study_id,
    'ApexSim',
    include_vector_metadata=True)

job_metadata.vector_metadata<jupyter_output>INFO:canopy.load_study_job:Loading job index 0<jupyter_text>The vector_metadata is a DataFrame indexed by the channel name, so we can extract the list of channels by asking for the index column.<jupyter_code>all_channels = job_metadata.vector_metadata.index
all_channels<jupyter_output><empty_output><jupyter_text>We can now pass that list back into the `load_study_job` function to load all the channel data.<jupyter_code>job_data = await canopy.load_study_job(
    session,
    study_id,
    'ApexSim',
    channel_names=all_channels)

logging.info('Loaded {} channels'.format(len(job_data.vector_data.columns)))
job_data.vector_data<jupyter_output><empty_output><jupyter_text>Once these are loaded we can request individual channels in specific units as per usual.<jupyter_code>job_data.vector_as('hRideF', 'mm')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08911211924821776, 'fraction_numerical': 0.005832793259883344, 'mean_word_length': 6.315165876777251, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 32, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '8', 'dir': 'jupyter-structured-clean-dedup', 'id': '121754', 'license': 'MIT', 'n_tokens_mistral': 1004, 'n_tokens_neox': 953, 'n_words': 238, 'path': 'loading_all_vector_results.ipynb', 'repo_name': 'CanopySimulations/canopy-python-examples', 'size': '3086'}