Jump to content

Chris Orr

Seeq Team
  • Posts

    17
  • Joined

  • Last visited

  • Days Won

    8

Posts posted by Chris Orr

  1. Hey there, 

    The key here is using the `aggregate` function, with a minValue() argument. The aggregate function handles Conditions, rather than capsules. You can also output the minValue() at the minKey(), which is the timestamp when the minimum value occurs. Then, transforming that value into a new Condition, of zero-length capsules as the start, will create capsules at the minimum point, which will ultimately be used as the starting point to connect to when your signal == 25.2

    $searchCondition = $originalCondition.removeLongerThan(30d).grow(1hr)  //notice the .grow(1hour) to expand your capsules in case the minimum happens earlier
    
    // Assuming $signal is your signal of interest and $originalCondition is the condition with the capsules of interest
    $minValueTimes = $signal.aggregate(minValue(), $searchCondition, minKey())
    
    // Convert the times of minimum values into a new condition with zero-length capsules
    $newConditionAtMinValues = $minValueTimes.toCondition().starts()
    
    // Output the new condition
    $newConditionAtMinValues

    Then create a Value Search to find when your Signal = 25.2 (no screenshot for this one 🙂 )

    Finally, you can use the Composite Condition tool to "join" the two capsules:

    image.png

     

    And your ultimate goal was calculating the duration between those periods, so you can use the "Signal from Condition" tool to calculate it's Duration like this:

    image.png

     

    Performing it all in one, giant Formula, would look like this:

    where $originalCondition is your derivative > .001 condition, and $signal is your base signal. 

    $searchCondition = $originalCondition.removeLongerThan(30d).grow(1hr)
    
    // Assuming $signal is your signal of interest and $originalCondition is the condition with the capsules of interest
    $minValueTimes = $signal.aggregate(minValue(), $searchCondition, minKey())
    
    // Convert the times of minimum values into a new condition with zero-length capsules
    $newConditionAtMinValues = $minValueTimes.toCondition().starts()
    
    // Perform your value search
    $valueSearch = $signal < 36.2
    
    // Join the two conditions
    $JoinedCondition = $newConditionAtMinValues.join($valueSearch.beforeStart(0ns), 40hr, true)
    
    // Calculate the duration of the joined Condition
    $JoinedCondition.aggregate(totalDuration('hours'), $JoinedCondition, durationKey())

     

    Hope that helps!!

    -Chris Orr

    • Like 1
  2. Hi Nitish, 

    You can review the source code with something like this:

    import inspect
    lines = inspect.getsource(spy.widgets.SeeqItemSelect)
    print(lines)

    (pulled from Stack Overflow here: https://stackoverflow.com/questions/427453/how-can-i-get-the-source-code-of-a-python-function

    As for updating the Worksheets from where the user launched the Add-on from, you'll need to use spy.workbooks, rather than spy.push. 

    Something like this should work: 

    url = 'https://develop.seeq.dev/workbook/0EECCDF4-FD70-F910-BDEE-87D647287803/worksheet/0EECCDF5-0134-EEC0-9B95-13CDFBA98737'
    workbookId = '0EECCDF4-FD70-F910-BDEE-87D647287803'
    worksheetId = '0EECCDF5-0134-EEC0-9B95-13CDFBA98737'
    wb = spy.workbooks.pull(spy.workbooks.search({'ID': workbookId}))
    
    signalID_toadd = 'CD732D0B-C3BA-496F-B69E-55543944B5F1'
    signal_search_df = spy.search({'ID': signalID_toadd})
    new_display_items = pd.concat([wb[0].worksheets[0].display_items, signal_search_df], ignore_index=True)
    wb[0].worksheets[0].display_items = new_display_items
    
    _push = spy.workbooks.push(wb)

     

    Also, if you are trying to make an Add-on to search by ID, I would suggest raising this as a support request for our product team to consider adding this capability to our existing search functionality, by creating a ticket here: https://seeq.atlassian.net/servicedesk/customer/portal/3 if you have not already. Thanks!

    -Chris

  3. Hey Nitish, 

    You can update the _search_seeq method of that widget by creating a new class, your custom search widget that inherits all the capabilities of the default one, then override the search function.

    Something like this should do it:

    class ChrisSeeqItemSelect(spy.widgets.SeeqItemSelect):
        def __init__(self, **kwargs):
            super().__init__(**kwargs)
            
        def _search_seeq(self, search_terms):
            if self._debug:
                print(f'Seeq Search Terms:\n{search_terms}')
    
            if not search_terms:
                self._found_seeq_items = None
            else:
                try:
                    self._found_seeq_items = spy.search({'ID': search_terms['Name']}, all_properties = True)
                except RuntimeError as e:
                    if 'No datasource found' in str(e):
                        self._found_seeq_items = None
                    else:
                        raise
            if self._debug:
                print(f'Items returned from Seeq:\n{self._found_seeq_items}')
                
    item_selector = ChrisSeeqItemSelect(
        title = '<H2>Tag Search by UID</H2>',
        show_fields = ['Name'],
        item_type = 'Signal',
        results_box_rows = 15, 
        max_displayed_results = 20
    )
    
    display(item_selector)

    You can then access the `search_results` with `item_selector.search_results`.

    Let us know how it goes!

    -Chrisimage.png

     

  4. Hello Yanmin, 

    1) Currently, there is no way to copy an entire worksheet from one workbench to another. You can see this thread for additional discussion about it: 

    I would advise reporting your use case to support@seeq.com and our Customer Success team can potentially help implement a workaround given Seeq Data Lab and a version prerequisite, as well as get you and your organization linked to the Feature Request for that item. 

    You might also consider using this solution for copying some items from 1 Workbench to another, but keep in mind the scoping of those items remain to the original and they will still be linked (simply a copy, not a clone of the original): 

     

     

    2) Similarly to item #1, the only method to duplicate formulas via the UI is one at time per the method you're showing. Seeq Data Lab and Python would allow you to programmatically copy Formulas though. 

  5. When you are evaluating the efficacy of a regression, there a few commons methods. You might simply take the difference between your predicted value and your actual value, then create capsules when this value deviates from some critical magnitude. I'll outline an alternative approach, by calculating the r-squared (r2) value over each capsule (in my case, days), but this can be applied to any condition like batches or a Manual Condition of training and validation. The general outline is:

    1. Build a prediction in Seeq using the Prediction tool. You can specify your training window by a condition or simply start and end time. More details in our Knowledge Base article: https://support.seeq.com/space/KB/143163422/Prediction

    2. Create a condition in which you want to compare R2 values. In this example, I'll simply use a Periodic Condition of days. 

    3. Resample your predicted value based on your original value. Seeq's resample function allows an input of another signal, which is particularly critical if your model inputs have varying sample rates. This will eliminate any error that would of otherwise been introduced by oversampling of your prediction and interpolation issues.

    image.png

    4.  Calculate the R2 value over the condition from Step #2 using the following Formula. 

    $ym = $signal.aggregate(average(), $days, startkey()).toStep()
    $total = (($signal-$ym)^2).aggregate(sum(), $days, startkey())
    $residual = (($signal-$prediction)^2).aggregate(sum(), $days, startkey())
    $r2 = (1-($residual/$total)).toStep()
    return $r2

    image.png

     

    You can continue your Analysis by building a Value Search for when your R2 deviates below a given threshold - or summarize your results in your Organizer Topic. Feel free to reach out with any questions or improvement ideas!

     

    Happy Seeqing!

    -Chris O, Seeq Analytics Engineer

    • Like 2
  6. Hello Theresa, 

    There's no feature to directly increase resolution of a downloaded PDF from Seeq Organizer. 

    However, you can adjust size of your content as necessary, add page-breaks, and adjust font sizes to re-format your report. Each piece of Seeq content should have the ability to change Content Size and Font Size in the edit modal (Scorecard Metrics will only have Font Size, though)image.png

    Hope you are able to clarify your PDF download using these tips!

     

    -Chris O

  7. Felix, 

    To address the 2nd part of your question, once you have created capsules for all your known failures. You can use Seeq Formula to create a condition of "non-failures" with the Formula:

    $failure.growEnd(2yr)

    From there, you can use the TimeSince function in Formula to create a time counter between failures. 

    TimeSince($nonfailures, 1d)

    Hope that completes the picture for you!

    -Chris O

    • Like 2
  8. Hello Felix, Thorsten, 

    If you know the start and end date of a particular event/failure, you can simply create a Custom Condition or accomplish the same result through Formula. image.png

    Alternatively, you can use the CSV Import Tool to import multiple capsules if you have the start/end dates listed in a CSV file. 

    Does this address your question, Felix?

     

    Chris O

    • Like 2
  9. During a complex analysis, your Workbench can become cluttered with intermediate Signals and Conditions. Users utilize the Journal tab to keep their calculations documented and organized, often in the form of a Data Tray. If you have been adding Item links one-by-one, try using this trick to add all (or a large subset) of your items to your Journal all at once:

    Select all items in your display

    image.png

     

    Click the Annotate button on the Toolbar

    image.png

     

    Cut the Item links from your Annotation 

    image.png

     

    Paste the links into your Journal

    image.png

      

     

     

     

    • Like 1
    • Thanks 2
  10. AiKju, 

    Here is screenshot of a mocked up example of what I understand you are looking for. Since your curve takes place in the time frame of 1 day, you can create daily capsules using Periodic Condition, then use Custom Condition to pick out the day you are interested in repeating (looks like January 1st, 2000).

    Use the following inputs in the Reference Profile to get the result your looking for:

    • green curve as your Input Signal
    • January 1st, 2000 condition as the Input Condition
    • Set the Reference Statistic to Average
    • Under Advanced, change the apply to Condition to your Periodic Condition of days created above. 

    Once you execute, you should see a similar signal to my orange one below. The result should be the same as using Ben's approach. 

    Don't hesitate if you have further questions. 

     

    image.png

  11. Great question!

    Yes - Seeq is able to create a new signal that represents the running hours/days of your piece of equipment. Signal from Condition is a great start as you've already found. To get what you are looking for, you'll need to use Seeq's Formula tool. I have mocked up a like-example below for your reference.

    In the first two lines of our Formula, we create hour long capsules with the hours() function, then transform those capsules to samples by counting the number of capsules that occur every hour, and give each sample a timestamp at the start of the hour using the .getstart() function.  

    "hours().transformtosamples(                                          
    $capsule -> sample($capsule.getstart(), hours().count($capsule)))"

    The 3rd line of our formula, 

    ".runningsum($on).setunits('hr')" 

    keeps a running sum of hours contained within your "ON" condition, then sets the appropriate units. In your example, this would be your purple "Pump is running" condition. 

    image.png

    image.png

    As you can see in the display pane, our new signal resets for each new 'Compressor On' capsule. 

    I hope this is what you were looking for. Please let us know if you have any additional questions.

     

    -Chris

     

    • Like 1
×
×
  • Create New...