Jump to content

Kristopher Wiggins

Seeq Team
  • Posts

    52
  • Joined

  • Last visited

  • Days Won

    18

Community Answers

  1. Kristopher Wiggins's post in Excel Export of Capsule that ends off screen was marked as the answer   
    For others running into this, the export was being performed in Capsule Time view. As of R62, Capsule Time only display capsules that are fully enclosed in the display, and as a result the subsequent export also only showed these capsules. To see these capsules, the display range had to be increased. In the case of the current capsule, we had to expand the display range to be slightly in the future.
  2. Kristopher Wiggins's post in help with rollups was marked as the answer   
    Hi David,
    In my testing on a subset of your tree, the insertion worked when removing the forward slashes from the roll_up_parameters. If this doesn't work for you it may be easier to work through it together over an Office Hours session.
    DCS_Cont_Tree.insert(name = 'Unit Total',                  roll_up_statistic = 'Counts',                  roll_up_parameters = '.*x.* >> Nonconforming',                  parent='Unit_??')
  3. Kristopher Wiggins's post in Is there a way to pull scorecard metrics? was marked as the answer   
    To follow up on this item, currently there is not a simple way to export Scorecard data into Seeq. In R53, Seeq added a copy button to Table View allowing users to Copy the table and paste into other applications like Excel. Please email support@seeq.com in order to create a ticket in our system so you'll be notified when there is an easy way to export scorecard data to Seeq Data Lab.
    Below is an example of a script that exports scorecard data using the SDK. What is exported are the samples shown when the scorecard is trended in Trend View and whether they're uncertain/subject to change. Note: This code was developed based on Seeq R53.3.0. Its common for Seeq to edit its SDK to enable new features so this code may not work for other versions of Seeq. Using the Seeq Python module (SPy) is the only certain way to ensure scripts will work across versions.
    from seeq import sdk # Include from seeq import spy and spy.login commands if not working in Seeq Data Lab import pandas as pd import datetime as dt formAPI = sdk.FormulasApi(spy.client) metricAPI = sdk.MetricsApi(spy.client) ############################################################### User Input Area ######################################################################## workbench_url = "https://explore.seeq.com/9C3916CE-0778-489C-90EE-7BC4C5734640/workbook/66D753DE-9189-4E8D-BE65-AB7BA6408EC8/worksheet/B476B826-4345-4699-8516-45F87AD50571" ######################################################################################################################################################## # Pull in the metrics displayed on the worksheet as well as its display range analysis_items = spy.search(workbench_url, quiet=True) analysis_metrics = analysis_items[analysis_items['Type'].str.contains('Metric')] analysis_metrics.reset_index(drop=True, inplace=True) pulled_analysis = spy.workbooks.pull(spy.workbooks.search({"ID":spy.utils.get_workbook_id_from_url(workbench_url)}, recursive=True, quiet=True), quiet=True) for ws in pulled_analysis[0].worksheets: if spy.utils.get_worksheet_id_from_url(workbench_url)==ws.id: display_range = ws.display_range # Define function to extract scorecard metric data (data is based on trended metric, not its tabular value) def extract_metric_data(metric_id, start_time, end_time): metric = metricAPI.get_metric(id=metric_id) metric_calc_id = metric.display_item.id metric_name = metric.name # API Exception 400 happens for Simple Metrics, use different SDK parameters for it try: result = formAPI.run_formula( start=start_time, end=end_time, formula="$series", parameters=["series="+metric_calc_id], limit = 10000 # Limit on number of samples returned ) except: result = formAPI.run_formula( start=start_time, end=end_time, fragments=['capsule=capsule("' +start_time+'","'+end_time+'")', 'laneWidth=315000ms'], function = metric_calc_id, limit=10000 # Limit on number of samples returned ) samples_df = pd.DataFrame() # Iterate through the samples pulled and add to a DataFrame that includes the sample's values and whether its uncertain for sample in result.samples.samples: ts_epoch= sample.key ts_datetime = dt.datetime.fromtimestamp(ts_epoch/1000000000) sample_df = pd.DataFrame(index=[ts_datetime], data={metric_name+" Value":sample.value, metric_name + " Uncertain":sample.is_uncertain}) samples_df = samples_df.append(sample_df) # Remove returned values that are None, i.e. trend had a gap during that time return samples_df.dropna(subset=[metric_name + ' Value']) # Iterate over metrics gathered from the worksheet and get its trended sample data using the defined function all_metric_data = pd.DataFrame() for m_id in analysis_metrics['ID']: single_metric = extract_metric_data(metric_id = m_id, start_time = display_range['Start'].strftime("%Y-%m-%dT%H:%M:%S.%fZ"), end_time = display_range['End'].strftime("%Y-%m-%dT%H:%M:%S.%fZ")) all_metric_data = pd.concat([all_metric_data, single_metric]) display(all_metric_data) # Replace below with the metric name to only see that metric's data # met_name = "Example Metric" # metric_data[[met_name + ' Value', met_name + ' Uncertain']].dropna(subset=[met_name + " Value"])
  4. Kristopher Wiggins's post in Splice could not scale the replacement signal because there are only 0 replacement samples was marked as the answer   
    Hi tai,
    As noted in the error, the issue is due to you not having data during these error windows. By default, the .toSignal() function places samples every 1 day and since your error condition tends to last less than a minute, the .toSignal() may not have samples during this window. To fix this, you can supply a time parameter into .toSignal() to have a more frequent sampling. For example, 1.toSignal(10s) to have it samples every 10 seconds.
    Some other things you may want to consider are
    For your error condition, rather than just making a value search on when the value is 0, also restricting it to past data. replaceNotValid will also place results in the future when there isn't data but appending .within(past()) to your "replace error power totalizer" should only show these 0 values for past data validValues() is another useful function when you run into data gaps. It "connects the dots" by ignoring the gaps and connecting samples if they're within the maximum interpolation of the signal. You can change this interpolation using .setMaxInterpolation(time_input)
  5. Kristopher Wiggins's post in Daily weighted slowdown duration (totalize) was marked as the answer   
    Hi Taylor, below are some steps to achieve this. Feel free to sign up for Office Hours if you'd like help implementing this. 
    Use Value Search to determine when your Rate < Trigger Use Signal from Condition to totalize your Target during the output of Step 1. Repeat for Actual. Note your tags have unrecognized units of Metric Tons/hour. If you'd like to make these into units Seeq recognizes, you can include a Step 1b where you use Formula and $tag.setUnits('t/hr') to apply these units. The outputs of Step 2 would then have units of metric tons. Subtract outputs of Step 2 to find your loss and divide by the target to get weighted duration
×
×
  • Create New...