> ## Documentation Index
> Fetch the complete documentation index at: https://docs.archetypeai.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Machine State Lens

> Learn how to use the Machine State Lens with CSV files.

The **Machine State Lens** classifies the operational state of a machine using its sensor measurements. Use the [Machine State Lens](/core-concepts/lenses/lens-templates/machine-state) to analyze time series sensor data and detect different machine states from your CSV files.

## 1. Access the Workbench

<Steps>
  <Step title="Login to Console">
    Use your API key and log into the [Console](https://console.u1.archetypeai.app/workbench). Click on "Workbench" in the navigation bar.
  </Step>
</Steps>

<Info>
  Make sure you have an active api key for the Archetype platform, and you're able to login to the console. If you have any problems, please contact [support@archetypeai.](mailto:support@archetypeai.dev)dev
</Info>

## 2. Select a Lens

In the Workbench, the Lens name appears at the bottom of the screen. Click the name to open a tray showing all lenses available to your organization.

<Steps>
  <Step title="Select the Lens">
    Select the lens named 'Machine State Lens' from the lens tray.
  </Step>
</Steps>

## 3. Upload Your CSV File

The Machine State Lens works with time series data in .CSV format.

<Steps>
  <Step title="Choose File">
    At the top right of the input panel, you'll see a dropdown called "select.csv". Select a .CSV file you've already uploaded, or upload your own.

    We can start with this vibration example: [data.csv](https://drive.google.com/file/d/1zizePdJ1gsUHI-6Kp3Jfe22QJwjxuz28/view?usp=drive_link).

    <img src="https://mintcdn.com/archetypeai-bd6fb3cf/qes6ODpwcmU4YHjL/images/upload_csv2.png?fit=max&auto=format&n=qes6ODpwcmU4YHjL&q=85&s=d5f622147abf92fbc22a132039ae49d1" alt="Upload Csv2" width="1344" height="446" data-path="images/upload_csv2.png" />
  </Step>
</Steps>

<Warning>
  CSV files must be properly formatted with sensor recordings. Each row should represent a single time sample and include a timestamp column (unix time) and one or more numeric sensor channels (a1 to an).
</Warning>

## 4. Edit Lens Parameters

Lens parameters control how a Lens processes and analyzes data. To begin, add the n-shot examples provided below.

<Steps>
  <Step title="Access Lens Details">
    Click on the lens name to view and modify the Lens parameters.
  </Step>

  <Step title="Add N Shot Examples">
    Add N Shot examples that represent the states you'd like to classify.\
    Download our sample CSV files to follow along:

    * [healthy.csv](https://drive.google.com/file/d/1HK5EKvPWj_acMYB2SeBgAbzMEEtunn_6/view?usp=drive_link) - Normal operating conditions
    * [broken.csv](https://drive.google.com/file/d/1hq1xyl9DBD_J1Legux3teypH1smvZfJm/view?usp=drive_link) - Equipment failure or malfunction

          <img src="https://mintcdn.com/archetypeai-bd6fb3cf/qes6ODpwcmU4YHjL/images/n_shot.png?fit=max&auto=format&n=qes6ODpwcmU4YHjL&q=85&s=a05c47925671085a29a164c9aa07df85" alt="N Shot" width="1146" height="424" data-path="images/n_shot.png" />
  </Step>
</Steps>

Learn more about the additional parameters such as window size, step size, and data columns when working with your own data [here](https://docs.archetypeai.app/core-concepts/lenses/lens-templates/machine-state).

## 5. Start Your Session and View Results

<Steps>
  <Step title="Run Session">
    Begin the analysis by clicking the arrow button in the bottom right of the screen to start the session. The session will process your CSV data with the Machine State Lens and your specified focus.
  </Step>

  <Step title="View Results">
    Once processing begins, you'll see analysis results appear for your time series data. Click on any result to see the corresponding time window and view how the lens classifies different periods based on your labeled states.

    <CodeGroup>
      ```text Example Output theme={"system"}
      [12:34:56] healthy
      [12:45:12] broken
      [13:02:34] healthy
      ```
    </CodeGroup>
  </Step>
</Steps>

## 6. Access Developer Logs (Optional)

For debugging and detailed analysis, you can expand the session logs panel above the focus bar.

<img src="https://mintcdn.com/archetypeai-bd6fb3cf/YEfKEIpyG2GqkxyQ/images/ms_logs.png?fit=max&auto=format&n=YEfKEIpyG2GqkxyQ&q=85&s=6e8cf0ea44d01ded1c12479b2c35cd92" alt="Ms Logs" width="2374" height="578" data-path="images/ms_logs.png" />

<Check>
  Congratulations! You've successfully run your first Lens Workbench session without writing any code.
</Check>

## Next Steps

Try your own .csv files, and adjust the n shot examples and parameters based on your use case. A guide on recording your own data and examples is coming soon.

## Learn More

<CardGroup cols={2}>
  <Card title="Quickstart" icon="terminal" href="/introduction/getting-started">
    Try a quickstart tutorial in the terminal to get started with CSV files.
  </Card>

  <Card title="Lens API Reference" icon="code" href="/api-reference/lens">
    Ready to integrate Newton into your application? Explore the Lens API documentation
  </Card>
</CardGroup>
