Jump to content

KantianKinetics

Members
  • Posts

    9
  • Joined

  • Last visited

Recent Profile Visitors

75 profile views

KantianKinetics's Achievements

Apprentice

Apprentice (3/14)

  • One Month Later
  • Week One Done
  • First Post
  • Conversation Starter

Recent Badges

0

Reputation

1

Community Answers

  1. We've resolved it. I'm not sure what the user with write-access did differently this time, I think maybe she set the Y-Axis to an actual number instead of Auto. But its working now. Thanks. I'm marking this resolved.
  2. Thanks for the quick reply John! I've actually tried all of that. Unfortunately, the original creator of the worksheet has left the organization and I'm trying to track down if anybody else has write access. Supposedly another user also has write-access, but going through the above steps did not rectify the issue. I'm not convinced this second user actually has write-access...I'm following up. The arrows to drag the y-axis show up when I hover over the axis, but when I drag nothing happens. ^ What I mentioned in the previous post was referencing the Y-Axis in the Organizer. When you hover the mouse over the Y-Axis, the double arrows pointing up and down appears, but you cannot drag to adjust the axis. Seems there is some functionality in the Organizer to adjust Y-Axis, but would I have to have Write-Access to the Worksheet to be able to adjust the Y-Axis in the Organize? That seems a little bit backwards since the Organizer is simply a reporting tool.
  3. Building an organizer report and referencing a workbench worksheet that I only have viewing rights to the referenced worksheet. The data is now populating outside the Y-axis range, so it looks as if I have no data. Shouldn't I be able to update the Y-axis without write-access? The arrows to drag the y-axis show up when I hover over the axis, but when I drag nothing happens. Supposedly, the User who has write-access has changed the Y-Axis range and it still has not updated on the organizer.
  4. I've seen a lot of examples of running average for a year, restarting at Jan 1, but I'm having trouble generating the running average of the past 12 months. I don't believe now() function should be used at all since its more of an offset() function. This doesn't work since it bases it off of the now() date. $a.runningAggregate(average(),condition(1y, capsule(now()-1y, now()))) This doesn't work since it aggregates from Jan-1 thru the date. $a.runningAggregate(average(),years()) This doesn't work since it aggregates based on the origin date, being the 1st of the year $a.runningAggregate(average(),periods(1year,1year,'2016-01-01')) I'm not sure if this does what I want $a.runningAggregate(average(),$monthly.beforeStart(1year)) where monthly is a periodic condition of each month. Even so, I don't want the 12 month rolling average to calculate from the beginning of each month, rather at the exact date of the date. And I don't think the formula is even doing the rolling average correctly anyways. Thanks a lot!
  5. Thanks. I did try this previously - albeit without the .iloc[0] because the ['Name'] filter handles the row selection - and it returns an error stating "['ID']" not found in the DataFrame or something like that. It makes no sense. It obviously should be grabbing the ID but it doesn't. It makes me think SPy is doing some kind of manipulation of the DataFrame during the push? I did get my code to work with some revisions but I still cannot directly filter for ['ID'] and must push the entire row including the other columns. Here is the working version if you're interested. ##### Search for SEEQ signals from Imported CSV File datasource. Search only for signals in specific Workbook to eliminate need to call out Asset in later code. spy_results_original = spy.search({'Datasource Name':'Imported CSV Files'}, workbook=customer_name) # Copying spy_results to a random df so we can work on it without affecting the original df = spy_results_original.drop([0,1]).reset_index(drop=True) # Dropping row tied to the entire file rather than data in the file df = df[df['Asset'].notnull()] #Dropping null values in the "Asset" column, these are also related to entire file ##### Read Excel file to build templatized calculation dataframe import math import ast from seeq import spy import pandas as pd # Must have or else it reads $ signs for SEEQ variables as LaTeX...grrrr pd.options.display.html.use_mathjax = False # display entire string in Jupyter for easier viewing. Comment this out if you don't want it. pd.set_option('display.max_colwidth', None) calc_signals = pd.read_excel('Templatization/SEEQ Tag Calcs for SEEQ (Python).xlsm', sheet_name='ForSEEQ', header=0) calc_signals = calc_signals[calc_signals['Formula Parameters'] != 'SKIP'] calc_signals['Formula Parameters'] = calc_signals['Formula Parameters'].apply(evaluate_parameters) ### Create Empty signal dataframe to push empty Calculated Signals into SEEQ and later search for the Calculated Signal IDs calc_signals_empty = calc_signals.drop(['Formula','Formula Parameters', 'Units'],axis=1) signal_push = spy.push(workbook = customer_name, metadata=calc_signals_empty) ##### Re-Search for signals to get all signals ### probably a less error prone way to do this that just grabbing all Seeq Data Lab signals. but it works for now spy_results_calcs = spy.search({'Datasource Name':'Seeq Data Lab'}, workbook=customer_name) # Copying spy_results to a random df so we can work on it without affecting the original df_calcs = spy_results_calcs # Append original df with df_calcs to include all signals. df = df.append(df_calcs).reset_index(drop=True) ##### Re-running this again to make sure nothing is left over from previous. ##### Then evaluating parameters again now that we have "ID"s of calculated signals in 'df' ##### The excel file 'Formula' and 'Formula Parameters' column has following format. For some reason, adding ['ID'] to end of filtered Dataframe returns an error of 'ID' not found: # ($OFCoC2 + $OFCoC3 + $OFCoC5 + $OFCoC6 + $OFCoC7) / 100 * $FaPOF # {'$OFCoC2':df[df['Name'] == 'Olefin Feed Composition_online C3='],'$OFCoC3':df[df['Name'] == 'Olefin Feed Composition_online C4=1'], .....} calc_signals = pd.read_excel('Templatization/SEEQ Tag Calcs for SEEQ (Python).xlsm', sheet_name='ForSEEQ', header=0) calc_signals = calc_signals[calc_signals['Formula Parameters'] != 'SKIP'] calc_signals['Formula Parameters'] = calc_signals['Formula Parameters'].apply(evaluate_parameters) ##### Successful push. Need to clean up the Excel file a bit for error handling. signal_push = spy.push(workbook = customer_name, metadata=calc_signals.drop("Units",axis=1)) Current Error: I'm now getting error on push: Unsure why, since the Formula shouldn't care if the signal variable name is reused. I was told the variables don't work globally, e.g. either of the following would work as long as they are tied appropriately to the formula parameter. Is this not true? ($OFCoC2 + $OFCoC3 + $OFCoC5 + $OFCoC6 + $OFCoC7) / 100 * $FaPOF ($a + $b + $c + $d +$e) / 100 * $g
  6. Thanks for the response! Ah I think I see the problem. Not quite sure how to solve it. I probably didn't provide enough information for you. I'm not simply pasting ['ID'] into the Formula Parameter column, the code it is trying to evaluate a string that references the search_results 'Asset' The eval() function worked strangely. As you can see from the above code, I did run spy.search() and generated the search_results dataframe which I passed to df. The Excel CSV has about 300 calculations in it with columns "Name", "Type", "Formula", and "Formula Parameters". See below: The "Formula Parameters" column contains a string of format below in the code snippet for each formula i want to generate. I perform eval() on the string once its read into python to grab the ID of the search_results (now df) from SEEQ. Obviously my SEEQ data is in the imported CSV file asset = 'advisor_elements_sOiltags_leastCleaned_v2_csv(import)': { '$OFCoC2':df[(df['Asset'] =='advisor_elements_sOiltags_leastCleaned_v2_csv(import)') & (df['Name'] == 'Olefin Feed Composition_online C3=')], '$OFCoC3':df[(df['Asset'] =='advisor_elements_sOiltags_leastCleaned_v2_csv(import)') & (df['Name'] == 'Olefin Feed Composition_online C4=1')], '$OFCoC5':df[(df['Asset'] =='advisor_elements_sOiltags_leastCleaned_v2_csv(import)') & (df['Name'] == 'Olefin Feed Composition_online C4=2c')], '$OFCoC6':df[(df['Asset'] =='advisor_elements_sOiltags_leastCleaned_v2_csv(import)') & (df['Name'] == 'Olefin Feed Composition_online C4=2t')], '$OFCoC7':df[(df['Asset'] =='advisor_elements_sOiltags_leastCleaned_v2_csv(import)') & (df['Name'] == 'Olefin Feed Composition_online C4=i')], '$FaPOF':df[(df['Asset'] =='advisor_elements_sOiltags_leastCleaned_v2_csv(import)') & (df['Name'] == 'Feed and Products Olefin Feed+HYC')] } Why would the eval() function return ['ID'] rather than the actual ID? I've also tried to instead grab only the ['ID'] column after filtering along ['Asset'] and ['Name'] columns. When I simply copy and paste the the above code into Data Lab it works just fine to to push Row 0 into SEEQ, but when I evaluate the string in the data table generated from my excel file, it doesn't seem to work.
  7. Thanks to both of you. I actually am doing a LOT of DataLab work and currently am importing CSVs into SEEQ with the the unit of measure in the name in parentheses. Issue is SEEQ doesn't recognize (mol%, vol%, etc.). So I'm currently doing it like shown above as just (%) and will likely just add the mol/vol/wt to the item name. The custom label would work, but I'm going to be building SEEQ dashboards for ~100 different customers across multiple technologies, so need a way to templatize it. Having the custom axis label attached to the lane probably isn't going to work. Thanks to both of you though!
  8. I understand the difficulty in converting between these units within SEEQ since you need the entire composition to convert. However, I would like to at least tag the signals as a mol%, vol%, or wt% and have the signal act as a general percentage. Preferably this would be done with the Unit of Measure; however, is the only other option to include the percentage type in the signal description? Thanks!
  9. FYI, I'm very much self-taught in Python and don't use it more than a few times a month. I work as a technology licensor and our customers have provided datasets for us to work on. Most of our process units have enough similarities that we can templatize SEEQ formulas and then SEEQ workbooks. Thus once I've completed the following work for one customer, I'm 80% of the way done for the next 100+ customers. I'm struggling to get the formulas pushed back into SEEQ from the DataLab. I've imported CSVs of data into SEEQ until we get our PI-to-PI connect setup to pull directly from our customer to our PI Asset Framework and then pushed to our SEEQ instance. Since generating the template formulas is MUCH easier in Excel, I've created all the "Name", "Formula", "Formula Parameters" as strings in an Excel workbook and imported it as a Dataframe "calc_signals" into DataLab. Here's the relevant code: As you can see in Row 1, The Formula Parameter array is empty for the signal $OFPOF. This is the formula generated for the row above, Row 0. This is because I haven't pushed it to SEEQ. You can see the error in the image below. Do I need to actually push each row to SEEQ and then search again to get this to work right? I don't have a huge set of calculations, but it seems there should be a better way. Once I sort through this error, I see that I will have troubles later since SEEQ automatically generates the signal variable name "$OFPOF". Is there a way to override existing variable names and assign new calculations a variable name of my choice?
×
×
  • Create New...