diff --git a/docs/_build/doctrees/authors.doctree b/docs/_build/doctrees/authors.doctree index dec391e..d73ed4e 100644 Binary files a/docs/_build/doctrees/authors.doctree and b/docs/_build/doctrees/authors.doctree differ diff --git a/docs/_build/doctrees/contributing.doctree b/docs/_build/doctrees/contributing.doctree index 33c40be..1afdccd 100644 Binary files a/docs/_build/doctrees/contributing.doctree and b/docs/_build/doctrees/contributing.doctree differ diff --git a/docs/_build/doctrees/environment.pickle b/docs/_build/doctrees/environment.pickle index 23fe2ab..a34f886 100644 Binary files a/docs/_build/doctrees/environment.pickle and b/docs/_build/doctrees/environment.pickle differ diff --git a/docs/_build/doctrees/history.doctree b/docs/_build/doctrees/history.doctree index 0b4bc68..14c8c2a 100644 Binary files a/docs/_build/doctrees/history.doctree and b/docs/_build/doctrees/history.doctree differ diff --git a/docs/_build/doctrees/index.doctree b/docs/_build/doctrees/index.doctree index 34cbad7..87d2534 100644 Binary files a/docs/_build/doctrees/index.doctree and b/docs/_build/doctrees/index.doctree differ diff --git a/docs/_build/doctrees/installation.doctree b/docs/_build/doctrees/installation.doctree index 1911ee0..72245cb 100644 Binary files a/docs/_build/doctrees/installation.doctree and b/docs/_build/doctrees/installation.doctree differ diff --git a/docs/_build/doctrees/modules.doctree b/docs/_build/doctrees/modules.doctree index f8b1a22..2b10164 100644 Binary files a/docs/_build/doctrees/modules.doctree and b/docs/_build/doctrees/modules.doctree differ diff --git a/docs/_build/doctrees/pycirk.doctree b/docs/_build/doctrees/pycirk.doctree index 20880f9..ea040e3 100644 Binary files a/docs/_build/doctrees/pycirk.doctree and b/docs/_build/doctrees/pycirk.doctree differ diff --git a/docs/_build/doctrees/readme.doctree b/docs/_build/doctrees/readme.doctree index 0a97001..b1ffdbd 100644 Binary files a/docs/_build/doctrees/readme.doctree and b/docs/_build/doctrees/readme.doctree differ diff --git a/docs/_build/doctrees/usage.doctree b/docs/_build/doctrees/usage.doctree index e0f7412..21fb8bc 100644 Binary files a/docs/_build/doctrees/usage.doctree and b/docs/_build/doctrees/usage.doctree differ diff --git a/docs/_build/html/.buildinfo b/docs/_build/html/.buildinfo index 4398e61..f46eee4 100644 --- a/docs/_build/html/.buildinfo +++ b/docs/_build/html/.buildinfo @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: d6fa29c12a3539fe59921482cb73f252 +config: 32d434fc321b4f2ced7d28506d7c6b3b tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/docs/_build/html/_modules/index.html b/docs/_build/html/_modules/index.html index b3a8f96..94ef618 100644 --- a/docs/_build/html/_modules/index.html +++ b/docs/_build/html/_modules/index.html @@ -1,11 +1,9 @@ - + - - + Overview: module code — pycirk 1.5.0 documentation @@ -13,6 +11,7 @@ + @@ -80,13 +79,11 @@

Related Topics

@@ -107,7 +104,7 @@

Quick search

©2019, Franco Donati. | - Powered by Sphinx 1.8.2 + Powered by Sphinx 2.2.0 & Alabaster 0.7.12 diff --git a/docs/_build/html/_modules/pycirk/fundamental_operations.html b/docs/_build/html/_modules/pycirk/fundamental_operations.html index 0d1cfba..eb6152e 100644 --- a/docs/_build/html/_modules/pycirk/fundamental_operations.html +++ b/docs/_build/html/_modules/pycirk/fundamental_operations.html @@ -1,11 +1,9 @@ - + - - + pycirk.fundamental_operations — pycirk 1.5.0 documentation @@ -13,6 +11,7 @@ + @@ -163,7 +162,7 @@

Source code for pycirk.fundamental_operations

Total requirement multipliers A = Z * D """ - return np.matmul(inter_coef, D)
+ return inter_coef @ D
[docs] def L(A): """ @@ -191,7 +190,7 @@

Source code for pycirk.fundamental_operations

Intermediates Z = inter_coef * D * diag(q) """ - return np.matmul(inter_coef, D) @ diag_q
+ return inter_coef @ D @ diag_q
[docs] class IOT: """ @@ -204,7 +203,7 @@

Source code for pycirk.fundamental_operations

""" total product output s the sum of Si and y """ - return np.sum(np.array(Z), axis=1) + np.sum(np.array(Y), axis=1)
+ return np.sum(Z, axis=1) + np.sum(Y, axis=1)
[docs] def B(R, inv_diag_x): """ @@ -223,7 +222,7 @@

Source code for pycirk.fundamental_operations

Total product ouput x = inv(I - A) * yi """ - return np.dot(L, y)
+ return L @ y
[docs] def Z(A, diag_x): """ @@ -291,7 +290,7 @@

Source code for pycirk.fundamental_operations

x = Operations.IOT.x_IAy(L, y) ver_base = Operations.verifyIOT(Z, Y, E) - + return {"A": A, "Z": Z, "L": L, @@ -311,18 +310,14 @@

Source code for pycirk.fundamental_operations

[docs] def calculate_characterized(data): - data.Cr_E = data.Cr_E_k @ np.array(data.E) - data.Cr_M = data.Cr_M_k @ np.array(data.M) - data.Cr_R = data.Cr_R_k @ np.array(data.R) - data.Cr_W = data.Cr_W_k @ np.array(data.W) - - data.Cr_EY = data.Cr_E_k @ np.array(data.EY) - data.Cr_MY = data.Cr_M_k @ np.array(data.MY) - data.Cr_RY = data.Cr_R_k @ np.array(data.RY) - - data.Cr_tot_E = data.Cr_E.sum(axis=1) + data.Cr_EY.sum(axis=1) - data.Cr_tot_M = data.Cr_M.sum(axis=1) + data.Cr_MY.sum(axis=1) - data.Cr_tot_R = data.Cr_R.sum(axis=1) + data.Cr_RY.sum(axis=1) + data.Cr_E = data.Cr_E_k @ data.E + data.Cr_M = data.Cr_M_k @ data.M + data.Cr_R = data.Cr_R_k @ data.R + data.Cr_W = data.Cr_W_k @ data.W + + data.Cr_EY = data.Cr_E_k @ data.EY + data.Cr_MY = data.Cr_M_k @ data.MY + data.Cr_RY = data.Cr_R_k @ data.RY return data
@@ -364,13 +359,11 @@

Related Topics

@@ -391,7 +384,7 @@

Quick search

©2019, Franco Donati. | - Powered by Sphinx 1.8.2 + Powered by Sphinx 2.2.0 & Alabaster 0.7.12 diff --git a/docs/_build/html/_modules/pycirk/labels.html b/docs/_build/html/_modules/pycirk/labels.html index dccdcd8..947458d 100644 --- a/docs/_build/html/_modules/pycirk/labels.html +++ b/docs/_build/html/_modules/pycirk/labels.html @@ -1,11 +1,9 @@ - + - - + pycirk.labels — pycirk 1.5.0 documentation @@ -13,6 +11,7 @@ + @@ -98,35 +97,40 @@

Source code for pycirk.labels

                 else:
                     organize[keys] = self.list_of_something(labels)
 
-        count = max(len(labels) for keys, labels in organize.items())
-        organize["count"] = count
-
+        try:
+            organize["count"] = len(organize["synonym"])
+        except KeyError:
+            organize["count"] = len(organize["characterization"])
+            
         return Munch(organize)
[docs] def organize_unique_labels(self, directory): - labels = self.load_labels(directory) - - for l, v in labels.items(): - labels[l] = Munch(v) + lbl = self.load_labels(directory) - labels = Munch(labels) - - labels.products = self.get_unique_labels(labels.prod) - labels.industries = self.get_unique_labels(labels.ind) + self.product_labels = self.get_unique_labels(lbl["prod"]) + try: + self.industry_labels = self.get_unique_labels(lbl["ind"]) + except AttributeError: + pass + + try: + self.country_labels = self.product_labels.country_code + except Exception: + pass - labels.primary = self.get_unique_labels(labels.primary) - labels.fin_dem = self.get_unique_labels(labels.fin_dem) + self.region_labels = self.product_labels.region - labels.emis = self.get_unique_labels(labels.emis, False) - labels.res = self.get_unique_labels(labels.res, False) - labels.mat = self.get_unique_labels(labels.mat, False) - labels.car_emis = self.get_unique_labels(labels.car_emis, False) - labels.car_res = self.get_unique_labels(labels.car_res, False) - labels.car_mat = self.get_unique_labels(labels.car_mat, False) - labels.car_prim = self.get_unique_labels(labels.car_prim, False) + self.W_labels = self.get_unique_labels(lbl["primary"]) + self.Y_labels = self.get_unique_labels(lbl["fin_dem"]) + self.E_labels = self.get_unique_labels(lbl["emis"], False) + self.R_labels = self.get_unique_labels(lbl["res"], False) + self.M_labels = self.get_unique_labels(lbl["mat"], False) + self.Cr_E_labels = self.get_unique_labels(lbl["car_emis"], False) + self.Cr_R_labels = self.get_unique_labels(lbl["car_res"], False) + self.Cr_M_labels = self.get_unique_labels(lbl["car_mat"], False) + self.Cr_W_labels = self.get_unique_labels(lbl["car_prim"], False)
- return labels
[docs] def load_labels(self, directory): @@ -312,7 +316,7 @@

Source code for pycirk.labels

 
             attr_name = name + name_2 + "_labels"
             row_labels = eval("self." + attr_name)
-
+        
         no_row_labs = row_labels.count
         no_reg_labs = len(reg_labels)
         no_col_labs = column_labels.count
@@ -362,13 +366,11 @@ 

Related Topics

@@ -389,7 +391,7 @@

Quick search

©2019, Franco Donati. | - Powered by Sphinx 1.8.2 + Powered by Sphinx 2.2.0 & Alabaster 0.7.12
diff --git a/docs/_build/html/_modules/pycirk/make_scenarios.html b/docs/_build/html/_modules/pycirk/make_scenarios.html index 7ad4263..4b976bb 100644 --- a/docs/_build/html/_modules/pycirk/make_scenarios.html +++ b/docs/_build/html/_modules/pycirk/make_scenarios.html @@ -1,11 +1,9 @@ - + - - + pycirk.make_scenarios — pycirk 1.5.0 documentation @@ -13,6 +11,7 @@ + @@ -75,7 +74,7 @@

Source code for pycirk.make_scenarios

     An object contaning a mofified IO system
     """
     # set basic data and variables
-
+    print(f"Scenario {scen_no} started")
     data = deepcopy(data)
 
     x_ = ops.IOT.x(data.Z, data.Y)
@@ -99,6 +98,7 @@ 

Source code for pycirk.make_scenarios

     inv_diag_x_int = np.diag(ops.inv(ops.IOT.x(data.Z, data.Y)))
 
     A = ops.IOT.A(data.Z, inv_diag_x_int)
+
     data.A = counterfactual(scen_file, scen_no, A, "A", labels)
 
     data.Y = counterfactual(scen_file, scen_no, data.Y, "Y", labels)
@@ -106,6 +106,7 @@ 

Source code for pycirk.make_scenarios

     L = ops.IOT.L(data.A)
 
     x_new = ops.IOT.x_IAy(L, data.Y.sum(1))
+    
     diag_x_new = np.diag(x_new)
 
     diag_yj_new = np.diag(data.Y.sum(axis=0))
@@ -141,13 +142,13 @@ 

Source code for pycirk.make_scenarios

     data.E = counterfactual(scen_file, scen_no, data.E, "E", labels)
     data.R = counterfactual(scen_file, scen_no, data.R, "R", labels)
     data.M = counterfactual(scen_file, scen_no, data.M, "M", labels)
-
     # Apply policy to  final demand extension coefficient matrices
     data.EY = counterfactual(scen_file, scen_no, data.EY, "EY", labels)
     data.RY = counterfactual(scen_file, scen_no, data.RY, "RY", labels)
     data.MY = counterfactual(scen_file, scen_no, data.MY, "MY", labels)
 
-#    print((1-np.sum(x_)/np.sum(x_new))*100)
+    #print((1-np.sum(x_)/np.sum(x_new))*100)
+    print(f"Scenario {scen_no} completed")
 
     return data
@@ -181,8 +182,7 @@

Source code for pycirk.make_scenarios

     elif scen_no.startswith("scenario_"):
         pass
     else:
-        raise KeyError("only integer or explicit name (scenario_x)" +
-                       "are allowed")
+        raise KeyError("only integer or explicit name (scenario_x) are allowed")
 
 
     scenario = pd.read_excel(scen_file, sheet_name=scen_no, header=1, index=None)
@@ -373,7 +373,6 @@ 

Source code for pycirk.make_scenarios

 
         int4 = inter_sets["at2"]
         int4 = basic_add(int3, int4)
-
         M[np.ix_(i, g)] = int4
 
         if subs is True:
@@ -456,7 +455,7 @@ 

Source code for pycirk.make_scenarios

             try:
                 change_type = entry.change_type
                 ide = entry.identifier  # used during debugging
-
+    
                 # Collecting the specified coordinates for the intevention
                 # coordinates for region and category
                 # Row items (i) => Supplied category or extension category
@@ -467,11 +466,14 @@ 

Source code for pycirk.make_scenarios

                 cat_d = sing_pos(entry.cat_d, column_labels)
                 # Identify coordinates
                 orig_coor = coord(cat_o, reg_o, no_reg_labs, no_row_labs)
+                #print(f"row\n ide: {ide}, row: {entry.reg_o}, {entry.cat_o}, {orig_coor}")
                 dest_coor = coord(cat_d, reg_d, no_reg_labs, no_col_labs)
+                #print(f"columns\n ide: {ide}, column: {entry.reg_d}, {entry.cat_d}, {dest_coor}")
+                
                 # organize main changes
                 kt1 = {"kt": entry.kt1, "kp": entry.kp1}
                 kt2 = {"kt": entry.kt2, "kp": entry.kp2}
-
+    
                 intervention = {"change_type": change_type,
                                 "ide": ide,
                                 "i": orig_coor,
@@ -481,24 +483,24 @@ 

Source code for pycirk.make_scenarios

                                 "at1": entry.at1,
                                 "at2": entry.at2,
                                 }
-
+    
                 substitution = False
                 copy = False
-
+    
                 # the following is only relevant for susbtitution
                 if "x" in [entry.Sub, entry.Copy]:
-
+    
                     sub_reg_o = sing_pos(entry.reg_o_sc, reg_labels)
                     sub_cat_o = sing_pos(entry.cat_o_sc, row_labels)
-
+    
                     # Column items => Consumption / manufacturing activity
                     sub_reg_d = sing_pos(entry.reg_d_sc, reg_labels)
                     sub_cat_d = sing_pos(entry.cat_d_sc, column_labels)
-
+    
                     # Translate coordinates from str to numerical position
                     sub_orig_coor = coord(sub_cat_o, sub_reg_o, no_reg_labs, no_row_labs)
                     sub_dest_coor = coord(sub_cat_d, sub_reg_d, no_reg_labs, no_col_labs)
-
+    
                     intervention["swk"] = entry.swk
                     intervention["i1"] = sub_orig_coor
                     intervention["g1"] = sub_dest_coor
@@ -506,7 +508,7 @@ 

Source code for pycirk.make_scenarios

                     intervention["sk2"] = entry.sk2
                     intervention["sk3"] = entry.sk3
                     intervention["sk4"] = entry.sk4
-
+    
                     if entry.Copy == "x":
                         copy = True
                     elif entry.Sub == "x":
@@ -515,115 +517,8 @@ 

Source code for pycirk.make_scenarios

                 raise ValueError(f"Check in this entry for potential coordinate errors in your scenario settings:\n{entry} ")
 
             M = counterfactual_engine(M, intervention, substitution, copy)
-
+    
     return M
- -# ============================================================================= -# ============================================================================= -# # Here I put work that I started but I still need to finish -# ============================================================================= -# ============================================================================= -# ============================================================================= -# -# -# def make_counterfactuals_SUT(data, scen_no, scen_file, labels): -# """ -# Calculate all the counterfactual SUT matrices -# -# Parameters -# ---------- -# data : obj -# An object containing all necessary matrices of the SUT system -# -# scen_no : int -# the identification number of the scenario to reference in scen_file -# -# scen_file : str -# the directory where the scenarios.xlsx file is store -# -# labels : obj -# an object containing all labels for the SUT matrices -# -# Outputs -# ------- -# An object contaning a mofified SUT system -# """ -# -# met = ops.PxP_ITA_MSC -# -# w = ops.IOT.B(data.W, data.inv_diag_g) # Primary input coef -# e = ops.IOT.B(data.E, data.inv_diag_g) # emissions extension coef -# r = ops.IOT.B(data.R, data.inv_diag_g) # Resources extension coef -# m = ops.IOT.B(data.M, data.inv_diag_g) # Materials extension coef -# S = met.S(data.U, data.inv_diag_g) # industry coefficients for intermediate use table -# -# # Start first from a supply approach -# # Supply matrix counterfactual -# data.V = counterfactual(scen_file, scen_no, data.V, "V", labels) -# # new total industry output -# g1 = np.sum(data.V, axis=0) -# # industry use coefficients counterfactual -# S_ = counterfactual(scen_file, scen_no, S, "S", labels) -# -# data.U = counterfactual(scen_file, scen_no, S_ @ np.diag(g1), "U", labels) # industry use transactions counterfactual -# -# W_ = np.array(ops.IOT.R(w, np.diag(g1))) -# -# g2 = np.array(W_[:9].sum(0)) + data.U.sum(0) # recalculate total industry output -# -# g_dif = np.multiply(g2, ops.inv(g1))*100 # calculate the difference between original and new total industry input -# -# # print([round((1-l)*100,4) for l in g_dif if 1-l>.5e-3 and l!=0]) -# q2 = np.sum(data.U, axis=1) + np.sum(data.Y, axis=1) -# -# # updating the supply table to match the new total industry input -# D = met.D(data.V, np.diag(ops.inv(data.V.sum(1)))) -# data.V = D @ np.diag(q2) -# -# q1 = np.sum(data.V, axis=0) # total product output -# -# q_dif = np.multiply(q2, ops.inv(q1)) -# -# g1 = np.sum(data.V, axis=1) -# -# data.E = met.R(e, np.diag(x)) -# -# data.R = met.R(r, np.diag(x)) -# -# data.M = met.R(m, np.diag(x)) -# -# -# return(IOT) -# def balancing_operation(V, U, Y, W): -# """ -# Re-balancing of supply-use tables after data changes -# -# Parameters -# ---------- -# V (supply) : numpy.array -# -# U (use) : numpy.array -# -# Y (final_demand) : numpy.array -# -# W (primary_inputs) : numpy.array -# -# Output -# ------ -# output : dict -# -# It outputs a dictionary containing a re-balanced supply-use tables system -# where: -# V = supply table -# -# U = use table -# -# Y = final demand -# -# W = primary inputs -# -# """ -# =============================================================================
@@ -663,13 +558,11 @@

Related Topics

@@ -690,7 +583,7 @@

Quick search

©2019, Franco Donati. | - Powered by Sphinx 1.8.2 + Powered by Sphinx 2.2.0 & Alabaster 0.7.12
diff --git a/docs/_build/html/_modules/pycirk/make_secondary_flows.html b/docs/_build/html/_modules/pycirk/make_secondary_flows.html index 21d4778..9b71549 100644 --- a/docs/_build/html/_modules/pycirk/make_secondary_flows.html +++ b/docs/_build/html/_modules/pycirk/make_secondary_flows.html @@ -1,11 +1,9 @@ - + - - + pycirk.make_secondary_flows — pycirk 1.5.0 documentation @@ -13,6 +11,7 @@ + @@ -124,6 +123,7 @@

Source code for pycirk.make_secondary_flows

     V = V.copy()
     U = U.copy()
     Y = Y.copy()
+    
 
     # position of the secondary material
     des_prod_ix_pos = prod_or + 1
@@ -132,7 +132,7 @@ 

Source code for pycirk.make_secondary_flows

     # getting the value of secondary material from the supply table
     # which is placed on the primary material row
     misplaced = V.iloc[prod_or, des_ind_col_pos]
-
+    
     # placing the misplaced value to the secondary material row
     V.iloc[des_prod_ix_pos, des_ind_col_pos] = np.array(misplaced)
 
@@ -165,17 +165,17 @@ 

Source code for pycirk.make_secondary_flows

 
     eye = np.identity(len(ratio_prim_sec))
 
-    U.iloc[prod_or] = (eye - ratio_prim_sec) @ prim_sec_use_trans
+    U.iloc[prod_or] = (eye - ratio_prim_sec) @ np.array(prim_sec_use_trans)
 
-    U.iloc[des_prod_ix_pos] = ratio_prim_sec @ prim_sec_use_trans
+    U.iloc[des_prod_ix_pos] = ratio_prim_sec @ np.array(prim_sec_use_trans)
 
-    Y.iloc[prod_or] = (eye - ratio_prim_sec) @ prim_sec_fin_dem_trans
+    Y.iloc[prod_or] = (eye - ratio_prim_sec) @ np.array(prim_sec_fin_dem_trans)
 
-    Y.iloc[des_prod_ix_pos] = ratio_prim_sec @ prim_sec_fin_dem_trans
+    Y.iloc[des_prod_ix_pos] = ratio_prim_sec @ np.array(prim_sec_fin_dem_trans)
 
     V.iloc[prod_or, des_ind_col_pos] = 0
 
-    print('splitting off secondary materials ready')
+    print('splitting off secondary materials completed')
 
     return {"V": V,
             "U": U,
@@ -219,13 +219,11 @@ 

Related Topics

@@ -246,7 +244,7 @@

Quick search

©2019, Franco Donati. | - Powered by Sphinx 1.8.2 + Powered by Sphinx 2.2.0 & Alabaster 0.7.12
diff --git a/docs/_build/html/_modules/pycirk/organize_io.html b/docs/_build/html/_modules/pycirk/organize_io.html index 0d2f8fa..0d21faf 100644 --- a/docs/_build/html/_modules/pycirk/organize_io.html +++ b/docs/_build/html/_modules/pycirk/organize_io.html @@ -1,11 +1,9 @@ - + - - + pycirk.organize_io — pycirk 1.5.0 documentation @@ -13,6 +11,7 @@ + @@ -45,22 +44,23 @@

Source code for pycirk.organize_io

 @institution: Leiden University CML
 """
 
+import numpy as np
 
 
[docs]def organizer(data): - return {"Z": data["Z"], - "Y": data["Y"], - "W": data["W"], - "E": data["E"], - "R": data["R"], - "M": data["M"], - "EY": data["EY"], - "RY": data["RY"], - "MY": data["MY"], - "Cr_E_k": data["Cr_E_k"], - "Cr_M_k": data["Cr_M_k"], - "Cr_R_k": data["Cr_R_k"], - "Cr_W_k": data["Cr_W_k"] + return {"Z": np.array(data["Z"]), + "Y": np.array(data["Y"]), + "W": np.array(data["W"]), + "E": np.array(data["E"]), + "R": np.array(data["R"]), + "M": np.array(data["M"]), + "EY": np.array(data["EY"]), + "RY": np.array(data["RY"]), + "MY": np.array(data["MY"]), + "Cr_E_k": np.array(data["Cr_E_k"]), + "Cr_M_k": np.array(data["Cr_M_k"]), + "Cr_R_k": np.array(data["Cr_R_k"]), + "Cr_W_k": np.array(data["Cr_W_k"]) }
@@ -101,13 +101,11 @@

Related Topics

@@ -128,7 +126,7 @@

Quick search

©2019, Franco Donati. | - Powered by Sphinx 1.8.2 + Powered by Sphinx 2.2.0 & Alabaster 0.7.12
diff --git a/docs/_build/html/_modules/pycirk/positions.html b/docs/_build/html/_modules/pycirk/positions.html index 3e92bf0..fd8e63b 100644 --- a/docs/_build/html/_modules/pycirk/positions.html +++ b/docs/_build/html/_modules/pycirk/positions.html @@ -1,11 +1,9 @@ - + - - + pycirk.positions — pycirk 1.5.0 documentation @@ -13,6 +11,7 @@ + @@ -130,24 +129,26 @@

Source code for pycirk.positions

         no_countries = 1
     else:
         pass
-
+    
     if cat_coord is None:
         s = np.array(range(no_categories * no_countries))
     else:
         n = 0
         while n in range(no_countries):
+
             g = cat_coord[0] + no_categories * n
             if "s" not in locals():
-                s = [g]
+                s = np.array([g])
             else:
-                s = np.hstack([s, g])
+                s = np.append(s, g)
             n = n+1
-
+    
     if reg_coord is None:
         return s
     else:
-        s = np.split(s, no_countries)
-        return np.take(s, reg_coord, axis=0)[0]
+ s = np.split(s, no_countries) + s = s[reg_coord[0]] + return s
[docs]def make_coord_array_for_make_sec(coordinates, no_countries, no_categories): """ @@ -222,13 +223,11 @@

Related Topics

@@ -249,7 +248,7 @@

Quick search

©2019, Franco Donati. | - Powered by Sphinx 1.8.2 + Powered by Sphinx 2.2.0 & Alabaster 0.7.12
diff --git a/docs/_build/html/_modules/pycirk/pycirk.html b/docs/_build/html/_modules/pycirk/pycirk.html index 2dbe3bc..b1816c1 100644 --- a/docs/_build/html/_modules/pycirk/pycirk.html +++ b/docs/_build/html/_modules/pycirk/pycirk.html @@ -1,11 +1,9 @@ - + - - + pycirk.pycirk — pycirk 1.5.0 documentation @@ -13,6 +11,7 @@ + @@ -297,13 +296,11 @@

Related Topics

@@ -324,7 +321,7 @@

Quick search

©2019, Franco Donati. | - Powered by Sphinx 1.8.2 + Powered by Sphinx 2.2.0 & Alabaster 0.7.12
diff --git a/docs/_build/html/_modules/pycirk/pycirk_settings.html b/docs/_build/html/_modules/pycirk/pycirk_settings.html index 093a7ba..3386efd 100644 --- a/docs/_build/html/_modules/pycirk/pycirk_settings.html +++ b/docs/_build/html/_modules/pycirk/pycirk_settings.html @@ -1,11 +1,9 @@ - + - - + pycirk.pycirk_settings — pycirk 1.5.0 documentation @@ -13,6 +11,7 @@ + @@ -289,7 +288,7 @@

Source code for pycirk.pycirk_settings

 
         loc = dataset_spec["loc"]
         typ = dataset_spec["type"]
-
+        
         try:
             data = self.load_dataset(loc)
         except Exception:
@@ -332,7 +331,7 @@ 

Source code for pycirk.pycirk_settings

                 IOT = data
                 del(data)
 
-        self.assign_labels_to_class()
+        self.lb.organize_unique_labels(self.directory_labels)
 
         return IOT
@@ -353,33 +352,7 @@

Source code for pycirk.pycirk_settings

                                     " check your file:\n\n" + loc)
         return Transform(data)
- -
[docs] def assign_labels_to_class(self): - """ - Assigns all labels to their respective attributes in the Labels class - These are used througout the program to find coordinates and - label results - """ - - all_labels = self.lb.organize_unique_labels(self.directory_labels) - - try: - self.lb.country_labels = all_labels.products.country_code - except Exception: - pass - - self.lb.region_labels = all_labels.products.region - self.lb.product_labels = all_labels.products - self.lb.industry_labels = all_labels.industries - self.lb.W_labels = all_labels.primary - self.lb.E_labels = all_labels.emis - self.lb.R_labels = all_labels.res - self.lb.M_labels = all_labels.mat - self.lb.Y_labels = all_labels.fin_dem - self.lb.Cr_E_labels = all_labels.car_emis - self.lb.Cr_R_labels = all_labels.car_res - self.lb.Cr_M_labels = all_labels.car_mat - self.lb.Cr_W_labels = all_labels.car_prim
+
[docs] def set_IO_scenario(self, data, scen_no): """ @@ -449,13 +422,11 @@

Related Topics

@@ -476,7 +447,7 @@

Quick search

©2019, Franco Donati. | - Powered by Sphinx 1.8.2 + Powered by Sphinx 2.2.0 & Alabaster 0.7.12
diff --git a/docs/_build/html/_modules/pycirk/results.html b/docs/_build/html/_modules/pycirk/results.html index d31f355..c1df33f 100644 --- a/docs/_build/html/_modules/pycirk/results.html +++ b/docs/_build/html/_modules/pycirk/results.html @@ -1,11 +1,9 @@ - + - - + pycirk.results — pycirk 1.5.0 documentation @@ -13,6 +11,7 @@ + @@ -75,27 +74,13 @@

Source code for pycirk.results

     
     return results
- -
[docs]def retrieve_specified_data(data, spec_row, labels): - """ - Separate, collect and rename results for base and scenarios according - to specifications under th sheet "analysis" in scenarios.xls - - data = any IOT table - spec_row = row in the scenarios sheet specifying settings - """ - - pd.options.display.float_format = '{:,.4f}'.format - - M_name = spec_row.matrix # matrix of reference - - if "Cr" in M_name: - data = ops.calculate_characterized(data) - +
[docs]def rsd_engine(data, M_name, spec_row, labels): + + M = np.array(data[M_name]) # Call specific matrix from which to select - + spec_labels = labels.identify_labels(M_name) - + reg_labels = spec_labels["reg_labels"] row_labels = spec_labels["i_labels"] column_labels = spec_labels["g_labels"] @@ -124,14 +109,13 @@

Source code for pycirk.results

         raise ValueError(f"\nThe specified coordinates to retrieve results are wrong.\nPlease check that name and matrix in your scenarios.xlsx file are correct.\nCheck: {M_name, i_cat}")
 
 
-    if "tot" in M_name:
-        select = df([M[i].sum()])
-    else:
-        select = df([M[np.ix_(i, g)].sum()])
+
+    select = df([M[np.ix_(i, g)].sum()])
 
 
     key_names = ["matrix", "i_category", "i_region", "g_category",
-                 "g_region", "unit"]
+                 "g_region", "unit"] 
+        
 
     try:
         unit = str(row_labels.unit[cat_o].iloc[0])
@@ -141,8 +125,48 @@ 

Source code for pycirk.results

     index_label = [M_name, i_cat, i_reg, g_cat, g_reg, unit]
 
     select.index = mi.from_tuples([index_label], names=key_names)
-
+    
     return select
+ +
[docs]def retrieve_specified_data(data, spec_row, labels): + """ + Separate, collect and rename results for base and scenarios according + to specifications under th sheet "analysis" in scenarios.xls + + data = any IOT table + spec_row = row in the scenarios sheet specifying settings + """ + + pd.options.display.float_format = '{:,.4f}'.format + + M_name = spec_row.matrix # matrix of reference + + if "Cr" in M_name: + data = ops.calculate_characterized(data) + + if "tot" in M_name: + M_name_1 = M_name[-1] + M_name_2 = M_name[-1] + "Y" + + if "Cr" in M_name: + M_name_1 = "Cr_" + M_name_1 + M_name_2 = "Cr_" + M_name_2 + + + output = rsd_engine(data, M_name_1, spec_row, labels) + output = output + rsd_engine(data, M_name_2, spec_row, labels).values + index_label = [list(i) for i in output.index][0] + index_label[0] = M_name + key_names = output.index.names + output.index = mi.from_tuples([index_label], names=key_names) + else: + output = rsd_engine(data, M_name, spec_row, labels) + + return output
+ + + +
@@ -182,13 +206,11 @@

Related Topics

@@ -209,7 +231,7 @@

Quick search

©2019, Franco Donati. | - Powered by Sphinx 1.8.2 + Powered by Sphinx 2.2.0 & Alabaster 0.7.12 diff --git a/docs/_build/html/_modules/pycirk/save_utils.html b/docs/_build/html/_modules/pycirk/save_utils.html index 6e333b8..f389bb9 100644 --- a/docs/_build/html/_modules/pycirk/save_utils.html +++ b/docs/_build/html/_modules/pycirk/save_utils.html @@ -1,11 +1,9 @@ - + - - + pycirk.save_utils — pycirk 1.5.0 documentation @@ -13,6 +11,7 @@ + @@ -179,13 +178,11 @@

Related Topics

@@ -206,7 +203,7 @@

Quick search

©2019, Franco Donati. | - Powered by Sphinx 1.8.2 + Powered by Sphinx 2.2.0 & Alabaster 0.7.12 diff --git a/docs/_build/html/_modules/pycirk/transformation_methods.html b/docs/_build/html/_modules/pycirk/transformation_methods.html index 6387d6a..d3e576f 100644 --- a/docs/_build/html/_modules/pycirk/transformation_methods.html +++ b/docs/_build/html/_modules/pycirk/transformation_methods.html @@ -1,11 +1,9 @@ - + - - + pycirk.transformation_methods — pycirk 1.5.0 documentation @@ -13,6 +11,7 @@ + @@ -55,16 +54,16 @@

Source code for pycirk.transformation_methods

def __init__(self, SUTs): # Baseline monetary data - self.V = SUTs["V"] # Supply matrix - self.U = SUTs["U"] # Intermediate use - self.Y = SUTs["Y"] # Final demand - self.W = SUTs["W"] # Primary input - self.E = SUTs["E"] # emissions extension - self.EY = SUTs["YE"] # emissions extension final demand - self.R = SUTs["R"] # Resources extension - self.RY = SUTs["YR"] # Resources extension final demand - self.M = SUTs["M"] # Materials extension - self.MY = SUTs["YM"] # Materials extension final demand + self.V = np.array(SUTs["V"]) # Supply matrix + self.U = np.array(SUTs["U"]) # Intermediate use + self.Y = np.array(SUTs["Y"]) # Final demand + self.W = np.array(SUTs["W"]) # Primary input + self.E = np.array(SUTs["E"]) # emissions extension + self.EY = np.array(SUTs["YE"]) # emissions extension final demand + self.R = np.array(SUTs["R"]) # Resources extension + self.RY = np.array(SUTs["YR"]) # Resources extension final demand + self.M = np.array(SUTs["M"]) # Materials extension + self.MY = np.array(SUTs["YM"]) # Materials extension final demand self.Cr_E_k = SUTs["Cr_E_k"] # Charact coefficients emissions self.Cr_R_k = SUTs["Cr_R_k"] # Charact coefficients resources @@ -123,8 +122,6 @@

Source code for pycirk.transformation_methods

del(self.M) M = met.R(m, np.diag(x)) - x = ops.IOT.x_IAy(L, self.yi) # total product ouput - A = ops.IOT.A(Z, self.inv_diag_q) return {"Y": self.Y, @@ -155,11 +152,12 @@

Source code for pycirk.transformation_methods

S = met.S(self.U, self.inv_diag_g) # ind. interm. coef. => in EUROSTAT manual shown as S D = met.D(self.V, self.inv_diag_q) # Market shares A = met.A(S, D) # technical coefficient matrix + L = met.L(A) # leontief inverse w = met.B(self.W, D, self.inv_diag_g) # primary inputs x = ops.IOT.x_IAy(L, self.yi) W = ops.IOT.R(w, np.diag(x)) - Z = met.Z(S, D, self.diag_q) # intermediates + Z = met.Z(S, D, np.diag(x)) # intermediates ver_base = ops.verifyIOT(Z, self.Y, W) del(self.V) del(self.U) @@ -177,10 +175,6 @@

Source code for pycirk.transformation_methods

del(self.M) M = met.R(m, np.diag(x)) - x = ops.IOT.x_IAy(L, self.yi) # total product ouput - - A = ops.IOT.A(Z, self.inv_diag_q) - return {"Y": self.Y, "L": L, "Z": Z, @@ -239,13 +233,11 @@

Related Topics

@@ -266,7 +258,7 @@

Quick search

©2019, Franco Donati. | - Powered by Sphinx 1.8.2 + Powered by Sphinx 2.2.0 & Alabaster 0.7.12
diff --git a/docs/_build/html/_sources/pycirk.rst.txt b/docs/_build/html/_sources/pycirk.rst.txt index 3262eb4..4258a86 100644 --- a/docs/_build/html/_sources/pycirk.rst.txt +++ b/docs/_build/html/_sources/pycirk.rst.txt @@ -8,103 +8,103 @@ pycirk.cli module ----------------- .. automodule:: pycirk.cli - :members: - :undoc-members: - :show-inheritance: + :members: + :undoc-members: + :show-inheritance: pycirk.fundamental\_operations module ------------------------------------- .. automodule:: pycirk.fundamental_operations - :members: - :undoc-members: - :show-inheritance: + :members: + :undoc-members: + :show-inheritance: pycirk.labels module -------------------- .. automodule:: pycirk.labels - :members: - :undoc-members: - :show-inheritance: + :members: + :undoc-members: + :show-inheritance: pycirk.make\_scenarios module ----------------------------- .. automodule:: pycirk.make_scenarios - :members: - :undoc-members: - :show-inheritance: + :members: + :undoc-members: + :show-inheritance: pycirk.make\_secondary\_flows module ------------------------------------ .. automodule:: pycirk.make_secondary_flows - :members: - :undoc-members: - :show-inheritance: + :members: + :undoc-members: + :show-inheritance: pycirk.organize\_io module -------------------------- .. automodule:: pycirk.organize_io - :members: - :undoc-members: - :show-inheritance: + :members: + :undoc-members: + :show-inheritance: pycirk.positions module ----------------------- .. automodule:: pycirk.positions - :members: - :undoc-members: - :show-inheritance: + :members: + :undoc-members: + :show-inheritance: pycirk.pycirk module -------------------- .. automodule:: pycirk.pycirk - :members: - :undoc-members: - :show-inheritance: + :members: + :undoc-members: + :show-inheritance: pycirk.pycirk\_settings module ------------------------------ .. automodule:: pycirk.pycirk_settings - :members: - :undoc-members: - :show-inheritance: + :members: + :undoc-members: + :show-inheritance: pycirk.results module --------------------- .. automodule:: pycirk.results - :members: - :undoc-members: - :show-inheritance: + :members: + :undoc-members: + :show-inheritance: pycirk.save\_utils module ------------------------- .. automodule:: pycirk.save_utils - :members: - :undoc-members: - :show-inheritance: + :members: + :undoc-members: + :show-inheritance: pycirk.transformation\_methods module ------------------------------------- .. automodule:: pycirk.transformation_methods - :members: - :undoc-members: - :show-inheritance: + :members: + :undoc-members: + :show-inheritance: Module contents --------------- .. automodule:: pycirk - :members: - :undoc-members: - :show-inheritance: + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/_build/html/_static/ajax-loader.gif b/docs/_build/html/_static/ajax-loader.gif deleted file mode 100644 index 61faf8c..0000000 Binary files a/docs/_build/html/_static/ajax-loader.gif and /dev/null differ diff --git a/docs/_build/html/_static/basic.css b/docs/_build/html/_static/basic.css index 104f076..ea6972d 100644 --- a/docs/_build/html/_static/basic.css +++ b/docs/_build/html/_static/basic.css @@ -4,7 +4,7 @@ * * Sphinx stylesheet -- basic theme. * - * :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS. + * :copyright: Copyright 2007-2019 by the Sphinx team, see AUTHORS. * :license: BSD, see LICENSE for details. * */ @@ -231,6 +231,16 @@ a.headerlink { visibility: hidden; } +a.brackets:before, +span.brackets > a:before{ + content: "["; +} + +a.brackets:after, +span.brackets > a:after { + content: "]"; +} + h1:hover > a.headerlink, h2:hover > a.headerlink, h3:hover > a.headerlink, @@ -279,6 +289,12 @@ img.align-center, .figure.align-center, object.align-center { margin-right: auto; } +img.align-default, .figure.align-default { + display: block; + margin-left: auto; + margin-right: auto; +} + .align-left { text-align: left; } @@ -287,6 +303,10 @@ img.align-center, .figure.align-center, object.align-center { text-align: center; } +.align-default { + text-align: center; +} + .align-right { text-align: right; } @@ -358,6 +378,11 @@ table.align-center { margin-right: auto; } +table.align-default { + margin-left: auto; + margin-right: auto; +} + table caption span.caption-number { font-style: italic; } @@ -391,6 +416,16 @@ table.citation td { border-bottom: none; } +th > p:first-child, +td > p:first-child { + margin-top: 0px; +} + +th > p:last-child, +td > p:last-child { + margin-bottom: 0px; +} + /* -- figures --------------------------------------------------------------- */ div.figure { @@ -460,11 +495,58 @@ ol.upperroman { list-style: upper-roman; } +li > p:first-child { + margin-top: 0px; +} + +li > p:last-child { + margin-bottom: 0px; +} + +dl.footnote > dt, +dl.citation > dt { + float: left; +} + +dl.footnote > dd, +dl.citation > dd { + margin-bottom: 0em; +} + +dl.footnote > dd:after, +dl.citation > dd:after { + content: ""; + clear: both; +} + +dl.field-list { + display: grid; + grid-template-columns: fit-content(30%) auto; +} + +dl.field-list > dt { + font-weight: bold; + word-break: break-word; + padding-left: 0.5em; + padding-right: 5px; +} + +dl.field-list > dt:after { + content: ":"; +} + +dl.field-list > dd { + padding-left: 0.5em; + margin-top: 0em; + margin-left: 0em; + margin-bottom: 0em; +} + dl { margin-bottom: 15px; } -dd p { +dd > p:first-child { margin-top: 0px; } @@ -537,6 +619,12 @@ dl.glossary dt { font-style: oblique; } +.classifier:before { + font-style: normal; + margin: 0.5em; + content: ":"; +} + abbr, acronym { border-bottom: dotted 1px; cursor: help; diff --git a/docs/_build/html/_static/comment-bright.png b/docs/_build/html/_static/comment-bright.png deleted file mode 100644 index 15e27ed..0000000 Binary files a/docs/_build/html/_static/comment-bright.png and /dev/null differ diff --git a/docs/_build/html/_static/comment-close.png b/docs/_build/html/_static/comment-close.png deleted file mode 100644 index 4d91bcf..0000000 Binary files a/docs/_build/html/_static/comment-close.png and /dev/null differ diff --git a/docs/_build/html/_static/comment.png b/docs/_build/html/_static/comment.png deleted file mode 100644 index dfbc0cb..0000000 Binary files a/docs/_build/html/_static/comment.png and /dev/null differ diff --git a/docs/_build/html/_static/doctools.js b/docs/_build/html/_static/doctools.js index ffadbec..b33f87f 100644 --- a/docs/_build/html/_static/doctools.js +++ b/docs/_build/html/_static/doctools.js @@ -4,7 +4,7 @@ * * Sphinx JavaScript utilities for all documentation. * - * :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS. + * :copyright: Copyright 2007-2019 by the Sphinx team, see AUTHORS. * :license: BSD, see LICENSE for details. * */ @@ -87,14 +87,13 @@ jQuery.fn.highlightText = function(text, className) { node.nextSibling)); node.nodeValue = val.substr(0, pos); if (isInSVG) { - var bbox = span.getBBox(); var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect"); - rect.x.baseVal.value = bbox.x; + var bbox = node.parentElement.getBBox(); + rect.x.baseVal.value = bbox.x; rect.y.baseVal.value = bbox.y; rect.width.baseVal.value = bbox.width; rect.height.baseVal.value = bbox.height; rect.setAttribute('class', className); - var parentOfText = node.parentNode.parentNode; addItems.push({ "parent": node.parentNode, "target": rect}); diff --git a/docs/_build/html/_static/documentation_options.js b/docs/_build/html/_static/documentation_options.js index a6b6ac6..75deb87 100644 --- a/docs/_build/html/_static/documentation_options.js +++ b/docs/_build/html/_static/documentation_options.js @@ -6,291 +6,5 @@ var DOCUMENTATION_OPTIONS = { FILE_SUFFIX: '.html', HAS_SOURCE: true, SOURCELINK_SUFFIX: '.txt', - NAVIGATION_WITH_KEYS: false, - SEARCH_LANGUAGE_STOP_WORDS: ["a","and","are","as","at","be","but","by","for","if","in","into","is","it","near","no","not","of","on","or","such","that","the","their","then","there","these","they","this","to","was","will","with"] -}; - - - -/* Non-minified version JS is _stemmer.js if file is provided */ -/** - * Porter Stemmer - */ -var Stemmer = function() { - - var step2list = { - ational: 'ate', - tional: 'tion', - enci: 'ence', - anci: 'ance', - izer: 'ize', - bli: 'ble', - alli: 'al', - entli: 'ent', - eli: 'e', - ousli: 'ous', - ization: 'ize', - ation: 'ate', - ator: 'ate', - alism: 'al', - iveness: 'ive', - fulness: 'ful', - ousness: 'ous', - aliti: 'al', - iviti: 'ive', - biliti: 'ble', - logi: 'log' - }; - - var step3list = { - icate: 'ic', - ative: '', - alize: 'al', - iciti: 'ic', - ical: 'ic', - ful: '', - ness: '' - }; - - var c = "[^aeiou]"; // consonant - var v = "[aeiouy]"; // vowel - var C = c + "[^aeiouy]*"; // consonant sequence - var V = v + "[aeiou]*"; // vowel sequence - - var mgr0 = "^(" + C + ")?" + V + C; // [C]VC... is m>0 - var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$"; // [C]VC[V] is m=1 - var mgr1 = "^(" + C + ")?" + V + C + V + C; // [C]VCVC... is m>1 - var s_v = "^(" + C + ")?" + v; // vowel in stem - - this.stemWord = function (w) { - var stem; - var suffix; - var firstch; - var origword = w; - - if (w.length < 3) - return w; - - var re; - var re2; - var re3; - var re4; - - firstch = w.substr(0,1); - if (firstch == "y") - w = firstch.toUpperCase() + w.substr(1); - - // Step 1a - re = /^(.+?)(ss|i)es$/; - re2 = /^(.+?)([^s])s$/; - - if (re.test(w)) - w = w.replace(re,"$1$2"); - else if (re2.test(w)) - w = w.replace(re2,"$1$2"); - - // Step 1b - re = /^(.+?)eed$/; - re2 = /^(.+?)(ed|ing)$/; - if (re.test(w)) { - var fp = re.exec(w); - re = new RegExp(mgr0); - if (re.test(fp[1])) { - re = /.$/; - w = w.replace(re,""); - } - } - else if (re2.test(w)) { - var fp = re2.exec(w); - stem = fp[1]; - re2 = new RegExp(s_v); - if (re2.test(stem)) { - w = stem; - re2 = /(at|bl|iz)$/; - re3 = new RegExp("([^aeiouylsz])\\1$"); - re4 = new RegExp("^" + C + v + "[^aeiouwxy]$"); - if (re2.test(w)) - w = w + "e"; - else if (re3.test(w)) { - re = /.$/; - w = w.replace(re,""); - } - else if (re4.test(w)) - w = w + "e"; - } - } - - // Step 1c - re = /^(.+?)y$/; - if (re.test(w)) { - var fp = re.exec(w); - stem = fp[1]; - re = new RegExp(s_v); - if (re.test(stem)) - w = stem + "i"; - } - - // Step 2 - re = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/; - if (re.test(w)) { - var fp = re.exec(w); - stem = fp[1]; - suffix = fp[2]; - re = new RegExp(mgr0); - if (re.test(stem)) - w = stem + step2list[suffix]; - } - - // Step 3 - re = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/; - if (re.test(w)) { - var fp = re.exec(w); - stem = fp[1]; - suffix = fp[2]; - re = new RegExp(mgr0); - if (re.test(stem)) - w = stem + step3list[suffix]; - } - - // Step 4 - re = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/; - re2 = /^(.+?)(s|t)(ion)$/; - if (re.test(w)) { - var fp = re.exec(w); - stem = fp[1]; - re = new RegExp(mgr1); - if (re.test(stem)) - w = stem; - } - else if (re2.test(w)) { - var fp = re2.exec(w); - stem = fp[1] + fp[2]; - re2 = new RegExp(mgr1); - if (re2.test(stem)) - w = stem; - } - - // Step 5 - re = /^(.+?)e$/; - if (re.test(w)) { - var fp = re.exec(w); - stem = fp[1]; - re = new RegExp(mgr1); - re2 = new RegExp(meq1); - re3 = new RegExp("^" + C + v + "[^aeiouwxy]$"); - if (re.test(stem) || (re2.test(stem) && !(re3.test(stem)))) - w = stem; - } - re = /ll$/; - re2 = new RegExp(mgr1); - if (re.test(w) && re2.test(w)) { - re = /.$/; - w = w.replace(re,""); - } - - // and turn initial Y back to y - if (firstch == "y") - w = firstch.toLowerCase() + w.substr(1); - return w; - } -} - - - - - -var splitChars = (function() { - var result = {}; - var singles = [96, 180, 187, 191, 215, 247, 749, 885, 903, 907, 909, 930, 1014, 1648, - 1748, 1809, 2416, 2473, 2481, 2526, 2601, 2609, 2612, 2615, 2653, 2702, - 2706, 2729, 2737, 2740, 2857, 2865, 2868, 2910, 2928, 2948, 2961, 2971, - 2973, 3085, 3089, 3113, 3124, 3213, 3217, 3241, 3252, 3295, 3341, 3345, - 3369, 3506, 3516, 3633, 3715, 3721, 3736, 3744, 3748, 3750, 3756, 3761, - 3781, 3912, 4239, 4347, 4681, 4695, 4697, 4745, 4785, 4799, 4801, 4823, - 4881, 5760, 5901, 5997, 6313, 7405, 8024, 8026, 8028, 8030, 8117, 8125, - 8133, 8181, 8468, 8485, 8487, 8489, 8494, 8527, 11311, 11359, 11687, 11695, - 11703, 11711, 11719, 11727, 11735, 12448, 12539, 43010, 43014, 43019, 43587, - 43696, 43713, 64286, 64297, 64311, 64317, 64319, 64322, 64325, 65141]; - var i, j, start, end; - for (i = 0; i < singles.length; i++) { - result[singles[i]] = true; - } - var ranges = [[0, 47], [58, 64], [91, 94], [123, 169], [171, 177], [182, 184], [706, 709], - [722, 735], [741, 747], [751, 879], [888, 889], [894, 901], [1154, 1161], - [1318, 1328], [1367, 1368], [1370, 1376], [1416, 1487], [1515, 1519], [1523, 1568], - [1611, 1631], [1642, 1645], [1750, 1764], [1767, 1773], [1789, 1790], [1792, 1807], - [1840, 1868], [1958, 1968], [1970, 1983], [2027, 2035], [2038, 2041], [2043, 2047], - [2070, 2073], [2075, 2083], [2085, 2087], [2089, 2307], [2362, 2364], [2366, 2383], - [2385, 2391], [2402, 2405], [2419, 2424], [2432, 2436], [2445, 2446], [2449, 2450], - [2483, 2485], [2490, 2492], [2494, 2509], [2511, 2523], [2530, 2533], [2546, 2547], - [2554, 2564], [2571, 2574], [2577, 2578], [2618, 2648], [2655, 2661], [2672, 2673], - [2677, 2692], [2746, 2748], [2750, 2767], [2769, 2783], [2786, 2789], [2800, 2820], - [2829, 2830], [2833, 2834], [2874, 2876], [2878, 2907], [2914, 2917], [2930, 2946], - [2955, 2957], [2966, 2968], [2976, 2978], [2981, 2983], [2987, 2989], [3002, 3023], - [3025, 3045], [3059, 3076], [3130, 3132], [3134, 3159], [3162, 3167], [3170, 3173], - [3184, 3191], [3199, 3204], [3258, 3260], [3262, 3293], [3298, 3301], [3312, 3332], - [3386, 3388], [3390, 3423], [3426, 3429], [3446, 3449], [3456, 3460], [3479, 3481], - [3518, 3519], [3527, 3584], [3636, 3647], [3655, 3663], [3674, 3712], [3717, 3718], - [3723, 3724], [3726, 3731], [3752, 3753], [3764, 3772], [3774, 3775], [3783, 3791], - [3802, 3803], [3806, 3839], [3841, 3871], [3892, 3903], [3949, 3975], [3980, 4095], - [4139, 4158], [4170, 4175], [4182, 4185], [4190, 4192], [4194, 4196], [4199, 4205], - [4209, 4212], [4226, 4237], [4250, 4255], [4294, 4303], [4349, 4351], [4686, 4687], - [4702, 4703], [4750, 4751], [4790, 4791], [4806, 4807], [4886, 4887], [4955, 4968], - [4989, 4991], [5008, 5023], [5109, 5120], [5741, 5742], [5787, 5791], [5867, 5869], - [5873, 5887], [5906, 5919], [5938, 5951], [5970, 5983], [6001, 6015], [6068, 6102], - [6104, 6107], [6109, 6111], [6122, 6127], [6138, 6159], [6170, 6175], [6264, 6271], - [6315, 6319], [6390, 6399], [6429, 6469], [6510, 6511], [6517, 6527], [6572, 6592], - [6600, 6607], [6619, 6655], [6679, 6687], [6741, 6783], [6794, 6799], [6810, 6822], - [6824, 6916], [6964, 6980], [6988, 6991], [7002, 7042], [7073, 7085], [7098, 7167], - [7204, 7231], [7242, 7244], [7294, 7400], [7410, 7423], [7616, 7679], [7958, 7959], - [7966, 7967], [8006, 8007], [8014, 8015], [8062, 8063], [8127, 8129], [8141, 8143], - [8148, 8149], [8156, 8159], [8173, 8177], [8189, 8303], [8306, 8307], [8314, 8318], - [8330, 8335], [8341, 8449], [8451, 8454], [8456, 8457], [8470, 8472], [8478, 8483], - [8506, 8507], [8512, 8516], [8522, 8525], [8586, 9311], [9372, 9449], [9472, 10101], - [10132, 11263], [11493, 11498], [11503, 11516], [11518, 11519], [11558, 11567], - [11622, 11630], [11632, 11647], [11671, 11679], [11743, 11822], [11824, 12292], - [12296, 12320], [12330, 12336], [12342, 12343], [12349, 12352], [12439, 12444], - [12544, 12548], [12590, 12592], [12687, 12689], [12694, 12703], [12728, 12783], - [12800, 12831], [12842, 12880], [12896, 12927], [12938, 12976], [12992, 13311], - [19894, 19967], [40908, 40959], [42125, 42191], [42238, 42239], [42509, 42511], - [42540, 42559], [42592, 42593], [42607, 42622], [42648, 42655], [42736, 42774], - [42784, 42785], [42889, 42890], [42893, 43002], [43043, 43055], [43062, 43071], - [43124, 43137], [43188, 43215], [43226, 43249], [43256, 43258], [43260, 43263], - [43302, 43311], [43335, 43359], [43389, 43395], [43443, 43470], [43482, 43519], - [43561, 43583], [43596, 43599], [43610, 43615], [43639, 43641], [43643, 43647], - [43698, 43700], [43703, 43704], [43710, 43711], [43715, 43738], [43742, 43967], - [44003, 44015], [44026, 44031], [55204, 55215], [55239, 55242], [55292, 55295], - [57344, 63743], [64046, 64047], [64110, 64111], [64218, 64255], [64263, 64274], - [64280, 64284], [64434, 64466], [64830, 64847], [64912, 64913], [64968, 65007], - [65020, 65135], [65277, 65295], [65306, 65312], [65339, 65344], [65371, 65381], - [65471, 65473], [65480, 65481], [65488, 65489], [65496, 65497]]; - for (i = 0; i < ranges.length; i++) { - start = ranges[i][0]; - end = ranges[i][1]; - for (j = start; j <= end; j++) { - result[j] = true; - } - } - return result; -})(); - -function splitQuery(query) { - var result = []; - var start = -1; - for (var i = 0; i < query.length; i++) { - if (splitChars[query.charCodeAt(i)]) { - if (start !== -1) { - result.push(query.slice(start, i)); - start = -1; - } - } else if (start === -1) { - start = i; - } - } - if (start !== -1) { - result.push(query.slice(start)); - } - return result; -} - - + NAVIGATION_WITH_KEYS: false +}; \ No newline at end of file diff --git a/docs/_build/html/_static/down-pressed.png b/docs/_build/html/_static/down-pressed.png deleted file mode 100644 index 5756c8c..0000000 Binary files a/docs/_build/html/_static/down-pressed.png and /dev/null differ diff --git a/docs/_build/html/_static/down.png b/docs/_build/html/_static/down.png deleted file mode 100644 index 1b3bdad..0000000 Binary files a/docs/_build/html/_static/down.png and /dev/null differ diff --git a/docs/_build/html/_static/jquery-3.2.1.js b/docs/_build/html/_static/jquery-3.4.1.js similarity index 89% rename from docs/_build/html/_static/jquery-3.2.1.js rename to docs/_build/html/_static/jquery-3.4.1.js index d2d8ca4..773ad95 100644 --- a/docs/_build/html/_static/jquery-3.2.1.js +++ b/docs/_build/html/_static/jquery-3.4.1.js @@ -1,5 +1,5 @@ /*! - * jQuery JavaScript Library v3.2.1 + * jQuery JavaScript Library v3.4.1 * https://jquery.com/ * * Includes Sizzle.js @@ -9,7 +9,7 @@ * Released under the MIT license * https://jquery.org/license * - * Date: 2017-03-20T18:59Z + * Date: 2019-05-01T21:04Z */ ( function( global, factory ) { @@ -71,16 +71,70 @@ var ObjectFunctionString = fnToString.call( Object ); var support = {}; +var isFunction = function isFunction( obj ) { + // Support: Chrome <=57, Firefox <=52 + // In some browsers, typeof returns "function" for HTML elements + // (i.e., `typeof document.createElement( "object" ) === "function"`). + // We don't want to classify *any* DOM node as a function. + return typeof obj === "function" && typeof obj.nodeType !== "number"; + }; - function DOMEval( code, doc ) { + +var isWindow = function isWindow( obj ) { + return obj != null && obj === obj.window; + }; + + + + + var preservedScriptAttributes = { + type: true, + src: true, + nonce: true, + noModule: true + }; + + function DOMEval( code, node, doc ) { doc = doc || document; - var script = doc.createElement( "script" ); + var i, val, + script = doc.createElement( "script" ); script.text = code; + if ( node ) { + for ( i in preservedScriptAttributes ) { + + // Support: Firefox 64+, Edge 18+ + // Some browsers don't support the "nonce" property on scripts. + // On the other hand, just using `getAttribute` is not enough as + // the `nonce` attribute is reset to an empty string whenever it + // becomes browsing-context connected. + // See https://github.com/whatwg/html/issues/2369 + // See https://html.spec.whatwg.org/#nonce-attributes + // The `node.getAttribute` check was added for the sake of + // `jQuery.globalEval` so that it can fake a nonce-containing node + // via an object. + val = node[ i ] || node.getAttribute && node.getAttribute( i ); + if ( val ) { + script.setAttribute( i, val ); + } + } + } doc.head.appendChild( script ).parentNode.removeChild( script ); } + + +function toType( obj ) { + if ( obj == null ) { + return obj + ""; + } + + // Support: Android <=2.3 only (functionish RegExp) + return typeof obj === "object" || typeof obj === "function" ? + class2type[ toString.call( obj ) ] || "object" : + typeof obj; +} /* global Symbol */ // Defining this global in .eslintrc.json would create a danger of using the global // unguarded in another place, it seems safer to define global only for this module @@ -88,7 +142,7 @@ var support = {}; var - version = "3.2.1", + version = "3.4.1", // Define a local copy of jQuery jQuery = function( selector, context ) { @@ -100,16 +154,7 @@ var // Support: Android <=4.0 only // Make sure we trim BOM and NBSP - rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, - - // Matches dashed string for camelizing - rmsPrefix = /^-ms-/, - rdashAlpha = /-([a-z])/g, - - // Used by jQuery.camelCase as callback to replace() - fcamelCase = function( all, letter ) { - return letter.toUpperCase(); - }; + rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g; jQuery.fn = jQuery.prototype = { @@ -209,7 +254,7 @@ jQuery.extend = jQuery.fn.extend = function() { } // Handle case when target is a string or something (possible in deep copy) - if ( typeof target !== "object" && !jQuery.isFunction( target ) ) { + if ( typeof target !== "object" && !isFunction( target ) ) { target = {}; } @@ -226,25 +271,28 @@ jQuery.extend = jQuery.fn.extend = function() { // Extend the base object for ( name in options ) { - src = target[ name ]; copy = options[ name ]; + // Prevent Object.prototype pollution // Prevent never-ending loop - if ( target === copy ) { + if ( name === "__proto__" || target === copy ) { continue; } // Recurse if we're merging plain objects or arrays if ( deep && copy && ( jQuery.isPlainObject( copy ) || ( copyIsArray = Array.isArray( copy ) ) ) ) { + src = target[ name ]; - if ( copyIsArray ) { - copyIsArray = false; - clone = src && Array.isArray( src ) ? src : []; - + // Ensure proper type for the source value + if ( copyIsArray && !Array.isArray( src ) ) { + clone = []; + } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) { + clone = {}; } else { - clone = src && jQuery.isPlainObject( src ) ? src : {}; + clone = src; } + copyIsArray = false; // Never move original objects, clone them target[ name ] = jQuery.extend( deep, clone, copy ); @@ -275,28 +323,6 @@ jQuery.extend( { noop: function() {}, - isFunction: function( obj ) { - return jQuery.type( obj ) === "function"; - }, - - isWindow: function( obj ) { - return obj != null && obj === obj.window; - }, - - isNumeric: function( obj ) { - - // As of jQuery 3.0, isNumeric is limited to - // strings and numbers (primitives or objects) - // that can be coerced to finite numbers (gh-2662) - var type = jQuery.type( obj ); - return ( type === "number" || type === "string" ) && - - // parseFloat NaNs numeric-cast false positives ("") - // ...but misinterprets leading-number strings, particularly hex literals ("0x...") - // subtraction forces infinities to NaN - !isNaN( obj - parseFloat( obj ) ); - }, - isPlainObject: function( obj ) { var proto, Ctor; @@ -319,9 +345,6 @@ jQuery.extend( { }, isEmptyObject: function( obj ) { - - /* eslint-disable no-unused-vars */ - // See https://github.com/eslint/eslint/issues/6125 var name; for ( name in obj ) { @@ -330,27 +353,9 @@ jQuery.extend( { return true; }, - type: function( obj ) { - if ( obj == null ) { - return obj + ""; - } - - // Support: Android <=2.3 only (functionish RegExp) - return typeof obj === "object" || typeof obj === "function" ? - class2type[ toString.call( obj ) ] || "object" : - typeof obj; - }, - // Evaluates a script in a global context - globalEval: function( code ) { - DOMEval( code ); - }, - - // Convert dashed to camelCase; used by the css and data modules - // Support: IE <=9 - 11, Edge 12 - 13 - // Microsoft forgot to hump their vendor prefix (#9572) - camelCase: function( string ) { - return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); + globalEval: function( code, options ) { + DOMEval( code, { nonce: options && options.nonce } ); }, each: function( obj, callback ) { @@ -473,37 +478,6 @@ jQuery.extend( { // A global GUID counter for objects guid: 1, - // Bind a function to a context, optionally partially applying any - // arguments. - proxy: function( fn, context ) { - var tmp, args, proxy; - - if ( typeof context === "string" ) { - tmp = fn[ context ]; - context = fn; - fn = tmp; - } - - // Quick check to determine if target is callable, in the spec - // this throws a TypeError, but we will just return undefined. - if ( !jQuery.isFunction( fn ) ) { - return undefined; - } - - // Simulated bind - args = slice.call( arguments, 2 ); - proxy = function() { - return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); - }; - - // Set the guid of unique handler to the same of original handler, so it can be removed - proxy.guid = fn.guid = fn.guid || jQuery.guid++; - - return proxy; - }, - - now: Date.now, - // jQuery.support is not used in Core but other projects attach their // properties to it so it needs to exist. support: support @@ -526,9 +500,9 @@ function isArrayLike( obj ) { // hasOwn isn't used here due to false negatives // regarding Nodelist length in IE var length = !!obj && "length" in obj && obj.length, - type = jQuery.type( obj ); + type = toType( obj ); - if ( type === "function" || jQuery.isWindow( obj ) ) { + if ( isFunction( obj ) || isWindow( obj ) ) { return false; } @@ -537,14 +511,14 @@ function isArrayLike( obj ) { } var Sizzle = /*! - * Sizzle CSS Selector Engine v2.3.3 + * Sizzle CSS Selector Engine v2.3.4 * https://sizzlejs.com/ * - * Copyright jQuery Foundation and other contributors + * Copyright JS Foundation and other contributors * Released under the MIT license - * http://jquery.org/license + * https://js.foundation/ * - * Date: 2016-08-08 + * Date: 2019-04-08 */ (function( window ) { @@ -578,6 +552,7 @@ var i, classCache = createCache(), tokenCache = createCache(), compilerCache = createCache(), + nonnativeSelectorCache = createCache(), sortOrder = function( a, b ) { if ( a === b ) { hasDuplicate = true; @@ -639,8 +614,7 @@ var i, rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), - - rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ), + rdescend = new RegExp( whitespace + "|>" ), rpseudo = new RegExp( pseudos ), ridentifier = new RegExp( "^" + identifier + "$" ), @@ -661,6 +635,7 @@ var i, whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) }, + rhtml = /HTML$/i, rinputs = /^(?:input|select|textarea|button)$/i, rheader = /^h\d$/i, @@ -715,9 +690,9 @@ var i, setDocument(); }, - disabledAncestor = addCombinator( + inDisabledFieldset = addCombinator( function( elem ) { - return elem.disabled === true && ("form" in elem || "label" in elem); + return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset"; }, { dir: "parentNode", next: "legend" } ); @@ -830,18 +805,22 @@ function Sizzle( selector, context, results, seed ) { // Take advantage of querySelectorAll if ( support.qsa && - !compilerCache[ selector + " " ] && - (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { - - if ( nodeType !== 1 ) { - newContext = context; - newSelector = selector; + !nonnativeSelectorCache[ selector + " " ] && + (!rbuggyQSA || !rbuggyQSA.test( selector )) && - // qSA looks outside Element context, which is not what we want - // Thanks to Andrew Dupont for this workaround technique - // Support: IE <=8 + // Support: IE 8 only // Exclude object elements - } else if ( context.nodeName.toLowerCase() !== "object" ) { + (nodeType !== 1 || context.nodeName.toLowerCase() !== "object") ) { + + newSelector = selector; + newContext = context; + + // qSA considers elements outside a scoping root when evaluating child or + // descendant combinators, which is not what we want. + // In such cases, we work around the behavior by prefixing every selector in the + // list with an ID selector referencing the scope context. + // Thanks to Andrew Dupont for this technique. + if ( nodeType === 1 && rdescend.test( selector ) ) { // Capture the context ID, setting it first if necessary if ( (nid = context.getAttribute( "id" )) ) { @@ -863,17 +842,16 @@ function Sizzle( selector, context, results, seed ) { context; } - if ( newSelector ) { - try { - push.apply( results, - newContext.querySelectorAll( newSelector ) - ); - return results; - } catch ( qsaError ) { - } finally { - if ( nid === expando ) { - context.removeAttribute( "id" ); - } + try { + push.apply( results, + newContext.querySelectorAll( newSelector ) + ); + return results; + } catch ( qsaError ) { + nonnativeSelectorCache( selector, true ); + } finally { + if ( nid === expando ) { + context.removeAttribute( "id" ); } } } @@ -1037,7 +1015,7 @@ function createDisabledPseudo( disabled ) { // Where there is no isDisabled, check manually /* jshint -W018 */ elem.isDisabled !== !disabled && - disabledAncestor( elem ) === disabled; + inDisabledFieldset( elem ) === disabled; } return elem.disabled === disabled; @@ -1094,10 +1072,13 @@ support = Sizzle.support = {}; * @returns {Boolean} True iff elem is a non-HTML XML node */ isXML = Sizzle.isXML = function( elem ) { - // documentElement is verified for cases where it doesn't yet exist - // (such as loading iframes in IE - #4833) - var documentElement = elem && (elem.ownerDocument || elem).documentElement; - return documentElement ? documentElement.nodeName !== "HTML" : false; + var namespace = elem.namespaceURI, + docElem = (elem.ownerDocument || elem).documentElement; + + // Support: IE <=8 + // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes + // https://bugs.jquery.com/ticket/4833 + return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" ); }; /** @@ -1519,11 +1500,8 @@ Sizzle.matchesSelector = function( elem, expr ) { setDocument( elem ); } - // Make sure that attribute selectors are quoted - expr = expr.replace( rattributeQuotes, "='$1']" ); - if ( support.matchesSelector && documentIsHTML && - !compilerCache[ expr + " " ] && + !nonnativeSelectorCache[ expr + " " ] && ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { @@ -1537,7 +1515,9 @@ Sizzle.matchesSelector = function( elem, expr ) { elem.document && elem.document.nodeType !== 11 ) { return ret; } - } catch (e) {} + } catch (e) { + nonnativeSelectorCache( expr, true ); + } } return Sizzle( expr, document, null, [ elem ] ).length > 0; @@ -1996,7 +1976,7 @@ Expr = Sizzle.selectors = { "contains": markFunction(function( text ) { text = text.replace( runescape, funescape ); return function( elem ) { - return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; + return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1; }; }), @@ -2135,7 +2115,11 @@ Expr = Sizzle.selectors = { }), "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { - var i = argument < 0 ? argument + length : argument; + var i = argument < 0 ? + argument + length : + argument > length ? + length : + argument; for ( ; --i >= 0; ) { matchIndexes.push( i ); } @@ -2848,11 +2832,9 @@ var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>| -var risSimple = /^.[^:#\[\.,]*$/; - // Implement the identical functionality for filter and not function winnow( elements, qualifier, not ) { - if ( jQuery.isFunction( qualifier ) ) { + if ( isFunction( qualifier ) ) { return jQuery.grep( elements, function( elem, i ) { return !!qualifier.call( elem, i, elem ) !== not; } ); @@ -2872,16 +2854,8 @@ function winnow( elements, qualifier, not ) { } ); } - // Simple selector that can be filtered directly, removing non-Elements - if ( risSimple.test( qualifier ) ) { - return jQuery.filter( qualifier, elements, not ); - } - - // Complex selector, compare the two sets, removing non-Elements - qualifier = jQuery.filter( qualifier, elements ); - return jQuery.grep( elements, function( elem ) { - return ( indexOf.call( qualifier, elem ) > -1 ) !== not && elem.nodeType === 1; - } ); + // Filtered directly for both simple and complex selectors + return jQuery.filter( qualifier, elements, not ); } jQuery.filter = function( expr, elems, not ) { @@ -3002,7 +2976,7 @@ var rootjQuery, for ( match in context ) { // Properties of context are called as methods if possible - if ( jQuery.isFunction( this[ match ] ) ) { + if ( isFunction( this[ match ] ) ) { this[ match ]( context[ match ] ); // ...and otherwise set as attributes @@ -3045,7 +3019,7 @@ var rootjQuery, // HANDLE: $(function) // Shortcut for document ready - } else if ( jQuery.isFunction( selector ) ) { + } else if ( isFunction( selector ) ) { return root.ready !== undefined ? root.ready( selector ) : @@ -3195,18 +3169,18 @@ jQuery.each( { return siblings( elem.firstChild ); }, contents: function( elem ) { - if ( nodeName( elem, "iframe" ) ) { - return elem.contentDocument; - } + if ( typeof elem.contentDocument !== "undefined" ) { + return elem.contentDocument; + } - // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only - // Treat the template element as a regular one in browsers that - // don't support it. - if ( nodeName( elem, "template" ) ) { - elem = elem.content || elem; - } + // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only + // Treat the template element as a regular one in browsers that + // don't support it. + if ( nodeName( elem, "template" ) ) { + elem = elem.content || elem; + } - return jQuery.merge( [], elem.childNodes ); + return jQuery.merge( [], elem.childNodes ); } }, function( name, fn ) { jQuery.fn[ name ] = function( until, selector ) { @@ -3360,11 +3334,11 @@ jQuery.Callbacks = function( options ) { ( function add( args ) { jQuery.each( args, function( _, arg ) { - if ( jQuery.isFunction( arg ) ) { + if ( isFunction( arg ) ) { if ( !options.unique || !self.has( arg ) ) { list.push( arg ); } - } else if ( arg && arg.length && jQuery.type( arg ) !== "string" ) { + } else if ( arg && arg.length && toType( arg ) !== "string" ) { // Inspect recursively add( arg ); @@ -3479,11 +3453,11 @@ function adoptValue( value, resolve, reject, noValue ) { try { // Check for promise aspect first to privilege synchronous behavior - if ( value && jQuery.isFunction( ( method = value.promise ) ) ) { + if ( value && isFunction( ( method = value.promise ) ) ) { method.call( value ).done( resolve ).fail( reject ); // Other thenables - } else if ( value && jQuery.isFunction( ( method = value.then ) ) ) { + } else if ( value && isFunction( ( method = value.then ) ) ) { method.call( value, resolve, reject ); // Other non-thenables @@ -3541,14 +3515,14 @@ jQuery.extend( { jQuery.each( tuples, function( i, tuple ) { // Map tuples (progress, done, fail) to arguments (done, fail, progress) - var fn = jQuery.isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ]; + var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ]; // deferred.progress(function() { bind to newDefer or newDefer.notify }) // deferred.done(function() { bind to newDefer or newDefer.resolve }) // deferred.fail(function() { bind to newDefer or newDefer.reject }) deferred[ tuple[ 1 ] ]( function() { var returned = fn && fn.apply( this, arguments ); - if ( returned && jQuery.isFunction( returned.promise ) ) { + if ( returned && isFunction( returned.promise ) ) { returned.promise() .progress( newDefer.notify ) .done( newDefer.resolve ) @@ -3602,7 +3576,7 @@ jQuery.extend( { returned.then; // Handle a returned thenable - if ( jQuery.isFunction( then ) ) { + if ( isFunction( then ) ) { // Special processors (notify) just wait for resolution if ( special ) { @@ -3698,7 +3672,7 @@ jQuery.extend( { resolve( 0, newDefer, - jQuery.isFunction( onProgress ) ? + isFunction( onProgress ) ? onProgress : Identity, newDefer.notifyWith @@ -3710,7 +3684,7 @@ jQuery.extend( { resolve( 0, newDefer, - jQuery.isFunction( onFulfilled ) ? + isFunction( onFulfilled ) ? onFulfilled : Identity ) @@ -3721,7 +3695,7 @@ jQuery.extend( { resolve( 0, newDefer, - jQuery.isFunction( onRejected ) ? + isFunction( onRejected ) ? onRejected : Thrower ) @@ -3761,8 +3735,15 @@ jQuery.extend( { // fulfilled_callbacks.disable tuples[ 3 - i ][ 2 ].disable, + // rejected_handlers.disable + // fulfilled_handlers.disable + tuples[ 3 - i ][ 3 ].disable, + // progress_callbacks.lock - tuples[ 0 ][ 2 ].lock + tuples[ 0 ][ 2 ].lock, + + // progress_handlers.lock + tuples[ 0 ][ 3 ].lock ); } @@ -3832,7 +3813,7 @@ jQuery.extend( { // Use .then() to unwrap secondary thenables (cf. gh-3000) if ( master.state() === "pending" || - jQuery.isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) { + isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) { return master.then(); } @@ -3960,7 +3941,7 @@ var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { bulk = key == null; // Sets many values - if ( jQuery.type( key ) === "object" ) { + if ( toType( key ) === "object" ) { chainable = true; for ( i in key ) { access( elems, fn, i, key[ i ], true, emptyGet, raw ); @@ -3970,7 +3951,7 @@ var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { } else if ( value !== undefined ) { chainable = true; - if ( !jQuery.isFunction( value ) ) { + if ( !isFunction( value ) ) { raw = true; } @@ -4012,6 +3993,23 @@ var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { return len ? fn( elems[ 0 ], key ) : emptyGet; }; + + +// Matches dashed string for camelizing +var rmsPrefix = /^-ms-/, + rdashAlpha = /-([a-z])/g; + +// Used by camelCase as callback to replace() +function fcamelCase( all, letter ) { + return letter.toUpperCase(); +} + +// Convert dashed to camelCase; used by the css and data modules +// Support: IE <=9 - 11, Edge 12 - 15 +// Microsoft forgot to hump their vendor prefix (#9572) +function camelCase( string ) { + return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); +} var acceptData = function( owner ) { // Accepts only: @@ -4074,14 +4072,14 @@ Data.prototype = { // Handle: [ owner, key, value ] args // Always use camelCase key (gh-2257) if ( typeof data === "string" ) { - cache[ jQuery.camelCase( data ) ] = value; + cache[ camelCase( data ) ] = value; // Handle: [ owner, { properties } ] args } else { // Copy the properties one-by-one to the cache object for ( prop in data ) { - cache[ jQuery.camelCase( prop ) ] = data[ prop ]; + cache[ camelCase( prop ) ] = data[ prop ]; } } return cache; @@ -4091,7 +4089,7 @@ Data.prototype = { this.cache( owner ) : // Always use camelCase key (gh-2257) - owner[ this.expando ] && owner[ this.expando ][ jQuery.camelCase( key ) ]; + owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ]; }, access: function( owner, key, value ) { @@ -4139,9 +4137,9 @@ Data.prototype = { // If key is an array of keys... // We always set camelCase keys, so remove that. - key = key.map( jQuery.camelCase ); + key = key.map( camelCase ); } else { - key = jQuery.camelCase( key ); + key = camelCase( key ); // If a key with the spaces exists, use it. // Otherwise, create an array by matching non-whitespace @@ -4287,7 +4285,7 @@ jQuery.fn.extend( { if ( attrs[ i ] ) { name = attrs[ i ].name; if ( name.indexOf( "data-" ) === 0 ) { - name = jQuery.camelCase( name.slice( 5 ) ); + name = camelCase( name.slice( 5 ) ); dataAttr( elem, name, data[ name ] ); } } @@ -4491,6 +4489,26 @@ var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; +var documentElement = document.documentElement; + + + + var isAttached = function( elem ) { + return jQuery.contains( elem.ownerDocument, elem ); + }, + composed = { composed: true }; + + // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only + // Check attachment across shadow DOM boundaries when possible (gh-3504) + // Support: iOS 10.0-10.2 only + // Early iOS 10 versions support `attachShadow` but not `getRootNode`, + // leading to errors. We need to check for `getRootNode`. + if ( documentElement.getRootNode ) { + isAttached = function( elem ) { + return jQuery.contains( elem.ownerDocument, elem ) || + elem.getRootNode( composed ) === elem.ownerDocument; + }; + } var isHiddenWithinTree = function( elem, el ) { // isHiddenWithinTree might be called from jQuery#filter function; @@ -4505,7 +4523,7 @@ var isHiddenWithinTree = function( elem, el ) { // Support: Firefox <=43 - 45 // Disconnected elements can have computed display: none, so first confirm that elem is // in the document. - jQuery.contains( elem.ownerDocument, elem ) && + isAttached( elem ) && jQuery.css( elem, "display" ) === "none"; }; @@ -4534,8 +4552,7 @@ var swap = function( elem, options, callback, args ) { function adjustCSS( elem, prop, valueParts, tween ) { - var adjusted, - scale = 1, + var adjusted, scale, maxIterations = 20, currentValue = tween ? function() { @@ -4548,35 +4565,39 @@ function adjustCSS( elem, prop, valueParts, tween ) { unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), // Starting value computation is required for potential unit mismatches - initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && + initialInUnit = elem.nodeType && + ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && rcssNum.exec( jQuery.css( elem, prop ) ); if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { + // Support: Firefox <=54 + // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144) + initial = initial / 2; + // Trust units reported by jQuery.css unit = unit || initialInUnit[ 3 ]; - // Make sure we update the tween properties later on - valueParts = valueParts || []; - // Iteratively approximate from a nonzero starting point initialInUnit = +initial || 1; - do { - - // If previous iteration zeroed out, double until we get *something*. - // Use string for doubling so we don't accidentally see scale as unchanged below - scale = scale || ".5"; + while ( maxIterations-- ) { - // Adjust and apply - initialInUnit = initialInUnit / scale; + // Evaluate and update our best guess (doubling guesses that zero out). + // Finish if the scale equals or crosses 1 (making the old*new product non-positive). jQuery.style( elem, prop, initialInUnit + unit ); + if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) { + maxIterations = 0; + } + initialInUnit = initialInUnit / scale; - // Update scale, tolerating zero or NaN from tween.cur() - // Break the loop if scale is unchanged or perfect, or if we've just had enough. - } while ( - scale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations - ); + } + + initialInUnit = initialInUnit * 2; + jQuery.style( elem, prop, initialInUnit + unit ); + + // Make sure we update the tween properties later on + valueParts = valueParts || []; } if ( valueParts ) { @@ -4692,9 +4713,9 @@ jQuery.fn.extend( { } ); var rcheckableType = ( /^(?:checkbox|radio)$/i ); -var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i ); +var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i ); -var rscriptType = ( /^$|\/(?:java|ecma)script/i ); +var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i ); @@ -4764,7 +4785,7 @@ function setGlobalEval( elems, refElements ) { var rhtml = /<|&#?\w+;/; function buildFragment( elems, context, scripts, selection, ignored ) { - var elem, tmp, tag, wrap, contains, j, + var elem, tmp, tag, wrap, attached, j, fragment = context.createDocumentFragment(), nodes = [], i = 0, @@ -4776,7 +4797,7 @@ function buildFragment( elems, context, scripts, selection, ignored ) { if ( elem || elem === 0 ) { // Add nodes directly - if ( jQuery.type( elem ) === "object" ) { + if ( toType( elem ) === "object" ) { // Support: Android <=4.0 only, PhantomJS 1 only // push.apply(_, arraylike) throws on ancient WebKit @@ -4828,13 +4849,13 @@ function buildFragment( elems, context, scripts, selection, ignored ) { continue; } - contains = jQuery.contains( elem.ownerDocument, elem ); + attached = isAttached( elem ); // Append to fragment tmp = getAll( fragment.appendChild( elem ), "script" ); // Preserve script evaluation history - if ( contains ) { + if ( attached ) { setGlobalEval( tmp ); } @@ -4877,8 +4898,6 @@ function buildFragment( elems, context, scripts, selection, ignored ) { div.innerHTML = ""; support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; } )(); -var documentElement = document.documentElement; - var @@ -4894,8 +4913,19 @@ function returnFalse() { return false; } +// Support: IE <=9 - 11+ +// focus() and blur() are asynchronous, except when they are no-op. +// So expect focus to be synchronous when the element is already active, +// and blur to be synchronous when the element is not already active. +// (focus and blur are always synchronous in other supported browsers, +// this just defines when we can count on it). +function expectSync( elem, type ) { + return ( elem === safeActiveElement() ) === ( type === "focus" ); +} + // Support: IE <=9 only -// See #13393 for more info +// Accessing document.activeElement can throw unexpectedly +// https://bugs.jquery.com/ticket/13393 function safeActiveElement() { try { return document.activeElement; @@ -5195,9 +5225,10 @@ jQuery.event = { while ( ( handleObj = matched.handlers[ j++ ] ) && !event.isImmediatePropagationStopped() ) { - // Triggered event must either 1) have no namespace, or 2) have namespace(s) - // a subset or equal to those in the bound event (both can have no namespace). - if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) { + // If the event is namespaced, then each handler is only invoked if it is + // specially universal or its namespaces are a superset of the event's. + if ( !event.rnamespace || handleObj.namespace === false || + event.rnamespace.test( handleObj.namespace ) ) { event.handleObj = handleObj; event.data = handleObj.data; @@ -5286,7 +5317,7 @@ jQuery.event = { enumerable: true, configurable: true, - get: jQuery.isFunction( hook ) ? + get: isFunction( hook ) ? function() { if ( this.originalEvent ) { return hook( this.originalEvent ); @@ -5321,39 +5352,51 @@ jQuery.event = { // Prevent triggered image.load events from bubbling to window.load noBubble: true }, - focus: { + click: { - // Fire native event if possible so blur/focus sequence is correct - trigger: function() { - if ( this !== safeActiveElement() && this.focus ) { - this.focus(); - return false; - } - }, - delegateType: "focusin" - }, - blur: { - trigger: function() { - if ( this === safeActiveElement() && this.blur ) { - this.blur(); - return false; + // Utilize native event to ensure correct state for checkable inputs + setup: function( data ) { + + // For mutual compressibility with _default, replace `this` access with a local var. + // `|| data` is dead code meant only to preserve the variable through minification. + var el = this || data; + + // Claim the first handler + if ( rcheckableType.test( el.type ) && + el.click && nodeName( el, "input" ) ) { + + // dataPriv.set( el, "click", ... ) + leverageNative( el, "click", returnTrue ); } + + // Return false to allow normal processing in the caller + return false; }, - delegateType: "focusout" - }, - click: { + trigger: function( data ) { - // For checkbox, fire native event so checked state will be right - trigger: function() { - if ( this.type === "checkbox" && this.click && nodeName( this, "input" ) ) { - this.click(); - return false; + // For mutual compressibility with _default, replace `this` access with a local var. + // `|| data` is dead code meant only to preserve the variable through minification. + var el = this || data; + + // Force setup before triggering a click + if ( rcheckableType.test( el.type ) && + el.click && nodeName( el, "input" ) ) { + + leverageNative( el, "click" ); } + + // Return non-false to allow normal event-path propagation + return true; }, - // For cross-browser consistency, don't fire native .click() on links + // For cross-browser consistency, suppress native .click() on links + // Also prevent it if we're currently inside a leveraged native-event stack _default: function( event ) { - return nodeName( event.target, "a" ); + var target = event.target; + return rcheckableType.test( target.type ) && + target.click && nodeName( target, "input" ) && + dataPriv.get( target, "click" ) || + nodeName( target, "a" ); } }, @@ -5370,6 +5413,93 @@ jQuery.event = { } }; +// Ensure the presence of an event listener that handles manually-triggered +// synthetic events by interrupting progress until reinvoked in response to +// *native* events that it fires directly, ensuring that state changes have +// already occurred before other listeners are invoked. +function leverageNative( el, type, expectSync ) { + + // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add + if ( !expectSync ) { + if ( dataPriv.get( el, type ) === undefined ) { + jQuery.event.add( el, type, returnTrue ); + } + return; + } + + // Register the controller as a special universal handler for all event namespaces + dataPriv.set( el, type, false ); + jQuery.event.add( el, type, { + namespace: false, + handler: function( event ) { + var notAsync, result, + saved = dataPriv.get( this, type ); + + if ( ( event.isTrigger & 1 ) && this[ type ] ) { + + // Interrupt processing of the outer synthetic .trigger()ed event + // Saved data should be false in such cases, but might be a leftover capture object + // from an async native handler (gh-4350) + if ( !saved.length ) { + + // Store arguments for use when handling the inner native event + // There will always be at least one argument (an event object), so this array + // will not be confused with a leftover capture object. + saved = slice.call( arguments ); + dataPriv.set( this, type, saved ); + + // Trigger the native event and capture its result + // Support: IE <=9 - 11+ + // focus() and blur() are asynchronous + notAsync = expectSync( this, type ); + this[ type ](); + result = dataPriv.get( this, type ); + if ( saved !== result || notAsync ) { + dataPriv.set( this, type, false ); + } else { + result = {}; + } + if ( saved !== result ) { + + // Cancel the outer synthetic event + event.stopImmediatePropagation(); + event.preventDefault(); + return result.value; + } + + // If this is an inner synthetic event for an event with a bubbling surrogate + // (focus or blur), assume that the surrogate already propagated from triggering the + // native event and prevent that from happening again here. + // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the + // bubbling surrogate propagates *after* the non-bubbling base), but that seems + // less bad than duplication. + } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) { + event.stopPropagation(); + } + + // If this is a native event triggered above, everything is now in order + // Fire an inner synthetic event with the original arguments + } else if ( saved.length ) { + + // ...and capture the result + dataPriv.set( this, type, { + value: jQuery.event.trigger( + + // Support: IE <=9 - 11+ + // Extend with the prototype to reset the above stopImmediatePropagation() + jQuery.extend( saved[ 0 ], jQuery.Event.prototype ), + saved.slice( 1 ), + this + ) + } ); + + // Abort handling of the native event + event.stopImmediatePropagation(); + } + } + } ); +} + jQuery.removeEvent = function( elem, type, handle ) { // This "if" is needed for plain objects @@ -5421,7 +5551,7 @@ jQuery.Event = function( src, props ) { } // Create a timestamp if incoming event doesn't have one - this.timeStamp = src && src.timeStamp || jQuery.now(); + this.timeStamp = src && src.timeStamp || Date.now(); // Mark it as fixed this[ jQuery.expando ] = true; @@ -5482,6 +5612,7 @@ jQuery.each( { shiftKey: true, view: true, "char": true, + code: true, charCode: true, key: true, keyCode: true, @@ -5528,6 +5659,33 @@ jQuery.each( { } }, jQuery.event.addProp ); +jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) { + jQuery.event.special[ type ] = { + + // Utilize native event if possible so blur/focus sequence is correct + setup: function() { + + // Claim the first handler + // dataPriv.set( this, "focus", ... ) + // dataPriv.set( this, "blur", ... ) + leverageNative( this, type, expectSync ); + + // Return false to allow normal processing in the caller + return false; + }, + trigger: function() { + + // Force setup before trigger + leverageNative( this, type ); + + // Return non-false to allow normal event-path propagation + return true; + }, + + delegateType: delegateType + }; +} ); + // Create mouseenter/leave events using mouseover/out and event-time checks // so that event delegation works in jQuery. // Do the same for pointerenter/pointerleave and pointerover/pointerout @@ -5620,14 +5778,13 @@ var /* eslint-enable */ - // Support: IE <=10 - 11, Edge 12 - 13 + // Support: IE <=10 - 11, Edge 12 - 13 only // In IE/Edge using regex groups here causes severe slowdowns. // See https://connect.microsoft.com/IE/feedback/details/1736512/ rnoInnerhtml = /\s*$/g; // Prefer a tbody over its parent table for containing new rows @@ -5635,7 +5792,7 @@ function manipulationTarget( elem, content ) { if ( nodeName( elem, "table" ) && nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { - return jQuery( ">tbody", elem )[ 0 ] || elem; + return jQuery( elem ).children( "tbody" )[ 0 ] || elem; } return elem; @@ -5647,10 +5804,8 @@ function disableScript( elem ) { return elem; } function restoreScript( elem ) { - var match = rscriptTypeMasked.exec( elem.type ); - - if ( match ) { - elem.type = match[ 1 ]; + if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) { + elem.type = elem.type.slice( 5 ); } else { elem.removeAttribute( "type" ); } @@ -5716,15 +5871,15 @@ function domManip( collection, args, callback, ignored ) { l = collection.length, iNoClone = l - 1, value = args[ 0 ], - isFunction = jQuery.isFunction( value ); + valueIsFunction = isFunction( value ); // We can't cloneNode fragments that contain checked, in WebKit - if ( isFunction || + if ( valueIsFunction || ( l > 1 && typeof value === "string" && !support.checkClone && rchecked.test( value ) ) ) { return collection.each( function( index ) { var self = collection.eq( index ); - if ( isFunction ) { + if ( valueIsFunction ) { args[ 0 ] = value.call( this, index, self.html() ); } domManip( self, args, callback, ignored ); @@ -5778,14 +5933,16 @@ function domManip( collection, args, callback, ignored ) { !dataPriv.access( node, "globalEval" ) && jQuery.contains( doc, node ) ) { - if ( node.src ) { + if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) { // Optional AJAX dependency, but won't run scripts if not present - if ( jQuery._evalUrl ) { - jQuery._evalUrl( node.src ); + if ( jQuery._evalUrl && !node.noModule ) { + jQuery._evalUrl( node.src, { + nonce: node.nonce || node.getAttribute( "nonce" ) + } ); } } else { - DOMEval( node.textContent.replace( rcleanScript, "" ), doc ); + DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc ); } } } @@ -5807,7 +5964,7 @@ function remove( elem, selector, keepData ) { } if ( node.parentNode ) { - if ( keepData && jQuery.contains( node.ownerDocument, node ) ) { + if ( keepData && isAttached( node ) ) { setGlobalEval( getAll( node, "script" ) ); } node.parentNode.removeChild( node ); @@ -5825,7 +5982,7 @@ jQuery.extend( { clone: function( elem, dataAndEvents, deepDataAndEvents ) { var i, l, srcElements, destElements, clone = elem.cloneNode( true ), - inPage = jQuery.contains( elem.ownerDocument, elem ); + inPage = isAttached( elem ); // Fix IE cloning issues if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && @@ -6065,8 +6222,6 @@ jQuery.each( { return this.pushStack( ret ); }; } ); -var rmargin = ( /^margin/ ); - var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); var getStyles = function( elem ) { @@ -6083,6 +6238,8 @@ var getStyles = function( elem ) { return view.getComputedStyle( elem ); }; +var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" ); + ( function() { @@ -6096,25 +6253,35 @@ var getStyles = function( elem ) { return; } + container.style.cssText = "position:absolute;left:-11111px;width:60px;" + + "margin-top:1px;padding:0;border:0"; div.style.cssText = - "box-sizing:border-box;" + - "position:relative;display:block;" + + "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + "margin:auto;border:1px;padding:1px;" + - "top:1%;width:50%"; - div.innerHTML = ""; - documentElement.appendChild( container ); + "width:60%;top:1%"; + documentElement.appendChild( container ).appendChild( div ); var divStyle = window.getComputedStyle( div ); pixelPositionVal = divStyle.top !== "1%"; // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 - reliableMarginLeftVal = divStyle.marginLeft === "2px"; - boxSizingReliableVal = divStyle.width === "4px"; + reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12; - // Support: Android 4.0 - 4.3 only + // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3 // Some styles come back with percentage values, even though they shouldn't - div.style.marginRight = "50%"; - pixelMarginRightVal = divStyle.marginRight === "4px"; + div.style.right = "60%"; + pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36; + + // Support: IE 9 - 11 only + // Detect misreporting of content dimensions for box-sizing:border-box elements + boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36; + + // Support: IE 9 only + // Detect overflow:scroll screwiness (gh-3699) + // Support: Chrome <=64 + // Don't get tricked when zoom affects offsetWidth (gh-4029) + div.style.position = "absolute"; + scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12; documentElement.removeChild( container ); @@ -6123,7 +6290,12 @@ var getStyles = function( elem ) { div = null; } - var pixelPositionVal, boxSizingReliableVal, pixelMarginRightVal, reliableMarginLeftVal, + function roundPixelMeasures( measure ) { + return Math.round( parseFloat( measure ) ); + } + + var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal, + reliableMarginLeftVal, container = document.createElement( "div" ), div = document.createElement( "div" ); @@ -6138,26 +6310,26 @@ var getStyles = function( elem ) { div.cloneNode( true ).style.backgroundClip = ""; support.clearCloneStyle = div.style.backgroundClip === "content-box"; - container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" + - "padding:0;margin-top:1px;position:absolute"; - container.appendChild( div ); - jQuery.extend( support, { - pixelPosition: function() { - computeStyleTests(); - return pixelPositionVal; - }, boxSizingReliable: function() { computeStyleTests(); return boxSizingReliableVal; }, - pixelMarginRight: function() { + pixelBoxStyles: function() { + computeStyleTests(); + return pixelBoxStylesVal; + }, + pixelPosition: function() { computeStyleTests(); - return pixelMarginRightVal; + return pixelPositionVal; }, reliableMarginLeft: function() { computeStyleTests(); return reliableMarginLeftVal; + }, + scrollboxSize: function() { + computeStyleTests(); + return scrollboxSizeVal; } } ); } )(); @@ -6180,7 +6352,7 @@ function curCSS( elem, name, computed ) { if ( computed ) { ret = computed.getPropertyValue( name ) || computed[ name ]; - if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { + if ( ret === "" && !isAttached( elem ) ) { ret = jQuery.style( elem, name ); } @@ -6189,7 +6361,7 @@ function curCSS( elem, name, computed ) { // but width seems to be reliably pixels. // This is against the CSSOM draft spec: // https://drafts.csswg.org/cssom/#resolved-values - if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) { + if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) { // Remember the original values width = style.width; @@ -6236,30 +6408,13 @@ function addGetHookIf( conditionFn, hookFn ) { } -var +var cssPrefixes = [ "Webkit", "Moz", "ms" ], + emptyStyle = document.createElement( "div" ).style, + vendorProps = {}; - // Swappable if display is none or starts with table - // except "table", "table-cell", or "table-caption" - // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display - rdisplayswap = /^(none|table(?!-c[ea]).+)/, - rcustomProp = /^--/, - cssShow = { position: "absolute", visibility: "hidden", display: "block" }, - cssNormalTransform = { - letterSpacing: "0", - fontWeight: "400" - }, - - cssPrefixes = [ "Webkit", "Moz", "ms" ], - emptyStyle = document.createElement( "div" ).style; - -// Return a css property mapped to a potentially vendor prefixed property +// Return a vendor-prefixed property or undefined function vendorPropName( name ) { - // Shortcut for names that are not vendor prefixed - if ( name in emptyStyle ) { - return name; - } - // Check for vendor prefixed names var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), i = cssPrefixes.length; @@ -6272,16 +6427,33 @@ function vendorPropName( name ) { } } -// Return a property mapped along what jQuery.cssProps suggests or to -// a vendor prefixed property. +// Return a potentially-mapped jQuery.cssProps or vendor prefixed property function finalPropName( name ) { - var ret = jQuery.cssProps[ name ]; - if ( !ret ) { - ret = jQuery.cssProps[ name ] = vendorPropName( name ) || name; + var final = jQuery.cssProps[ name ] || vendorProps[ name ]; + + if ( final ) { + return final; } - return ret; + if ( name in emptyStyle ) { + return name; + } + return vendorProps[ name ] = vendorPropName( name ) || name; } + +var + + // Swappable if display is none or starts with table + // except "table", "table-cell", or "table-caption" + // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display + rdisplayswap = /^(none|table(?!-c[ea]).+)/, + rcustomProp = /^--/, + cssShow = { position: "absolute", visibility: "hidden", display: "block" }, + cssNormalTransform = { + letterSpacing: "0", + fontWeight: "400" + }; + function setPositiveNumber( elem, value, subtract ) { // Any relative (+/-) values have already been @@ -6294,87 +6466,137 @@ function setPositiveNumber( elem, value, subtract ) { value; } -function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) { - var i, - val = 0; - - // If we already have the right measurement, avoid augmentation - if ( extra === ( isBorderBox ? "border" : "content" ) ) { - i = 4; +function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) { + var i = dimension === "width" ? 1 : 0, + extra = 0, + delta = 0; - // Otherwise initialize for horizontal or vertical properties - } else { - i = name === "width" ? 1 : 0; + // Adjustment may not be necessary + if ( box === ( isBorderBox ? "border" : "content" ) ) { + return 0; } for ( ; i < 4; i += 2 ) { - // Both box models exclude margin, so add it if we want it - if ( extra === "margin" ) { - val += jQuery.css( elem, extra + cssExpand[ i ], true, styles ); + // Both box models exclude margin + if ( box === "margin" ) { + delta += jQuery.css( elem, box + cssExpand[ i ], true, styles ); } - if ( isBorderBox ) { + // If we get here with a content-box, we're seeking "padding" or "border" or "margin" + if ( !isBorderBox ) { - // border-box includes padding, so remove it if we want content - if ( extra === "content" ) { - val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); - } + // Add padding + delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); + + // For "border" or "margin", add border + if ( box !== "padding" ) { + delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); - // At this point, extra isn't border nor margin, so remove border - if ( extra !== "margin" ) { - val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); + // But still keep track of it otherwise + } else { + extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); } + + // If we get here with a border-box (content + padding + border), we're seeking "content" or + // "padding" or "margin" } else { - // At this point, extra isn't content, so add padding - val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); + // For "content", subtract padding + if ( box === "content" ) { + delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); + } - // At this point, extra isn't content nor padding, so add border - if ( extra !== "padding" ) { - val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); + // For "content" or "padding", subtract border + if ( box !== "margin" ) { + delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); } } } - return val; + // Account for positive content-box scroll gutter when requested by providing computedVal + if ( !isBorderBox && computedVal >= 0 ) { + + // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border + // Assuming integer scroll gutter, subtract the rest and round down + delta += Math.max( 0, Math.ceil( + elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - + computedVal - + delta - + extra - + 0.5 + + // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter + // Use an explicit zero to avoid NaN (gh-3964) + ) ) || 0; + } + + return delta; } -function getWidthOrHeight( elem, name, extra ) { +function getWidthOrHeight( elem, dimension, extra ) { // Start with computed style - var valueIsBorderBox, - styles = getStyles( elem ), - val = curCSS( elem, name, styles ), - isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; + var styles = getStyles( elem ), + + // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322). + // Fake content-box until we know it's needed to know the true value. + boxSizingNeeded = !support.boxSizingReliable() || extra, + isBorderBox = boxSizingNeeded && + jQuery.css( elem, "boxSizing", false, styles ) === "border-box", + valueIsBorderBox = isBorderBox, + + val = curCSS( elem, dimension, styles ), + offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ); - // Computed unit is not pixels. Stop here and return. + // Support: Firefox <=54 + // Return a confounding non-pixel value or feign ignorance, as appropriate. if ( rnumnonpx.test( val ) ) { - return val; + if ( !extra ) { + return val; + } + val = "auto"; } - // Check for style in case a browser which returns unreliable values - // for getComputedStyle silently falls back to the reliable elem.style - valueIsBorderBox = isBorderBox && - ( support.boxSizingReliable() || val === elem.style[ name ] ); - // Fall back to offsetWidth/Height when value is "auto" + // Fall back to offsetWidth/offsetHeight when value is "auto" // This happens for inline elements with no explicit setting (gh-3571) - if ( val === "auto" ) { - val = elem[ "offset" + name[ 0 ].toUpperCase() + name.slice( 1 ) ]; + // Support: Android <=4.1 - 4.3 only + // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602) + // Support: IE 9-11 only + // Also use offsetWidth/offsetHeight for when box sizing is unreliable + // We use getClientRects() to check for hidden/disconnected. + // In those cases, the computed value can be trusted to be border-box + if ( ( !support.boxSizingReliable() && isBorderBox || + val === "auto" || + !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) && + elem.getClientRects().length ) { + + isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; + + // Where available, offsetWidth/offsetHeight approximate border box dimensions. + // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the + // retrieved value as a content box dimension. + valueIsBorderBox = offsetProp in elem; + if ( valueIsBorderBox ) { + val = elem[ offsetProp ]; + } } - // Normalize "", auto, and prepare for extra + // Normalize "" and auto val = parseFloat( val ) || 0; - // Use the active box-sizing model to add/subtract irrelevant styles + // Adjust for the element's box model return ( val + - augmentWidthOrHeight( + boxModelAdjustment( elem, - name, + dimension, extra || ( isBorderBox ? "border" : "content" ), valueIsBorderBox, - styles + styles, + + // Provide the current computed size to request scroll gutter calculation (gh-3589) + val ) ) + "px"; } @@ -6404,6 +6626,13 @@ jQuery.extend( { "flexGrow": true, "flexShrink": true, "fontWeight": true, + "gridArea": true, + "gridColumn": true, + "gridColumnEnd": true, + "gridColumnStart": true, + "gridRow": true, + "gridRowEnd": true, + "gridRowStart": true, "lineHeight": true, "opacity": true, "order": true, @@ -6415,9 +6644,7 @@ jQuery.extend( { // Add in properties whose names you wish to fix before // setting or getting the value - cssProps: { - "float": "cssFloat" - }, + cssProps: {}, // Get and set the style property on a DOM Node style: function( elem, name, value, extra ) { @@ -6429,7 +6656,7 @@ jQuery.extend( { // Make sure that we're working with the right name var ret, type, hooks, - origName = jQuery.camelCase( name ), + origName = camelCase( name ), isCustomProp = rcustomProp.test( name ), style = elem.style; @@ -6461,7 +6688,9 @@ jQuery.extend( { } // If a number was passed in, add the unit (except for certain CSS properties) - if ( type === "number" ) { + // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append + // "px" to a few hardcoded values. + if ( type === "number" && !isCustomProp ) { value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); } @@ -6497,7 +6726,7 @@ jQuery.extend( { css: function( elem, name, extra, styles ) { var val, num, hooks, - origName = jQuery.camelCase( name ), + origName = camelCase( name ), isCustomProp = rcustomProp.test( name ); // Make sure that we're working with the right name. We don't @@ -6535,8 +6764,8 @@ jQuery.extend( { } } ); -jQuery.each( [ "height", "width" ], function( i, name ) { - jQuery.cssHooks[ name ] = { +jQuery.each( [ "height", "width" ], function( i, dimension ) { + jQuery.cssHooks[ dimension ] = { get: function( elem, computed, extra ) { if ( computed ) { @@ -6552,29 +6781,52 @@ jQuery.each( [ "height", "width" ], function( i, name ) { // in IE throws an error. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ? swap( elem, cssShow, function() { - return getWidthOrHeight( elem, name, extra ); + return getWidthOrHeight( elem, dimension, extra ); } ) : - getWidthOrHeight( elem, name, extra ); + getWidthOrHeight( elem, dimension, extra ); } }, set: function( elem, value, extra ) { var matches, - styles = extra && getStyles( elem ), - subtract = extra && augmentWidthOrHeight( - elem, - name, - extra, + styles = getStyles( elem ), + + // Only read styles.position if the test has a chance to fail + // to avoid forcing a reflow. + scrollboxSizeBuggy = !support.scrollboxSize() && + styles.position === "absolute", + + // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991) + boxSizingNeeded = scrollboxSizeBuggy || extra, + isBorderBox = boxSizingNeeded && jQuery.css( elem, "boxSizing", false, styles ) === "border-box", - styles + subtract = extra ? + boxModelAdjustment( + elem, + dimension, + extra, + isBorderBox, + styles + ) : + 0; + + // Account for unreliable border-box dimensions by comparing offset* to computed and + // faking a content-box to get border and padding (gh-3699) + if ( isBorderBox && scrollboxSizeBuggy ) { + subtract -= Math.ceil( + elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - + parseFloat( styles[ dimension ] ) - + boxModelAdjustment( elem, dimension, "border", false, styles ) - + 0.5 ); + } // Convert to pixels if value adjustment is needed if ( subtract && ( matches = rcssNum.exec( value ) ) && ( matches[ 3 ] || "px" ) !== "px" ) { - elem.style[ name ] = value; - value = jQuery.css( elem, name ); + elem.style[ dimension ] = value; + value = jQuery.css( elem, dimension ); } return setPositiveNumber( elem, value, subtract ); @@ -6618,7 +6870,7 @@ jQuery.each( { } }; - if ( !rmargin.test( prefix ) ) { + if ( prefix !== "margin" ) { jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; } } ); @@ -6728,9 +6980,9 @@ Tween.propHooks = { // Use .style if available and use plain properties where available. if ( jQuery.fx.step[ tween.prop ] ) { jQuery.fx.step[ tween.prop ]( tween ); - } else if ( tween.elem.nodeType === 1 && - ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || - jQuery.cssHooks[ tween.prop ] ) ) { + } else if ( tween.elem.nodeType === 1 && ( + jQuery.cssHooks[ tween.prop ] || + tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) { jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); } else { tween.elem[ tween.prop ] = tween.now; @@ -6789,7 +7041,7 @@ function createFxNow() { window.setTimeout( function() { fxNow = undefined; } ); - return ( fxNow = jQuery.now() ); + return ( fxNow = Date.now() ); } // Generate parameters to create a standard animation @@ -6893,9 +7145,10 @@ function defaultPrefilter( elem, props, opts ) { // Restrict "overflow" and "display" styles during box animations if ( isBox && elem.nodeType === 1 ) { - // Support: IE <=9 - 11, Edge 12 - 13 + // Support: IE <=9 - 11, Edge 12 - 15 // Record all 3 overflow attributes because IE does not infer the shorthand - // from identically-valued overflowX and overflowY + // from identically-valued overflowX and overflowY and Edge just mirrors + // the overflowX value there. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; // Identify a display type, preferring old show/hide data over the CSS cascade @@ -7003,7 +7256,7 @@ function propFilter( props, specialEasing ) { // camelCase, specialEasing and expand cssHook pass for ( index in props ) { - name = jQuery.camelCase( index ); + name = camelCase( index ); easing = specialEasing[ name ]; value = props[ index ]; if ( Array.isArray( value ) ) { @@ -7128,9 +7381,9 @@ function Animation( elem, properties, options ) { for ( ; index < length; index++ ) { result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); if ( result ) { - if ( jQuery.isFunction( result.stop ) ) { + if ( isFunction( result.stop ) ) { jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = - jQuery.proxy( result.stop, result ); + result.stop.bind( result ); } return result; } @@ -7138,7 +7391,7 @@ function Animation( elem, properties, options ) { jQuery.map( props, createTween, animation ); - if ( jQuery.isFunction( animation.opts.start ) ) { + if ( isFunction( animation.opts.start ) ) { animation.opts.start.call( elem, animation ); } @@ -7171,7 +7424,7 @@ jQuery.Animation = jQuery.extend( Animation, { }, tweener: function( props, callback ) { - if ( jQuery.isFunction( props ) ) { + if ( isFunction( props ) ) { callback = props; props = [ "*" ]; } else { @@ -7203,9 +7456,9 @@ jQuery.Animation = jQuery.extend( Animation, { jQuery.speed = function( speed, easing, fn ) { var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { complete: fn || !fn && easing || - jQuery.isFunction( speed ) && speed, + isFunction( speed ) && speed, duration: speed, - easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing + easing: fn && easing || easing && !isFunction( easing ) && easing }; // Go to the end state if fx are off @@ -7232,7 +7485,7 @@ jQuery.speed = function( speed, easing, fn ) { opt.old = opt.complete; opt.complete = function() { - if ( jQuery.isFunction( opt.old ) ) { + if ( isFunction( opt.old ) ) { opt.old.call( this ); } @@ -7396,7 +7649,7 @@ jQuery.fx.tick = function() { i = 0, timers = jQuery.timers; - fxNow = jQuery.now(); + fxNow = Date.now(); for ( ; i < timers.length; i++ ) { timer = timers[ i ]; @@ -7749,7 +8002,7 @@ jQuery.each( [ // Strip and collapse whitespace according to HTML spec - // https://html.spec.whatwg.org/multipage/infrastructure.html#strip-and-collapse-whitespace + // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace function stripAndCollapse( value ) { var tokens = value.match( rnothtmlwhite ) || []; return tokens.join( " " ); @@ -7760,20 +8013,30 @@ function getClass( elem ) { return elem.getAttribute && elem.getAttribute( "class" ) || ""; } +function classesToArray( value ) { + if ( Array.isArray( value ) ) { + return value; + } + if ( typeof value === "string" ) { + return value.match( rnothtmlwhite ) || []; + } + return []; +} + jQuery.fn.extend( { addClass: function( value ) { var classes, elem, cur, curValue, clazz, j, finalValue, i = 0; - if ( jQuery.isFunction( value ) ) { + if ( isFunction( value ) ) { return this.each( function( j ) { jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); } ); } - if ( typeof value === "string" && value ) { - classes = value.match( rnothtmlwhite ) || []; + classes = classesToArray( value ); + if ( classes.length ) { while ( ( elem = this[ i++ ] ) ) { curValue = getClass( elem ); cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); @@ -7802,7 +8065,7 @@ jQuery.fn.extend( { var classes, elem, cur, curValue, clazz, j, finalValue, i = 0; - if ( jQuery.isFunction( value ) ) { + if ( isFunction( value ) ) { return this.each( function( j ) { jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); } ); @@ -7812,9 +8075,9 @@ jQuery.fn.extend( { return this.attr( "class", "" ); } - if ( typeof value === "string" && value ) { - classes = value.match( rnothtmlwhite ) || []; + classes = classesToArray( value ); + if ( classes.length ) { while ( ( elem = this[ i++ ] ) ) { curValue = getClass( elem ); @@ -7844,13 +8107,14 @@ jQuery.fn.extend( { }, toggleClass: function( value, stateVal ) { - var type = typeof value; + var type = typeof value, + isValidValue = type === "string" || Array.isArray( value ); - if ( typeof stateVal === "boolean" && type === "string" ) { + if ( typeof stateVal === "boolean" && isValidValue ) { return stateVal ? this.addClass( value ) : this.removeClass( value ); } - if ( jQuery.isFunction( value ) ) { + if ( isFunction( value ) ) { return this.each( function( i ) { jQuery( this ).toggleClass( value.call( this, i, getClass( this ), stateVal ), @@ -7862,12 +8126,12 @@ jQuery.fn.extend( { return this.each( function() { var className, i, self, classNames; - if ( type === "string" ) { + if ( isValidValue ) { // Toggle individual class names i = 0; self = jQuery( this ); - classNames = value.match( rnothtmlwhite ) || []; + classNames = classesToArray( value ); while ( ( className = classNames[ i++ ] ) ) { @@ -7926,7 +8190,7 @@ var rreturn = /\r/g; jQuery.fn.extend( { val: function( value ) { - var hooks, ret, isFunction, + var hooks, ret, valueIsFunction, elem = this[ 0 ]; if ( !arguments.length ) { @@ -7955,7 +8219,7 @@ jQuery.fn.extend( { return; } - isFunction = jQuery.isFunction( value ); + valueIsFunction = isFunction( value ); return this.each( function( i ) { var val; @@ -7964,7 +8228,7 @@ jQuery.fn.extend( { return; } - if ( isFunction ) { + if ( valueIsFunction ) { val = value.call( this, i, jQuery( this ).val() ); } else { val = value; @@ -8106,18 +8370,24 @@ jQuery.each( [ "radio", "checkbox" ], function() { // Return jQuery for attributes-only inclusion -var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/; +support.focusin = "onfocusin" in window; + + +var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, + stopPropagationCallback = function( e ) { + e.stopPropagation(); + }; jQuery.extend( jQuery.event, { trigger: function( event, data, elem, onlyHandlers ) { - var i, cur, tmp, bubbleType, ontype, handle, special, + var i, cur, tmp, bubbleType, ontype, handle, special, lastElement, eventPath = [ elem || document ], type = hasOwn.call( event, "type" ) ? event.type : event, namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; - cur = tmp = elem = elem || document; + cur = lastElement = tmp = elem = elem || document; // Don't do events on text and comment nodes if ( elem.nodeType === 3 || elem.nodeType === 8 ) { @@ -8169,7 +8439,7 @@ jQuery.extend( jQuery.event, { // Determine event propagation path in advance, per W3C events spec (#9951) // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) - if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { + if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) { bubbleType = special.delegateType || type; if ( !rfocusMorph.test( bubbleType + type ) ) { @@ -8189,7 +8459,7 @@ jQuery.extend( jQuery.event, { // Fire handlers on the event path i = 0; while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { - + lastElement = cur; event.type = i > 1 ? bubbleType : special.bindType || type; @@ -8221,7 +8491,7 @@ jQuery.extend( jQuery.event, { // Call a native DOM method on the target with the same name as the event. // Don't do default actions on window, that's where global variables be (#6170) - if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) { + if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) { // Don't re-trigger an onFOO event when we call its FOO() method tmp = elem[ ontype ]; @@ -8232,7 +8502,17 @@ jQuery.extend( jQuery.event, { // Prevent re-triggering of the same event, since we already bubbled it above jQuery.event.triggered = type; + + if ( event.isPropagationStopped() ) { + lastElement.addEventListener( type, stopPropagationCallback ); + } + elem[ type ](); + + if ( event.isPropagationStopped() ) { + lastElement.removeEventListener( type, stopPropagationCallback ); + } + jQuery.event.triggered = undefined; if ( tmp ) { @@ -8278,31 +8558,6 @@ jQuery.fn.extend( { } ); -jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " + - "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + - "change select submit keydown keypress keyup contextmenu" ).split( " " ), - function( i, name ) { - - // Handle event binding - jQuery.fn[ name ] = function( data, fn ) { - return arguments.length > 0 ? - this.on( name, null, data, fn ) : - this.trigger( name ); - }; -} ); - -jQuery.fn.extend( { - hover: function( fnOver, fnOut ) { - return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); - } -} ); - - - - -support.focusin = "onfocusin" in window; - - // Support: Firefox <=44 // Firefox doesn't have focus(in | out) events // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 @@ -8346,7 +8601,7 @@ if ( !support.focusin ) { } var location = window.location; -var nonce = jQuery.now(); +var nonce = Date.now(); var rquery = ( /\?/ ); @@ -8404,7 +8659,7 @@ function buildParams( prefix, obj, traditional, add ) { } } ); - } else if ( !traditional && jQuery.type( obj ) === "object" ) { + } else if ( !traditional && toType( obj ) === "object" ) { // Serialize object item. for ( name in obj ) { @@ -8426,7 +8681,7 @@ jQuery.param = function( a, traditional ) { add = function( key, valueOrFunction ) { // If value is a function, invoke it and use its return value - var value = jQuery.isFunction( valueOrFunction ) ? + var value = isFunction( valueOrFunction ) ? valueOrFunction() : valueOrFunction; @@ -8434,6 +8689,10 @@ jQuery.param = function( a, traditional ) { encodeURIComponent( value == null ? "" : value ); }; + if ( a == null ) { + return ""; + } + // If an array was passed in, assume that it is an array of form elements. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { @@ -8544,7 +8803,7 @@ function addToPrefiltersOrTransports( structure ) { i = 0, dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || []; - if ( jQuery.isFunction( func ) ) { + if ( isFunction( func ) ) { // For each dataType in the dataTypeExpression while ( ( dataType = dataTypes[ i++ ] ) ) { @@ -8936,12 +9195,14 @@ jQuery.extend( { if ( !responseHeaders ) { responseHeaders = {}; while ( ( match = rheaders.exec( responseHeadersString ) ) ) { - responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ]; + responseHeaders[ match[ 1 ].toLowerCase() + " " ] = + ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] ) + .concat( match[ 2 ] ); } } - match = responseHeaders[ key.toLowerCase() ]; + match = responseHeaders[ key.toLowerCase() + " " ]; } - return match == null ? null : match; + return match == null ? null : match.join( ", " ); }, // Raw string @@ -9016,7 +9277,7 @@ jQuery.extend( { if ( s.crossDomain == null ) { urlAnchor = document.createElement( "a" ); - // Support: IE <=8 - 11, Edge 12 - 13 + // Support: IE <=8 - 11, Edge 12 - 15 // IE throws exception on accessing the href property if url is malformed, // e.g. http://example.com:80x/ try { @@ -9074,8 +9335,8 @@ jQuery.extend( { // Remember the hash so we can put it back uncached = s.url.slice( cacheURL.length ); - // If data is available, append data to url - if ( s.data ) { + // If data is available and should be processed, append data to url + if ( s.data && ( s.processData || typeof s.data === "string" ) ) { cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data; // #9682: remove data so that it's not used in an eventual retry @@ -9312,7 +9573,7 @@ jQuery.each( [ "get", "post" ], function( i, method ) { jQuery[ method ] = function( url, data, callback, type ) { // Shift arguments if data argument was omitted - if ( jQuery.isFunction( data ) ) { + if ( isFunction( data ) ) { type = type || callback; callback = data; data = undefined; @@ -9330,7 +9591,7 @@ jQuery.each( [ "get", "post" ], function( i, method ) { } ); -jQuery._evalUrl = function( url ) { +jQuery._evalUrl = function( url, options ) { return jQuery.ajax( { url: url, @@ -9340,7 +9601,16 @@ jQuery._evalUrl = function( url ) { cache: true, async: false, global: false, - "throws": true + + // Only evaluate the response if it is successful (gh-4126) + // dataFilter is not invoked for failure responses, so using it instead + // of the default converter is kludgy but it works. + converters: { + "text script": function() {} + }, + dataFilter: function( response ) { + jQuery.globalEval( response, options ); + } } ); }; @@ -9350,7 +9620,7 @@ jQuery.fn.extend( { var wrap; if ( this[ 0 ] ) { - if ( jQuery.isFunction( html ) ) { + if ( isFunction( html ) ) { html = html.call( this[ 0 ] ); } @@ -9376,7 +9646,7 @@ jQuery.fn.extend( { }, wrapInner: function( html ) { - if ( jQuery.isFunction( html ) ) { + if ( isFunction( html ) ) { return this.each( function( i ) { jQuery( this ).wrapInner( html.call( this, i ) ); } ); @@ -9396,10 +9666,10 @@ jQuery.fn.extend( { }, wrap: function( html ) { - var isFunction = jQuery.isFunction( html ); + var htmlIsFunction = isFunction( html ); return this.each( function( i ) { - jQuery( this ).wrapAll( isFunction ? html.call( this, i ) : html ); + jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html ); } ); }, @@ -9491,7 +9761,8 @@ jQuery.ajaxTransport( function( options ) { return function() { if ( callback ) { callback = errorCallback = xhr.onload = - xhr.onerror = xhr.onabort = xhr.onreadystatechange = null; + xhr.onerror = xhr.onabort = xhr.ontimeout = + xhr.onreadystatechange = null; if ( type === "abort" ) { xhr.abort(); @@ -9531,7 +9802,7 @@ jQuery.ajaxTransport( function( options ) { // Listen to events xhr.onload = callback(); - errorCallback = xhr.onerror = callback( "error" ); + errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" ); // Support: IE 9 only // Use onreadystatechange to replace onabort @@ -9622,24 +9893,21 @@ jQuery.ajaxPrefilter( "script", function( s ) { // Bind script tag hack transport jQuery.ajaxTransport( "script", function( s ) { - // This transport only deals with cross domain requests - if ( s.crossDomain ) { + // This transport only deals with cross domain or forced-by-attrs requests + if ( s.crossDomain || s.scriptAttrs ) { var script, callback; return { send: function( _, complete ) { - script = jQuery( " + @@ -38,7 +37,7 @@

Credits

Development Lead

@@ -89,13 +88,11 @@

Related Topics

@@ -116,7 +113,7 @@

Quick search

©2019, Franco Donati. | - Powered by Sphinx 1.8.2 + Powered by Sphinx 2.2.0 & Alabaster 0.7.12 | diff --git a/docs/_build/html/contributing.html b/docs/_build/html/contributing.html index 9f66ae8..03c339f 100644 --- a/docs/_build/html/contributing.html +++ b/docs/_build/html/contributing.html @@ -1,11 +1,9 @@ - + - - + Contributing — pycirk 1.5.0 documentation @@ -13,6 +11,7 @@ + @@ -45,9 +44,9 @@

Report Bugshttps://github.com/FDonati/pycirk/issues.

If you are reporting a bug, please include:

    -
  • Your operating system name and version.
  • -
  • Any details about your local setup that might be helpful in troubleshooting.
  • -
  • Detailed steps to reproduce the bug.
  • +
  • Your operating system name and version.

  • +
  • Any details about your local setup that might be helpful in troubleshooting.

  • +
  • Detailed steps to reproduce the bug.

@@ -71,10 +70,10 @@

Submit Feedbackhttps://github.com/FDonati/pycirk/issues.

If you are proposing a feature:

    -
  • Explain in detail how it would work.
  • -
  • Keep the scope as narrow as possible, to make it easier to implement.
  • -
  • Remember that this is a volunteer-driven project, and that contributions -are welcome :)
  • +
  • Explain in detail how it would work.

  • +
  • Keep the scope as narrow as possible, to make it easier to implement.

  • +
  • Remember that this is a volunteer-driven project, and that contributions +are welcome :)

@@ -82,27 +81,26 @@

Submit Feedback

Ready to contribute? Here’s how to set up pycirk for local development.

    -
  1. Fork the pycirk repo on GitHub.

    -
  2. -
  3. Clone your fork locally:

    +
  4. Fork the pycirk repo on GitHub.

  5. +
  6. Clone your fork locally:

    $ git clone git@github.com:your_name_here/pycirk.git
     
  7. -
  8. Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development:

    +
  9. Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development:

    $ mkvirtualenv pycirk
     $ cd pycirk/
     $ python setup.py develop
     
  10. -
  11. Create a branch for local development:

    +
  12. Create a branch for local development:

    $ git checkout -b name-of-your-bugfix-or-feature
     

    Now you can make your changes locally.

  13. -
  14. When you’re done making changes, check that your changes pass flake8 and the +

  15. When you’re done making changes, check that your changes pass flake8 and the tests, including testing other Python versions with tox:

Pull Request Guidelines

Before you submit a pull request, check that it meets these guidelines:

    -
  1. The pull request should include tests.
  2. -
  3. If the pull request adds functionality, the docs should be updated. Put +
  4. The pull request should include tests.

  5. +
  6. If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring, and add the -feature to the list in README.rst.

  7. -
  8. The pull request should work for Python 2.7, 3.4, 3.5 and 3.6, and for PyPy. Check +feature to the list in README.rst.

  9. +
  10. The pull request should work for Python 2.7, 3.4, 3.5 and 3.6, and for PyPy. Check https://travis-ci.org/FDonati/pycirk/pull_requests -and make sure that the tests pass for all supported Python versions.

  11. +and make sure that the tests pass for all supported Python versions.

@@ -201,13 +198,11 @@

Related Topics

@@ -228,7 +223,7 @@

Quick search

©2019, Franco Donati. | - Powered by Sphinx 1.8.2 + Powered by Sphinx 2.2.0 & Alabaster 0.7.12 | diff --git a/docs/_build/html/genindex.html b/docs/_build/html/genindex.html index dc18352..35c6135 100644 --- a/docs/_build/html/genindex.html +++ b/docs/_build/html/genindex.html @@ -1,12 +1,10 @@ - + - - + Index — pycirk 1.5.0 documentation @@ -14,6 +12,7 @@ + @@ -73,8 +72,6 @@

A

  • allocate_sec_mat() (in module pycirk.make_secondary_flows)
  • apply_labels() (pycirk.labels.Labels method) -
  • -
  • assign_labels_to_class() (pycirk.pycirk_settings.Settings method)
  • @@ -294,13 +291,15 @@

    R

  • (pycirk.fundamental_operations.Operations.PxP_ITA_TC method)
  • - - + @@ -451,7 +448,7 @@

    Quick search

    ©2019, Franco Donati. | - Powered by Sphinx 1.8.2 + Powered by Sphinx 2.2.0 & Alabaster 0.7.12 diff --git a/docs/_build/html/history.html b/docs/_build/html/history.html index b71fdf6..f7ce3aa 100644 --- a/docs/_build/html/history.html +++ b/docs/_build/html/history.html @@ -1,11 +1,9 @@ - + - - + History — pycirk 1.5.0 documentation @@ -13,6 +11,7 @@ + @@ -37,7 +36,7 @@

    History

    0.1.0 (2018-05-11)

      -
    • First release on PyPI.
    • +
    • First release on PyPI.

    @@ -82,13 +81,11 @@

    Related Topics

    @@ -109,7 +106,7 @@

    Quick search

    ©2019, Franco Donati. | - Powered by Sphinx 1.8.2 + Powered by Sphinx 2.2.0 & Alabaster 0.7.12 | diff --git a/docs/_build/html/index.html b/docs/_build/html/index.html index ac2daec..89d5b5b 100644 --- a/docs/_build/html/index.html +++ b/docs/_build/html/index.html @@ -1,11 +1,9 @@ - + - - + Welcome to pycirk’s documentation! — pycirk 1.5.0 documentation @@ -13,6 +11,7 @@ + @@ -78,9 +77,9 @@

    Welcome to pycirk’s documentation!

    Indices and tables

    @@ -121,13 +120,11 @@

    Related Topics

    @@ -148,7 +145,7 @@

    Quick search

    ©2019, Franco Donati. | - Powered by Sphinx 1.8.2 + Powered by Sphinx 2.2.0 & Alabaster 0.7.12 | diff --git a/docs/_build/html/installation.html b/docs/_build/html/installation.html index 2adaad5..34cd9b0 100644 --- a/docs/_build/html/installation.html +++ b/docs/_build/html/installation.html @@ -1,11 +1,9 @@ - + - - + Installation — pycirk 1.5.0 documentation @@ -13,6 +11,7 @@ + @@ -105,13 +104,11 @@

    Related Topics

    @@ -132,7 +129,7 @@

    Quick search

    ©2019, Franco Donati. | - Powered by Sphinx 1.8.2 + Powered by Sphinx 2.2.0 & Alabaster 0.7.12 | diff --git a/docs/_build/html/modules.html b/docs/_build/html/modules.html index 085ec6d..decafbe 100644 --- a/docs/_build/html/modules.html +++ b/docs/_build/html/modules.html @@ -1,11 +1,9 @@ - + - - + pycirk — pycirk 1.5.0 documentation @@ -13,6 +11,7 @@ + @@ -99,13 +98,11 @@

    Related Topics

    @@ -126,7 +123,7 @@

    Quick search

    ©2019, Franco Donati. | - Powered by Sphinx 1.8.2 + Powered by Sphinx 2.2.0 & Alabaster 0.7.12 | diff --git a/docs/_build/html/objects.inv b/docs/_build/html/objects.inv index abfd61f..80b3251 100644 Binary files a/docs/_build/html/objects.inv and b/docs/_build/html/objects.inv differ diff --git a/docs/_build/html/py-modindex.html b/docs/_build/html/py-modindex.html index 8f8668a..ca4e296 100644 --- a/docs/_build/html/py-modindex.html +++ b/docs/_build/html/py-modindex.html @@ -1,11 +1,9 @@ - + - - + Python Module Index — pycirk 1.5.0 documentation @@ -13,6 +11,7 @@ + @@ -149,13 +148,11 @@

    Related Topics

    @@ -176,7 +173,7 @@

    Quick search

    ©2019, Franco Donati. | - Powered by Sphinx 1.8.2 + Powered by Sphinx 2.2.0 & Alabaster 0.7.12 diff --git a/docs/_build/html/pycirk.html b/docs/_build/html/pycirk.html index f403053..1b33f9e 100644 --- a/docs/_build/html/pycirk.html +++ b/docs/_build/html/pycirk.html @@ -1,11 +1,9 @@ - + - - + pycirk package — pycirk 1.5.0 documentation @@ -13,6 +11,7 @@ + @@ -50,7 +49,7 @@

    Submodules
    -class pycirk.fundamental_operations.Operations[source]
    +class pycirk.fundamental_operations.Operations[source]

    Bases: object

    Contains all basic operations to transform SUTs into IOTs and verify them It contains two subclasses defining two different trasformation methods @@ -58,58 +57,58 @@

    Submodules
    -class IOT[source]
    +class IOT[source]

    Bases: object

    General IOT operations subclass some methods repeat from other subclasses but it’s good to have them divided for clarity

    -A(inv_diag_x)[source]
    +A(inv_diag_x)[source]

    Technical coefficient matrix A = Z * inv(diag(x))

    -B(inv_diag_x)[source]
    +B(inv_diag_x)[source]

    Calculates extensions intensities

    -IOT(Y, W, E, R, M)[source]
    +IOT(Y, W, E, R, M)[source]
    -L()[source]
    +L()[source]

    Leontief inverse L = (I-A)^-1

    -R(diag_x)[source]
    +R(diag_x)[source]

    Calculates absolute extensions

    -RY(diag_yj)[source]
    +RY(diag_yj)[source]

    Caclculates absolute extensions in final demand

    -Z(diag_x)[source]
    +Z(diag_x)[source]

    Total product ouput Z = A * diag_x

    -bY(inv_diag_yj)[source]
    +bY(inv_diag_yj)[source]

    Calculates intensities of extensions in final demand Method for transformation matrix of bY (e.g. final demand emissions)

    @@ -117,13 +116,13 @@

    Submodules
    -x(Y)[source]
    +x(Y)[source]

    total product output s the sum of Si and y

    -x_IAy(y)[source]
    +x_IAy(y)[source]

    Total product ouput x = inv(I - A) * yi

    @@ -132,46 +131,46 @@

    Submodules
    -class PxP_ITA_MSC[source]
    +class PxP_ITA_MSC[source]

    Bases: object

    Model with Market Share Coef. Prod x Prod Industry Technology assumption

    -A(D)[source]
    +A(D)[source]

    Total requirement multipliers A = Z * D

    -B(D, inv_diag_g)[source]
    +B(D, inv_diag_g)[source]

    Calculates extensions intensities

    -D(inv_diag_q)[source]
    +D(inv_diag_q)[source]

    Market share coefficients D = V * inv(diag(q))

    -L()[source]
    +L()[source]

    Leontief inverse L = (I-A)^-1

    -R(diag_q)[source]
    +R(diag_q)[source]

    Calculates absolute extensions

    -S(inv_diag_g)[source]
    +S(inv_diag_g)[source]

    Intermediate coefficients Input requirements Z = U * inv(diag(g))

    @@ -179,7 +178,7 @@

    Submodules
    -Z(D, diag_q)[source]
    +Z(D, diag_q)[source]

    Intermediates Z = inter_coef * D * diag(q)

    @@ -188,19 +187,19 @@

    Submodules
    -class PxP_ITA_TC[source]
    +class PxP_ITA_TC[source]

    Bases: object

    Model with Transformation Coefficients ProdxProd Industry Technology assumption

    -B(T, inv_diag_q)[source]
    +B(T, inv_diag_q)[source]

    Calculates extension intensity

    -L(T, inv_diag_q)[source]
    +L(T, inv_diag_q)[source]

    Input coefficients intermediates A = U * T * inv[diag (q)]

    Multiplier matrix @@ -209,20 +208,20 @@

    Submodules
    -R(diag_q)[source]
    +R(diag_q)[source]

    Calculates absolute extensions

    -T(inv_diag_g)[source]
    +T(inv_diag_g)[source]

    Transformation matrix T = inv(diag(g)) * V

    -Z(U)[source]
    +Z(U)[source]

    Intemediates Z = U * T

    @@ -231,12 +230,12 @@

    Submodules
    -calculate_characterized()[source]
    +calculate_characterized()[source]
    -delta_Y(Yalt)[source]
    +delta_Y(Yalt)[source]

    method to calculate difference in Y Y = final demand baseline Yalt = final demand scenario

    @@ -244,7 +243,7 @@

    Submodules
    -delta_x(Lalt, y)[source]
    +delta_x(Lalt, y)[source]

    method to calculate difference in q L = Leontief of baseline Lalt = Leontief of scenario

    @@ -252,13 +251,13 @@

    Submodules
    -inv()[source]
    +inv()[source]

    Returns inverse by dividing by 1 and eliminating inf and nan values

    -verifyIOT(Y, W)[source]
    +verifyIOT(Y, W)[source]

    @@ -273,11 +272,11 @@

    Submodules
    -class pycirk.labels.Labels[source]
    +class pycirk.labels.Labels[source]

    Bases: object

    -apply_labels(matrix, labels, axis=0)[source]
    +apply_labels(matrix, labels, axis=0)[source]

    Applies labels to a dataframe axis = 0 => Index axis = 1 => columns

    @@ -285,20 +284,20 @@

    Submodules
    -calc_no_of_something(labels)[source]
    +calc_no_of_something(labels)[source]

    A general method to calculate the number of unique entries contained in a series

    -get_labels(matrix)[source]
    +get_labels(matrix)[source]

    Collects labels from a dataframe

    -get_unique_labels(dataframe_of_labels, for_units=True)[source]
    +get_unique_labels(dataframe_of_labels, for_units=True)[source]

    Calculates all unique entries (labels) contained in a dataframe and puts them together with their units and total count of unique entries

    It returns an object… which is munched, not a pretty solution but it @@ -307,43 +306,43 @@

    Submodules
    -identify_labels(M_name)[source]
    +identify_labels(M_name)[source]

    A method to understand what type of labels are being handled depending on the name of the matrix in dataframe type that is being passed

    -list_of_something(labels)[source]
    +list_of_something(labels)[source]

    A general method to return a list of unique entries contained in a series

    -load_labels(directory)[source]
    +load_labels(directory)[source]
    -organize_unique_labels(directory)[source]
    +organize_unique_labels(directory)[source]
    -relabel(M, column_labels, index_labels)[source]
    +relabel(M, column_labels, index_labels)[source]

    Processes apply_labels and apply _names together

    -relabel_to_save(data, trans_method, labels_directory)[source]
    +relabel_to_save(data, trans_method, labels_directory)[source]

    This function makes sure that everything is labeled in IOT tables

    trans_method = 0 is prod x prod , 1 is ind x ind

    -save_labels(data, directory)[source]
    +save_labels(data, directory)[source]

    saves the labels of the database in the labels directory

    @@ -359,7 +358,7 @@

    Submodules
    -pycirk.make_scenarios.basic_add(a, at)[source]
    +pycirk.make_scenarios.basic_add(a, at)[source]

    Adds values together

    a : numpy.array

    at : numpy array

    @@ -367,39 +366,39 @@

    Submodules
    -pycirk.make_scenarios.basic_mult(ide, a, kt, kp)[source]
    +pycirk.make_scenarios.basic_mult(ide, a, kt, kp)[source]

    Policy intervention

    It may be a primary intervention or an acillary action.

    -
    -
    a: numpy.array
    -
    a supply chain or a point in it subject to a change
    -
    kt: float
    -
    technical coefficient (max achievable technically)
    -
    kp: float
    -
    penetration coefficient (level of market penet. of the policy)
    -
    ide: int
    -
    identification number of the intervention in case of missing information
    +
    +
    a: numpy.array

    a supply chain or a point in it subject to a change

    +
    +
    kt: float

    technical coefficient (max achievable technically)

    +
    +
    kp: float

    penetration coefficient (level of market penet. of the policy)

    +
    +
    ide: int

    identification number of the intervention in case of missing information

    +

    A a numpy.array of the same order/shape of a

    -pycirk.make_scenarios.counterfactual(scen_file, scen_no, M, M_name, labels)[source]
    +pycirk.make_scenarios.counterfactual(scen_file, scen_no, M, M_name, labels)[source]

    Separates changes by matrix subject to intervention and apply them on a specific matrix

    -
    -
    scen_file: str
    -
    directory of the file in which the scenarios are specified
    -
    scen_no : int
    -
    specific scenario e.g “1” or “scenario_1”
    -
    M : numpy.array
    -
    matrix affected by the policies
    -
    M_name : str
    -
    matrix name as diplayed under sheet_name[“matrix”]
    -
    labels : obj
    -
    matrix labels
    +
    +
    scen_file: str

    directory of the file in which the scenarios are specified

    +
    +
    scen_noint

    specific scenario e.g “1” or “scenario_1”

    +
    +
    Mnumpy.array

    matrix affected by the policies

    +
    +
    M_namestr

    matrix name as diplayed under sheet_name[“matrix”]

    +
    +
    labelsobj

    matrix labels

    +

    A numpy array modified according to the specified changes in the scenario file

    @@ -407,22 +406,22 @@

    Submodules
    -pycirk.make_scenarios.counterfactual_engine(M, inter_sets, subs=False, copy=False)[source]
    +pycirk.make_scenarios.counterfactual_engine(M, inter_sets, subs=False, copy=False)[source]

    This function allows for the proccessing of the specified interventions onto a selected matrix. It calls various functions to modify the values in a specified matrix.

    -
    -
    M : numpy.array
    -
    matrix of reference
    -
    inter_sets: dict
    -
    contains all specfication concerning the changes to be applied -(intervention sets)
    -
    subs : bool
    -
    If True it will call the subsitution function according to -specifications in scenarios.xlsx
    -
    copy : bool
    -
    if True it will copy value from one part of the matrix to another -according to specifications in scenarios.xlsx
    +
    +
    Mnumpy.array

    matrix of reference

    +
    +
    inter_sets: dict

    contains all specfication concerning the changes to be applied +(intervention sets)

    +
    +
    subsbool

    If True it will call the subsitution function according to +specifications in scenarios.xlsx

    +
    +
    copybool

    if True it will copy value from one part of the matrix to another +according to specifications in scenarios.xlsx

    +

    i : index coordinate

    g : column coordinate

    @@ -436,35 +435,35 @@

    Submodules
    -pycirk.make_scenarios.make_counterfactuals(data, scen_no, scen_file, labels)[source]
    +pycirk.make_scenarios.make_counterfactuals(data, scen_no, scen_file, labels)[source]

    Calculate all the counterfactual IO matrices

    -
    -
    data : obj
    -
    An object containing all necessary matrices of the IO system
    -
    scen_no : int
    -
    the identification number of the scenario to reference in scen_file
    -
    scen_file : str
    -
    the directory where the scenarios.xlsx file is store
    -
    labels : obj
    -
    an object containing all labels for the IO matrices
    +
    +
    dataobj

    An object containing all necessary matrices of the IO system

    +
    +
    scen_noint

    the identification number of the scenario to reference in scen_file

    +
    +
    scen_filestr

    the directory where the scenarios.xlsx file is store

    +
    +
    labelsobj

    an object containing all labels for the IO matrices

    +

    An object contaning a mofified IO system

    -pycirk.make_scenarios.make_new(filtered_changes, M, M_name, labels)[source]
    +pycirk.make_scenarios.make_new(filtered_changes, M, M_name, labels)[source]

    Organizes the data concerning the changes and calls the functions to modified matrices based on specied scenarios

    -
    -
    filterd_changes: pandas.DataFrame
    -
    A table filtered by matrix name containing all changes to be applied
    -
    M : numpy.array
    -
    matrix on which to implement the changes
    -
    M_name : str
    -
    nomenclature referring to the matrix to be changed
    -
    labels: obj
    -
    object containing all matrix labels
    +
    +
    filterd_changes: pandas.DataFrame

    A table filtered by matrix name containing all changes to be applied

    +
    +
    Mnumpy.array

    matrix on which to implement the changes

    +
    +
    M_namestr

    nomenclature referring to the matrix to be changed

    +
    +
    labels: obj

    object containing all matrix labels

    +

    g is any column in the matrix

    i is any row row in the matrix

    @@ -473,7 +472,7 @@

    Submodules
    -pycirk.make_scenarios.substitution(d, s, fx_kp)[source]
    +pycirk.make_scenarios.substitution(d, s, fx_kp)[source]

    Moves the value from one or multiple cells (in the same row or column)

    Substitution: Material subsitution or certain types of rebound effects

    If the size of the array of the original value is different from that @@ -481,14 +480,14 @@

    Submodules -
    d : numpy.array
    -
    transaction with which we are substituting
    -
    s : numpy.array
    -
    original transaction that was subject to changes -(the transactions from which the value is coming from)
    -
    fx_kp : float
    -
    relative size of c that is added on the transaction to expand d
    +
    +
    dnumpy.array

    transaction with which we are substituting

    +
    +
    snumpy.array

    original transaction that was subject to changes +(the transactions from which the value is coming from)

    +
    +
    fx_kpfloat

    relative size of c that is added on the transaction to expand d

    +

    A numpy.array of modified d

    @@ -505,7 +504,7 @@

    Submodules
    -pycirk.make_secondary_flows.allocate_sec_mat(V, U, Y, prod_or, ind_or)[source]
    +pycirk.make_secondary_flows.allocate_sec_mat(V, U, Y, prod_or, ind_or)[source]

    This function allows to move the primary material output from the secondary material industries to the secondary material output. This allows for the presence of secondary materials in the IOT @@ -516,7 +515,7 @@

    Submodules
    -pycirk.make_secondary_flows.make_secondary(data)[source]
    +pycirk.make_secondary_flows.make_secondary(data)[source]

    This allows to allign secondary flow in such a way that they then appear in the IOT

    Primary Products’ positions

    @@ -557,7 +556,7 @@

    Submodules
    -pycirk.organize_io.organizer(data)[source]
    +pycirk.organize_io.organizer(data)[source]

    @@ -570,53 +569,53 @@

    Submodules
    -pycirk.positions.make_coord_array(cat_coord, reg_coord, no_countries, no_categories)[source]
    +pycirk.positions.make_coord_array(cat_coord, reg_coord, no_countries, no_categories)[source]

    It creates an an array of coordinates based on the specification of the users.

    -
    -
    cat_coord : int, numpy.array, bool
    -
    the numerical coordinate of a specific category belonging to a matrix +
    +
    cat_coordint, numpy.array, bool

    the numerical coordinate of a specific category belonging to a matrix in the IO or SUT system. If None is passed then it will return an -array of all coordinates in range no_categories.

    -
    reg_coord : int, numpy.array, bool
    -
    the numerical coordinate of a specific region in the IO or SUT system. +array of all coordinates in range no_categories.

    +
    +
    reg_coordint, numpy.array, bool

    the numerical coordinate of a specific region in the IO or SUT system. If None is passed then it will return an array of all coordinates in -range no_countries.

    -
    no_countries : int
    -
    the total number of countries or regions in the dataset
    -
    no_categories : int
    -
    the total number of categories referring one axis in the chosen matrix
    +range no_countries.

    +
    +
    no_countriesint

    the total number of countries or regions in the dataset

    +
    +
    no_categoriesint

    the total number of categories referring one axis in the chosen matrix

    +

    A numpy.array referring to each coordinate point specified by the user

    -pycirk.positions.make_coord_array_for_make_sec(coordinates, no_countries, no_categories)[source]
    +pycirk.positions.make_coord_array_for_make_sec(coordinates, no_countries, no_categories)[source]

    It creates an an array of coordinates based on the total location of secondary materials and processing categories

    -
    -
    coordinates : int, numpy.array
    -
    the numerical coordinate of secondary categories belonging to the SUT system
    -
    no_countries : int
    -
    the total number of countries or regions in the dataset
    -
    no_categories : int
    -
    the total number of categories referring one axis in the chosen matrix
    +
    +
    coordinatesint, numpy.array

    the numerical coordinate of secondary categories belonging to the SUT system

    +
    +
    no_countriesint

    the total number of countries or regions in the dataset

    +
    +
    no_categoriesint

    the total number of categories referring one axis in the chosen matrix

    +

    A numpy.array referring to each coordinate point

    -pycirk.positions.single_position(item, labels)[source]
    +pycirk.positions.single_position(item, labels)[source]

    Takes a dataframe of the multiindex and identifies the position of the specified values

    -
    -
    item : str
    -
    The label the user is looking for
    -
    labels : obj
    -
    An object cointaining a set of labels -(as specified in the labels.py module)
    +
    +
    itemstr

    The label the user is looking for

    +
    +
    labelsobj

    An object cointaining a set of labels +(as specified in the labels.py module)

    +

    An numpy.array containing the coordinate of a specific label or None in case of there is no specified label

    @@ -632,62 +631,59 @@

    Submodules
    -class pycirk.pycirk.Launch(method=0, make_secondary=False, save_directory=None, aggregation=1, file=None, test=False)[source]
    +class pycirk.pycirk.Launch(method=0, make_secondary=False, save_directory=None, aggregation=1, file=None, test=False)[source]

    Bases: object

    Pycirk’s main class and methods

    Initialize the pycirk programme to make EEIO scenarios and analysis. From here, you can launch all the analysis specifications listed under scenarios.xlsx

    -
    -
    method : int
    -

    SUTs to IO transformation methods

    +
    +
    methodint

    SUTs to IO transformation methods

    0 = Prod X Prod Ind-Tech Assumption Technical Coeff method

    -

    1 = Prod X Prod Ind-Tech Assumption Market Share Coeff method

    +

    1 = Prod X Prod Ind-Tech Assumption Market Share Coeff method

    -
    make_secondary : bool
    -

    modifies SUT so that secondary technologies which process scrap +

    make_secondarybool

    modifies SUT so that secondary technologies which process scrap materials into primary materials are also available in the IO tables

    False = Don’t modify

    -

    True = Modify

    +

    True = Modify

    +
    +
    save_directorystr

    directory in which you want to work and save your results

    -
    save_directory : str
    -
    directory in which you want to work and save your results

    aggregation : int, bool

    0 = None (multi-regional 49 regions)

    1 = bi-regional (EU- ROW)

    -
    -
    file : bool, str
    -
    allows you to specify where the dataset is placed. None will use the -default location within the installed package
    -
    test : bool
    -
    if set to true it will run the test settings under under pycirk//tests
    +
    +
    filebool, str

    allows you to specify where the dataset is placed. None will use the +default location within the installed package

    +
    +
    testbool

    if set to true it will run the test settings under under pycirk//tests

    +
    -
    -
    scenario_results : int
    -

    Allows to calculate the results for a given specified scenario

    -

    0 = baseline data

    -
    -
    all_results :
    -
    Retrieves all results for all specified scenarios and baseline
    -
    save_results : int and bool
    -
    save all specified analytical results from all scenario and baseline
    +
    +
    scenario_resultsint

    Allows to calculate the results for a given specified scenario

    +

    0 = baseline data

    +
    +
    all_results :

    Retrieves all results for all specified scenarios and baseline

    +
    +
    save_resultsint and bool

    save all specified analytical results from all scenario and baseline

    +
    -
    -
    analysis.xlsx : excel file
    -
    to be found under the default folder on the specified directory -it allows to specify the parameters for your scenario and analysis
    -
    IO tables : pkl
    -
    IO tables of the specified scenarios, these are located in the output -folder in the save directory
    -
    results : DataFrame
    -
    results gathered from the processed scenarios and baseline
    +
    +
    analysis.xlsxexcel file

    to be found under the default folder on the specified directory +it allows to specify the parameters for your scenario and analysis

    +
    +
    IO tablespkl

    IO tables of the specified scenarios, these are located in the output +folder in the save directory

    +
    +
    resultsDataFrame

    results gathered from the processed scenarios and baseline

    +
    -all_results()[source]
    +all_results()[source]

    Process all scenarios and collects their results together with Baseline analysis results

    It outputs a pandas.DataFrame with all results

    @@ -695,52 +691,51 @@

    Submodules
    -delete_previous_IO_builds()[source]
    +delete_previous_IO_builds()[source]

    Call this method if you want to elinate all previous IO databases created by pycirk. SUTs database is not affected.

    -save_results(scen_no=None, output_dataset=False)[source]
    +save_results(scen_no=None, output_dataset=False)[source]

    Saves all results in excel format for info and results or in pickle format for the dataset

    -
    -
    scen_no: int
    -

    0 = baseline

    -

    1-n = specified scenarios

    -
    -
    output_datase: bool
    -
    If true it will output a dictionary containing all IOT tables in -pd.DataFrames
    +
    +
    scen_no: int

    0 = baseline

    +

    1-n = specified scenarios

    +
    +
    output_datase: bool

    If true it will output a dictionary containing all IOT tables in +pd.DataFrames

    +

    Default values will save all results from the all_results method and they will output only scenario.xlsx and info_and_results.xlsx

    Output_dataset is only possible when scen_no is specified in which case it would save also a data.pkl file

    -
    -
    scenarios.xlsx : excel file
    -
    scenario settings excel file used for the analysis in the same -output directory with the results
    -
    info_and_results.xlsx : excel file
    -
    excel file containing general info about project plus the -results from the analysis
    -
    data.pkl : pickle file
    -
    new modified IO dataset in pickle format -This is only possible if outputting single scenario (scen_no != None)
    +
    +
    scenarios.xlsxexcel file

    scenario settings excel file used for the analysis in the same +output directory with the results

    +
    +
    info_and_results.xlsxexcel file

    excel file containing general info about project plus the +results from the analysis

    +
    +
    data.pklpickle file

    new modified IO dataset in pickle format +This is only possible if outputting single scenario (scen_no != None)

    +
    -scenario_results(scen_no, output_dataset=False)[source]
    +scenario_results(scen_no, output_dataset=False)[source]

    Run to output results of a specified scenario

    -
    -
    scen_no: int
    -
    0 = baseline -1-n = specified scenarios
    -
    output_datase: bool
    -
    If true it will output a dictionary containing all IOT tables in pd.DataFrames
    +
    +
    scen_no: int

    0 = baseline +1-n = specified scenarios

    +
    +
    output_datase: bool

    If true it will output a dictionary containing all IOT tables in pd.DataFrames

    +

    specified results in DataFrame form or a dictionary containing results and a dictionary of dataframes containing IO matrices

    @@ -758,47 +753,37 @@

    Submodules
    -class pycirk.pycirk_settings.Settings(method=0, make_secondary=False, save_directory='', aggregation=1, file=None, test=False)[source]
    +class pycirk.pycirk_settings.Settings(method=0, make_secondary=False, save_directory='', aggregation=1, file=None, test=False)[source]

    Bases: object

    This class allows for to specify the settings for pycirk.

    -
    -
    method : int
    -

    SUTs to IO transformation methods

    +
    +
    methodint

    SUTs to IO transformation methods

    0 = Prod X Prod Ind-Tech Assumption Technical Coeff method

    -

    1 = Prod X Prod Ind-Tech Assumption Market Share Coeff method

    +

    1 = Prod X Prod Ind-Tech Assumption Market Share Coeff method

    -
    make_secondary : bool
    -

    modifies SUT so that secondary technologies which process scrap +

    make_secondarybool

    modifies SUT so that secondary technologies which process scrap materials into primary materials are also available in the IO tables

    False = Don’t modify

    -

    True = Modify

    +

    True = Modify

    +
    +
    save_directorystr

    directory in which you want to work and save your results

    -
    save_directory : str
    -
    directory in which you want to work and save your results

    aggregation : int, bool

    0 = None (multi-regional 49 regions)

    1 = bi-regional (EU- ROW)

    -
    -
    file : bool, str
    -
    allows you to specify where the dataset is placed. None will use the -default location within the installed package
    -
    test : bool
    -
    if set to true it will run the test settings under under pycirk//tests
    +
    +
    filebool, str

    allows you to specify where the dataset is placed. None will use the +default location within the installed package

    +
    +
    testbool

    if set to true it will run the test settings under under pycirk//tests

    +
    -
    -
    -assign_labels_to_class()[source]
    -

    Assigns all labels to their respective attributes in the Labels class -These are used througout the program to find coordinates and -label results

    -
    -
    -check_dataset_location()[source]
    +check_dataset_location()[source]

    It identifies where the baseline dataset is located and whether it is present in the directory. If an IO database was already created in the past then it will just return it’s location and type instead of @@ -808,74 +793,74 @@

    Submodules
    -check_expand_directory(directory)[source]
    +check_expand_directory(directory)[source]

    Checking that we are using the right directory for the right OS

    -create_output_folder()[source]
    +create_output_folder()[source]

    It creates an output folder where to save analytical results This is placed in the user’s working directory

    -create_scenario_file()[source]
    +create_scenario_file()[source]

    It creates a new scenario file by copying the original from pycirk directory to the new working directory specified by the user

    -load_dataset(data)[source]
    +load_dataset(data)[source]

    It loads the baseline dataset

    -load_results_params()[source]
    +load_results_params()[source]
    -number_scenarios()[source]
    +number_scenarios()[source]
    -project_specs(test=False)[source]
    +project_specs(test=False)[source]

    General specifications for the project, they are also used to mark the output files

    -scenario_file()[source]
    +scenario_file()[source]

    It returns where the working scenarios.xlsx file is located

    -set_IO_scenario(data, scen_no)[source]
    +set_IO_scenario(data, scen_no)[source]

    Class the functions to modify the IO database according to your scenario specifications

    -set_SUTs()[source]
    +set_SUTs()[source]
    -set_save_directory()[source]
    +set_save_directory()[source]

    It specifies where the scenario file for input is located

    -transform_to_io()[source]
    +transform_to_io()[source]

    Transforms the SUT dataset into an IO system

    If the user specified to make secondary material processing apparent then it will launch the function to modify the database

    @@ -899,20 +884,25 @@

    Submodules
    -pycirk.results.iter_thru_for_results(data, analysis_specs, scen_no, labels)[source]
    +pycirk.results.iter_thru_for_results(data, analysis_specs, scen_no, labels)[source]

    It uses your analytical specification on scenarios.xlxl to return a dataframe of the desired results

    -pycirk.results.retrieve_specified_data(data, spec_row, labels)[source]
    +pycirk.results.retrieve_specified_data(data, spec_row, labels)[source]

    Separate, collect and rename results for base and scenarios according to specifications under th sheet “analysis” in scenarios.xls

    data = any IOT table spec_row = row in the scenarios sheet specifying settings

    +
    +
    +pycirk.results.rsd_engine(data, M_name, spec_row, labels)[source]
    +
    +

    pycirk.save_utils module

    @@ -923,34 +913,34 @@

    Submodules
    -pycirk.save_utils.add_date_to_gen_specs(specs)[source]
    +pycirk.save_utils.add_date_to_gen_specs(specs)[source]

    Adds timemark to general specifications e.g. authors, institution etc

    -pycirk.save_utils.save_outputs(results, directory, specs, scen_no, data=None)[source]
    +pycirk.save_utils.save_outputs(results, directory, specs, scen_no, data=None)[source]

    It saves results into a previously specified directory

    -
    -
    results : pandas.DataFrame
    -
    a dataframe containing only selected results
    -
    directory : str
    -
    the general location specified for your scenarios.xlsx file
    -
    specs : dict
    -
    a dictionary containing general info about the project (e.g. author, institution, etc)
    -
    scen_no : int or None
    -
    an integer specifying the scenario number or enter None to save all results
    -
    data : dict of pd.DataFrames
    -
    a completely new dataset to be pickled. Default value is None otherwise -pass the dataset
    +
    +
    resultspandas.DataFrame

    a dataframe containing only selected results

    +
    +
    directorystr

    the general location specified for your scenarios.xlsx file

    +
    +
    specsdict

    a dictionary containing general info about the project (e.g. author, institution, etc)

    +
    +
    scen_noint or None

    an integer specifying the scenario number or enter None to save all results

    +
    +
    datadict of pd.DataFrames

    a completely new dataset to be pickled. Default value is None otherwise +pass the dataset

    +
    -
    -
    scenarios.xlsx : excel file
    -
    scenario settings excel file used for the analysis in the same output directory with the results
    -
    info_and_results.xlsx : excel file
    -
    excel file containing general info about project plus the results from the analysis
    -
    data.pkl : pickle file
    -
    new modified IO dataset in pickle format
    +
    +
    scenarios.xlsxexcel file

    scenario settings excel file used for the analysis in the same output directory with the results

    +
    +
    info_and_results.xlsxexcel file

    excel file containing general info about project plus the results from the analysis

    +
    +
    data.pklpickle file

    new modified IO dataset in pickle format

    +
    @@ -964,19 +954,19 @@

    Submodules
    -class pycirk.transformation_methods.Transform(SUTs)[source]
    +class pycirk.transformation_methods.Transform(SUTs)[source]

    Bases: object

    Transforms SUTs to IOT an calcualate extensions

    -IOTpxpSTA_MSCm()[source]
    +IOTpxpSTA_MSCm()[source]

    IOT prod x prod Single tech Industry-technology assumption Market share coef method

    -IOTpxpSTA_TCm()[source]
    +IOTpxpSTA_TCm()[source]

    IOT prod x prod Single tech Industry-technology assumption Technical coef method

    @@ -1033,13 +1023,11 @@

    Related Topics

    @@ -1060,7 +1048,7 @@

    Quick search

    ©2019, Franco Donati. | - Powered by Sphinx 1.8.2 + Powered by Sphinx 2.2.0 & Alabaster 0.7.12 | diff --git a/docs/_build/html/readme.html b/docs/_build/html/readme.html index 81bdb33..b55d322 100644 --- a/docs/_build/html/readme.html +++ b/docs/_build/html/readme.html @@ -1,11 +1,9 @@ - + - - + pycirk — pycirk 1.5.0 documentation @@ -13,6 +11,7 @@ + @@ -40,25 +39,31 @@

    pycirkhttps://img.shields.io/badge/License-GPL%20v3-blue.svg https://img.shields.io/badge/contributions-welcome-brightgreen.svg

    10.5281/zenodo.1492957

    +

    To cite the use of the software in your research please use the following publication:

    +

    “Modeling the circular economy in environmentally extended input-output tables: Methods, software and case study”

    +

    https://doi.org/10.1016/j.resconrec.2019.104508

    1. Installation

    1.1. Stable release

    Run in your terminal:0

    -
    $ pip install pycirk
    +

    $ pip install pycirk

    +

    1.2. From source

    Clone repository:

    -
    +

    Once you have a copy of the source, you can install it with:

    -
    $ python setup.py install
    +

    $ python setup.py install

    +

    1.3 Data

    @@ -73,36 +78,41 @@

    2. Usage

    2.1. Import package

    -
    import pycirk
    +

    import pycirk

    +

    2.2. Initialize

    -
    my_work = pycirk.Launch(method, directory, aggregation)
    +

    my_work = pycirk.Launch(method, directory, aggregation)

    +

    2.3. set your scenarios and analysis

      -
    1. Open scenarios.xls in the directory that was specified
    2. -
    3. From there you can specify interventions and parameters for the analysis
    4. -
    5. save and continue to the following steps
    6. +
    7. Open scenarios.xls in the directory that was specified

    8. +
    9. From there you can specify interventions and parameters for the analysis

    10. +
    11. save and continue to the following steps

    2.4. Run scenarios

    Run one specific scenario

    -
    my_work.scenario_results(scen_no, output_dataset) -(0 = baseline)
    +

    my_work.scenario_results(scen_no, output_dataset) +(0 = baseline)

    +

    Run all scenarios

    -
    my_work.all_results()
    +

    my_work.all_results()

    +

    3. Features

    Examples of policies that can be modelled through the software:

      -
    • sharing
    • -
    • recycling
    • -
    • life extension
    • -
    • rebound effects
    • -
    • substituion
    • -
    • market and value added changes
    • -
    • efficiency
    • +
    • sharing

    • +
    • recycling

    • +
    • life extension

    • +
    • rebound effects

    • +
    • substituion

    • +
    • market and value added changes

    • +
    • efficiency

    The tables in which it is possible to apply changes:

      -
    • total requirement matrix (A)
    • -
    • intermediate transactions (Z)
    • -
    • final demand (Y)
    • -
    • primary inputs (W)
    • -
    • emission intermediate extentions (E)
    • -
    • material intermediate extensions (M)
    • -
    • resource intermediate extensions (R)
    • -
    • emission final demand extension (EY)
    • -
    • material final demand extension (MY)
    • -
    • resource final demand extensions (RY)
    • -
    • primary inputs coefficients (w)
    • -
    • emission intermediate extentions coefficients (e)
    • -
    • material intermediate extensions coefficients (m)
    • -
    • resource intermediate extensions coefficients (r)
    • -
    • emission final demand extension coefficients (eY)
    • -
    • material final demand extension coefficients (mY)
    • -
    • resource final demand extensions coefficients (rY)
    • +
    • total requirement matrix (A)

    • +
    • intermediate transactions (Z)

    • +
    • final demand (Y)

    • +
    • primary inputs (W)

    • +
    • emission intermediate extentions (E)

    • +
    • material intermediate extensions (M)

    • +
    • resource intermediate extensions (R)

    • +
    • emission final demand extension (EY)

    • +
    • material final demand extension (MY)

    • +
    • resource final demand extensions (RY)

    • +
    • primary inputs coefficients (w)

    • +
    • emission intermediate extentions coefficients (e)

    • +
    • material intermediate extensions coefficients (m)

    • +
    • resource intermediate extensions coefficients (r)

    • +
    • emission final demand extension coefficients (eY)

    • +
    • material final demand extension coefficients (mY)

    • +
    • resource final demand extensions coefficients (rY)

    It is possible to specify:

      -
    • region of the intervention
    • -
    • whether the intervention affects domestic, import transactions or both
    • +
    • region of the intervention

    • +
    • whether the intervention affects domestic, import transactions or both

    @@ -194,36 +205,36 @@

    4. Important modules

    From this .xls file it is possible to set different types of interventions and the analysis to perform:

      -
    • matrix = specifies in which matrix of IOT the changes are applied
    • -
    • change_type = Primary and ancillary are only used to specify the type of intervention from a conceptual level
    • -
    • reg_o or reg_d = Regional coordinates (o=origin or row, d=destination or column)
    • -
    • cat_o or cat_d = category (e.g. products or extensions ) coordinates (o=origin or row, d=destination or column)
    • -
    • kt = technical coefficient (max achievable technically); a negative value means reduction; unit = %
    • -
    • ka = absolute values for addition
    • -
    • kp = penetration coefficient (level of market penetration of the policy); unit = %
    • -
    • copy = allows you to copy a specific transation to a different point in the matrices (useful for proxy creation)
    • -
    • substitution = tells the software whether it needs to substitute values among specified categories
    • -
    • sk = which intervention should be substituted
    • -
    • swk = Substitution weighing factor (how much of the original transaction should be substituted); allows to simulate difference in prices and physical properties between categories; unit = %
    • +
    • matrix = specifies in which matrix of IOT the changes are applied

    • +
    • change_type = Primary and ancillary are only used to specify the type of intervention from a conceptual level

    • +
    • reg_o or reg_d = Regional coordinates (o=origin or row, d=destination or column)

    • +
    • cat_o or cat_d = category (e.g. products or extensions ) coordinates (o=origin or row, d=destination or column)

    • +
    • kt = technical coefficient (max achievable technically); a negative value means reduction; unit = %

    • +
    • ka = absolute values for addition

    • +
    • kp = penetration coefficient (level of market penetration of the policy); unit = %

    • +
    • copy = allows you to copy a specific transation to a different point in the matrices (useful for proxy creation)

    • +
    • substitution = tells the software whether it needs to substitute values among specified categories

    • +
    • sk = which intervention should be substituted

    • +
    • swk = Substitution weighing factor (how much of the original transaction should be substituted); allows to simulate difference in prices and physical properties between categories; unit = %

    These can be set for:

      -
    • product category e.g. C_STEL (basic iron), C_PULP (pulp), etc.
    • -
    • final demand category e.g. F_HOUS (households), F_GOVE (government), etc.
    • -
    • primary input category e.g. E_HRHS (employment highly skilled), T_TLSA (taxes less subsidies), etc.
    • -
    • emissions extensions e.g. E_CO2_c (CO2 - combustion)
    • -
    • material extensions e.g. NI.02 (Nature Inputs: Coking Coal)
    • -
    • resource extension e.g. L_1.1 (Land use - Arable Land - Rice)
    • +
    • product category e.g. C_STEL (basic iron), C_PULP (pulp), etc.

    • +
    • final demand category e.g. F_HOUS (households), F_GOVE (government), etc.

    • +
    • primary input category e.g. E_HRHS (employment highly skilled), T_TLSA (taxes less subsidies), etc.

    • +
    • emissions extensions e.g. E_CO2_c (CO2 - combustion)

    • +
    • material extensions e.g. NI.02 (Nature Inputs: Coking Coal)

    • +
    • resource extension e.g. L_1.1 (Land use - Arable Land - Rice)

    Furthemore, from the analysis sheet you can set the following variables to be compared in the analysis:

      -
    • product categories
    • -
    • primary input categories
    • -
    • emissions extensions
    • -
    • material extensions
    • -
    • resource extensions
    • -
    • region of interest
    • -
    • impact categories # Please see the data_validation_list sheet in the scenarios.xls file for the comprehensive list
    • +
    • product categories

    • +
    • primary input categories

    • +
    • emissions extensions

    • +
    • material extensions

    • +
    • resource extensions

    • +
    • region of interest

    • +
    • impact categories # Please see the data_validation_list sheet in the scenarios.xls file for the comprehensive list

    @@ -281,13 +292,11 @@

    Related Topics

    @@ -308,7 +317,7 @@

    Quick search

    ©2019, Franco Donati. | - Powered by Sphinx 1.8.2 + Powered by Sphinx 2.2.0 & Alabaster 0.7.12 | diff --git a/docs/_build/html/search.html b/docs/_build/html/search.html index f3aeacb..99a5cee 100644 --- a/docs/_build/html/search.html +++ b/docs/_build/html/search.html @@ -1,11 +1,9 @@ - + - - + Search — pycirk 1.5.0 documentation @@ -14,14 +12,11 @@ + - - - + @@ -55,7 +50,7 @@

    Search

    containing fewer words won't appear in the result list.

    - +
    @@ -114,7 +109,7 @@

    Related Topics

    ©2019, Franco Donati. | - Powered by Sphinx 1.8.2 + Powered by Sphinx 2.2.0 & Alabaster 0.7.12 diff --git a/docs/_build/html/searchindex.js b/docs/_build/html/searchindex.js index ebf188b..a048e1c 100644 --- a/docs/_build/html/searchindex.js +++ b/docs/_build/html/searchindex.js @@ -1 +1 @@ -Search.setIndex({docnames:["authors","contributing","history","index","installation","modules","pycirk","readme","usage"],envversion:{"sphinx.domains.c":1,"sphinx.domains.changeset":1,"sphinx.domains.cpp":1,"sphinx.domains.javascript":1,"sphinx.domains.math":2,"sphinx.domains.python":1,"sphinx.domains.rst":1,"sphinx.domains.std":1,"sphinx.ext.viewcode":1,sphinx:55},filenames:["authors.rst","contributing.rst","history.rst","index.rst","installation.rst","modules.rst","pycirk.rst","readme.rst","usage.rst"],objects:{"":{pycirk:[6,0,0,"-"]},"pycirk.fundamental_operations":{Operations:[6,1,1,""]},"pycirk.fundamental_operations.Operations":{IOT:[6,1,1,""],PxP_ITA_MSC:[6,1,1,""],PxP_ITA_TC:[6,1,1,""],calculate_characterized:[6,2,1,""],delta_Y:[6,2,1,""],delta_x:[6,2,1,""],inv:[6,2,1,""],verifyIOT:[6,2,1,""]},"pycirk.fundamental_operations.Operations.IOT":{A:[6,2,1,""],B:[6,2,1,""],IOT:[6,2,1,""],L:[6,2,1,""],R:[6,2,1,""],RY:[6,2,1,""],Z:[6,2,1,""],bY:[6,2,1,""],x:[6,2,1,""],x_IAy:[6,2,1,""]},"pycirk.fundamental_operations.Operations.PxP_ITA_MSC":{A:[6,2,1,""],B:[6,2,1,""],D:[6,2,1,""],L:[6,2,1,""],R:[6,2,1,""],S:[6,2,1,""],Z:[6,2,1,""]},"pycirk.fundamental_operations.Operations.PxP_ITA_TC":{B:[6,2,1,""],L:[6,2,1,""],R:[6,2,1,""],T:[6,2,1,""],Z:[6,2,1,""]},"pycirk.labels":{Labels:[6,1,1,""]},"pycirk.labels.Labels":{apply_labels:[6,2,1,""],calc_no_of_something:[6,2,1,""],get_labels:[6,2,1,""],get_unique_labels:[6,2,1,""],identify_labels:[6,2,1,""],list_of_something:[6,2,1,""],load_labels:[6,2,1,""],organize_unique_labels:[6,2,1,""],relabel:[6,2,1,""],relabel_to_save:[6,2,1,""],save_labels:[6,2,1,""]},"pycirk.make_scenarios":{basic_add:[6,3,1,""],basic_mult:[6,3,1,""],counterfactual:[6,3,1,""],counterfactual_engine:[6,3,1,""],make_counterfactuals:[6,3,1,""],make_new:[6,3,1,""],substitution:[6,3,1,""]},"pycirk.make_secondary_flows":{allocate_sec_mat:[6,3,1,""],make_secondary:[6,3,1,""]},"pycirk.organize_io":{organizer:[6,3,1,""]},"pycirk.positions":{make_coord_array:[6,3,1,""],make_coord_array_for_make_sec:[6,3,1,""],single_position:[6,3,1,""]},"pycirk.pycirk":{Launch:[6,1,1,""]},"pycirk.pycirk.Launch":{all_results:[6,2,1,""],delete_previous_IO_builds:[6,2,1,""],save_results:[6,2,1,""],scenario_results:[6,2,1,""]},"pycirk.pycirk_settings":{Settings:[6,1,1,""]},"pycirk.pycirk_settings.Settings":{assign_labels_to_class:[6,2,1,""],check_dataset_location:[6,2,1,""],check_expand_directory:[6,2,1,""],create_output_folder:[6,2,1,""],create_scenario_file:[6,2,1,""],load_dataset:[6,2,1,""],load_results_params:[6,2,1,""],number_scenarios:[6,2,1,""],project_specs:[6,2,1,""],scenario_file:[6,2,1,""],set_IO_scenario:[6,2,1,""],set_SUTs:[6,2,1,""],set_save_directory:[6,2,1,""],transform_to_io:[6,2,1,""]},"pycirk.results":{iter_thru_for_results:[6,3,1,""],retrieve_specified_data:[6,3,1,""]},"pycirk.save_utils":{add_date_to_gen_specs:[6,3,1,""],save_outputs:[6,3,1,""]},"pycirk.transformation_methods":{Transform:[6,1,1,""]},"pycirk.transformation_methods.Transform":{IOTpxpSTA_MSCm:[6,2,1,""],IOTpxpSTA_TCm:[6,2,1,""]},pycirk:{cli:[6,0,0,"-"],fundamental_operations:[6,0,0,"-"],labels:[6,0,0,"-"],make_scenarios:[6,0,0,"-"],make_secondary_flows:[6,0,0,"-"],organize_io:[6,0,0,"-"],positions:[6,0,0,"-"],pycirk:[6,0,0,"-"],pycirk_settings:[6,0,0,"-"],results:[6,0,0,"-"],save_utils:[6,0,0,"-"],transformation_methods:[6,0,0,"-"]}},objnames:{"0":["py","module","Python module"],"1":["py","class","Python class"],"2":["py","method","Python method"],"3":["py","function","Python function"]},objtypes:{"0":"py:module","1":"py:class","2":"py:method","3":"py:function"},terms:{"case":6,"class":6,"default":[6,7],"final":[6,7],"float":6,"function":[1,6],"import":[3,8],"int":6,"new":[1,6],"public":4,"return":6,"true":[6,7],The:[1,4,6,7],Then:1,These:[6,7],Use:7,Uses:6,_name:6,a_alum:6,a_cmnt:6,a_con:6,a_copp:6,a_gla:6,a_lztp:6,a_onfm:6,a_pla:6,a_prem:6,a_pulp:6,a_stel:6,a_wood:6,about:[1,6],absolut:[6,7],accept:7,accord:6,achiev:[6,7],acillari:6,action:6,add:[1,6],add_date_to_gen_spec:6,added:[6,7],addit:7,affect:[6,7],aggreg:[6,7],all:[1,6,7],all_result:[6,7],allign:6,allocate_sec_mat:6,allow:[6,7],alreadi:6,also:6,alwai:[1,4],among:7,analysi:6,analysis_spec:6,analyt:6,ancillari:7,anew:6,ani:[1,6],anoth:6,anyth:1,appar:6,appear:6,appli:[6,7],applic:6,apply_label:6,appreci:1,arabl:7,arjan:[6,7],arnold:7,arrai:6,articl:1,assign:6,assign_labels_to_class:6,assum:1,assumpt:6,attribut:6,audreyr:7,auguilar:7,author:6,avail:6,axi:6,balanc:6,base:6,baselin:[6,7],basic:[6,7],basic_add:6,basic_mult:6,befor:1,begin:6,being:6,belong:6,best:1,between:7,biregion:7,bit:1,bitbucket:7,black:7,blog:1,bool:6,both:7,branch:1,bugfix:1,bumpvers:1,c_alum:6,c_cmnt:6,c_con:6,c_copp:6,c_gla:6,c_lztp:6,c_onfm:6,c_pla:6,c_prem:6,c_pulp:[6,7],c_stel:[6,7],c_wood:6,caclcul:6,calc_no_of_someth:6,calcual:6,calcul:6,calculate_character:6,call:6,can:[1,4,6,7],cat_coord:6,cat_d:7,cat_o:7,categori:[6,7],cell:6,certain:6,chain:6,chang:[1,6,7],change_typ:7,check:[1,6],check_dataset_loc:6,check_expand_directori:6,checkout:1,chosen:6,circular:[6,7],clariti:6,cli:5,clone:[1,4,7],cml:[0,6,7],cmlplatform:7,co2:7,coal:7,coef:6,coeff:6,coeffici:[6,7],coeffient:6,cointain:6,coke:7,collect:6,colum:6,column:[6,7],column_label:6,com:[1,4,7],combust:7,come:6,command:[4,7],commit:1,compar:7,complet:6,comprehens:7,conceptu:7,concern:6,consid:6,consol:7,contain:6,contan:6,content:[3,5],continu:7,contribut:3,contributor:[3,6],cookiecutt:7,coordin:[6,7],copi:[1,4,6,7],could:1,count:6,counterfactu:6,counterfactual_engin:6,countri:6,creat:[1,6,7],create_output_fold:6,create_scenario_fil:6,creation:7,credit:[1,3],curl:4,data:6,data_validation_list:7,databas:[6,7],datafram:6,dataframe_of_label:6,dataset:6,defin:6,delete_previous_io_build:6,delft:6,delta_i:6,delta_x:6,demand:[6,7],depend:6,deploi:3,descript:[1,6],desir:6,destin:[6,7],detail:1,develop:[1,3],dia:7,diag:6,diag_q:6,diag_x:6,diag_yj:6,dict:6,dictionari:6,differ:[6,7],diplai:6,directori:[6,7],distribut:6,divid:6,doc:1,docstr:1,document:7,domest:7,don:[4,6],donati:[0,6],done:[1,6],download:[4,7],driven:1,e_co2_c:7,e_hrh:7,each:6,easier:1,economi:[6,7],eeio:6,eeioa:6,effect:[6,7],effici:7,either:4,element:6,elimin:6,elin:6,emiss:[6,7],employ:7,enhanc:1,ensur:6,enter:6,entri:[1,6],environment:7,equal:6,essenti:6,etc:[6,7],even:1,everi:1,everyth:6,exampl:7,excel:6,exiobas:7,exist:6,exit:7,expan:6,expand:6,expans:6,explain:1,extend:7,extens:[6,7],extent:7,f_gove:7,f_hou:7,factor:7,fals:[6,7],fdonati:[1,4,7],fdonaticml:7,featur:3,feb:6,file:[1,6,7],filter:6,filterd_chang:6,filtered_chang:6,find:6,first:[0,2],flake8:1,flow:6,folder:6,follow:7,for_unit:6,fork:1,form:6,format:6,found:6,franco:[0,6],fri:6,from:[3,6],fundament:6,fundamental_oper:5,furthemor:7,futur:6,fx_kp:6,gather:6,gener:6,get:3,get_label:6,get_unique_label:6,git:[1,4,7],github:[1,4,7],given:[1,6],glenn:7,good:6,govern:7,greatli:1,guid:4,guidelin:3,handl:6,have:[1,4,6,7],help:[1,7],here:[1,6],hernandez:7,highli:7,histori:[1,3],home:7,household:7,how:[1,7],http:[1,4,7],ide:6,identif:6,identifi:6,identify_label:6,impact:7,implement:6,includ:1,ind:6,ind_or:6,index:[3,6],index_label:6,industri:6,inf:6,info:6,info_and_result:6,inform:6,initi:6,input:[6,7],insid:7,instal:[1,3,6],instead:6,institut:6,integ:6,intemedi:6,intens:6,inter_coef:6,inter_set:6,interest:7,intermedi:[6,7],intervent:[6,7],inv:6,inv_diag_g:6,inv_diag_q:6,inv_diag_x:6,inv_diag_yj:6,invers:6,iot:[6,7],iotpxpsta_mscm:6,iotpxpsta_tcm:6,iron:7,issu:1,ita:6,ita_msc:7,ita_tc:7,item:6,iter_thru_for_result:6,jan:6,joao:7,jul:6,just:[1,6],keep:1,knowledg:7,kone:[6,7],l_1:7,label:5,labels_directori:6,lalt:6,land:7,launch:[6,7],lead:3,left:7,leiden:6,leidenuniv:0,leontief:6,less:7,level:[6,7],lib:7,life:7,line:7,link:7,list:[1,6,7],list_of_someth:6,littl:1,load:6,load_dataset:6,load_label:6,load_results_param:6,loc:6,local:[1,7],locat:6,look:[1,6],m_name:6,mai:6,main:6,maintain:1,major:1,make:[1,6],make_coord_arrai:6,make_coord_array_for_make_sec:6,make_counterfactu:6,make_new:6,make_scenario:5,make_secondari:6,make_secondary_flow:5,mani:1,mar:6,mark:6,market:[6,7],master:4,materi:[6,7],matric:[6,7],matrix:[6,7],max:[6,7],mean:7,meet:1,messag:7,method:[4,6,7],might:1,minor:1,miss:6,mkvirtualenv:1,model:[6,7],modifi:6,modul:[3,5],mofifi:6,mon:6,more:1,most:4,move:6,msc:7,much:7,multi:6,multiindex:6,multipl:6,multipli:6,multiregion:7,munch:6,my_work:7,name:[1,6],nan:6,narrow:1,natur:7,necessari:6,need:7,neg:7,no_categori:6,no_countri:6,nomenclatur:6,none:[0,6,7],note:6,nov:6,now:[1,6],number:6,number_scenario:6,numer:6,numpi:6,obj:6,object:6,obtain:6,oepbzjqgdicsan1:7,offici:1,onc:[4,6,7],one:[6,7],onli:[6,7],onto:6,open:[1,7],oper:[1,6],option:7,order:6,org:[1,7],organ:6,organize_io:5,organize_unique_label:6,origin:[1,6,7],other:[1,6],otherwis:6,ouput:6,output:[6,7],output_datas:6,output_dataset:[6,7],packag:[3,5],page:3,panda:6,paramet:[6,7],part:[1,6],pass:[1,6],past:6,patch:1,penet:6,penetr:[6,7],perform:[6,7],physic:7,pickl:6,pip:[1,4,7],pkl:6,place:[6,7],pleas:[1,6,7],plu:6,point:[6,7],polici:[6,7],pos:6,posit:5,possibl:[1,6,7],post:1,pre:6,prefer:4,presenc:6,present:6,pretti:6,previou:6,previous:6,price:7,primari:[6,7],proccess:6,process:[4,6],prod:6,prod_or:6,product:[6,7],prodxprod:6,program:6,programm:6,project:[1,6,7,8],project_spec:6,properti:7,propos:1,proxi:7,pull:3,pull_request:1,pulp:7,push:1,put:[1,6],pxp:[6,7],pxp_ita_msc:6,pxp_ita_tc:6,pycirk:[1,4,8],pycirk_set:5,pypackag:7,pypi:[1,2],python3:7,python:[1,4,7],rang:6,read:6,readi:1,readm:1,rebound:[6,7],recent:4,recycl:7,reduct:7,refactor:6,refer:6,reg_coord:6,reg_d:7,reg_o:7,region:[6,7],rel:6,relabel:6,relabel_to_sav:6,releas:[2,3],rememb:1,remind:1,renam:6,repeat:6,repo:[1,4],repositori:[4,7],reproduc:1,request:3,requir:[6,7],resourc:7,respect:6,result:[5,7],retriev:6,retrieve_specified_data:6,rice:7,right:6,rodriguez:7,row:[6,7],rst:1,run:[1,4,6],same:6,sat:6,save:6,save_directori:6,save_label:6,save_output:6,save_result:[6,7],save_util:5,scen_fil:6,scen_no:[6,7],scenario:6,scenario_1:6,scenario_fil:6,scenario_result:[6,7],scope:[1,6],scrap:6,script:7,search:3,secondari:6,sector:6,see:7,select:6,send:1,separ:6,seri:6,set:[1,6],set_io_scenario:6,set_save_directori:6,set_sut:6,setup:[1,4,7],shape:6,share:[6,7],sheet:[6,7],sheet_nam:6,should:[1,6,7],show:7,simpl:6,simul:7,singl:6,single_posit:6,site:7,size:6,skill:7,softwar:7,solut:6,some:6,sourc:[3,6],spead:6,spec:6,spec_row:6,specfic:6,speci:6,specif:[6,7],specifi:[6,7],stabl:3,stackstorag:7,start:[3,7],step:[1,7],store:6,str:6,sub:6,subclass:6,subject:6,submodul:5,subset:1,subsidi:7,subsitut:6,substituion:7,substitut:[6,7],sum:6,supervis:7,suppli:6,support:[1,7],sure:[1,6],sut:[6,7],sutop:6,swk:7,system:[1,6],t_tlsa:7,tabl:[6,7],tag:1,take:6,tarbal:4,tax:7,tech:6,technic:[6,7],technolog:[6,7],tell:7,templat:7,termin:[4,7],test:[1,6,7],test_pycirk:1,text:7,thank:7,thei:[1,6],them:[1,6],thi:[1,4,6,7],through:[1,4,7],througout:6,time:6,timemark:6,tip:3,togeth:6,top:6,tot:6,total:[6,7],tox:1,tpm:6,trans_method:6,transact:[6,7],transat:7,transf_method:7,transform:6,transform_to_io:6,transformation_method:5,trasform:6,travi:1,troubleshoot:1,tue:6,tukker:7,two:6,type:[3,6,7],under:6,understand:6,uniqu:6,unit:[6,7],univers:6,updat:1,usag:3,use:[1,6,7,8],used:[6,7],useful:7,user:6,usernam:7,uses:6,using:6,valu:[6,7],variabl:7,variou:6,verifi:6,verifyiot:6,version:1,virtualenv:1,virtualenvwrapp:1,volunt:1,wai:[1,6],want:[1,6],web:1,websit:1,wed:6,weigh:7,welcom:1,what:6,when:[1,6],where:6,whether:[1,6,7],which:[6,7],whoever:1,why:0,within:6,work:[1,6],would:[1,6],x_iai:6,xls:6,xlsx:6,xlxl:6,yalt:6,yes:7,yet:0,you:[1,4,6,7],your:[1,4,6],your_name_her:1,zenodo:7},titles:["Credits","Contributing","History","Welcome to pycirk\u2019s documentation!","Installation","pycirk","pycirk package","pycirk","Usage"],titleterms:{"import":7,analysi:7,bug:1,cli:6,content:6,contribut:1,contributor:0,credit:[0,7],data:7,deploi:1,develop:0,document:[1,3],featur:[1,7],feedback:1,fix:1,from:[4,7],fundamental_oper:6,get:1,guidelin:1,histori:2,implement:1,indic:3,initi:7,instal:[4,7],label:6,lead:0,make_scenario:6,make_secondary_flow:6,modul:[6,7],organize_io:6,packag:[6,7],posit:6,pull:1,pycirk:[3,5,6,7],pycirk_set:6,releas:[4,7],report:1,request:1,result:6,run:7,save:7,save_util:6,scenario:7,set:7,sourc:[4,7],stabl:[4,7],start:1,submit:1,submodul:6,tabl:3,tip:1,transformation_method:6,type:1,usag:[7,8],welcom:3,write:1,xls:7,your:7}}) \ No newline at end of file +Search.setIndex({docnames:["authors","contributing","history","index","installation","modules","pycirk","readme","usage"],envversion:{"sphinx.domains.c":1,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":1,"sphinx.domains.javascript":1,"sphinx.domains.math":2,"sphinx.domains.python":1,"sphinx.domains.rst":1,"sphinx.domains.std":1,"sphinx.ext.viewcode":1,sphinx:56},filenames:["authors.rst","contributing.rst","history.rst","index.rst","installation.rst","modules.rst","pycirk.rst","readme.rst","usage.rst"],objects:{"":{pycirk:[6,0,0,"-"]},"pycirk.fundamental_operations":{Operations:[6,1,1,""]},"pycirk.fundamental_operations.Operations":{IOT:[6,1,1,""],PxP_ITA_MSC:[6,1,1,""],PxP_ITA_TC:[6,1,1,""],calculate_characterized:[6,2,1,""],delta_Y:[6,2,1,""],delta_x:[6,2,1,""],inv:[6,2,1,""],verifyIOT:[6,2,1,""]},"pycirk.fundamental_operations.Operations.IOT":{A:[6,2,1,""],B:[6,2,1,""],IOT:[6,2,1,""],L:[6,2,1,""],R:[6,2,1,""],RY:[6,2,1,""],Z:[6,2,1,""],bY:[6,2,1,""],x:[6,2,1,""],x_IAy:[6,2,1,""]},"pycirk.fundamental_operations.Operations.PxP_ITA_MSC":{A:[6,2,1,""],B:[6,2,1,""],D:[6,2,1,""],L:[6,2,1,""],R:[6,2,1,""],S:[6,2,1,""],Z:[6,2,1,""]},"pycirk.fundamental_operations.Operations.PxP_ITA_TC":{B:[6,2,1,""],L:[6,2,1,""],R:[6,2,1,""],T:[6,2,1,""],Z:[6,2,1,""]},"pycirk.labels":{Labels:[6,1,1,""]},"pycirk.labels.Labels":{apply_labels:[6,2,1,""],calc_no_of_something:[6,2,1,""],get_labels:[6,2,1,""],get_unique_labels:[6,2,1,""],identify_labels:[6,2,1,""],list_of_something:[6,2,1,""],load_labels:[6,2,1,""],organize_unique_labels:[6,2,1,""],relabel:[6,2,1,""],relabel_to_save:[6,2,1,""],save_labels:[6,2,1,""]},"pycirk.make_scenarios":{basic_add:[6,3,1,""],basic_mult:[6,3,1,""],counterfactual:[6,3,1,""],counterfactual_engine:[6,3,1,""],make_counterfactuals:[6,3,1,""],make_new:[6,3,1,""],substitution:[6,3,1,""]},"pycirk.make_secondary_flows":{allocate_sec_mat:[6,3,1,""],make_secondary:[6,3,1,""]},"pycirk.organize_io":{organizer:[6,3,1,""]},"pycirk.positions":{make_coord_array:[6,3,1,""],make_coord_array_for_make_sec:[6,3,1,""],single_position:[6,3,1,""]},"pycirk.pycirk":{Launch:[6,1,1,""]},"pycirk.pycirk.Launch":{all_results:[6,2,1,""],delete_previous_IO_builds:[6,2,1,""],save_results:[6,2,1,""],scenario_results:[6,2,1,""]},"pycirk.pycirk_settings":{Settings:[6,1,1,""]},"pycirk.pycirk_settings.Settings":{check_dataset_location:[6,2,1,""],check_expand_directory:[6,2,1,""],create_output_folder:[6,2,1,""],create_scenario_file:[6,2,1,""],load_dataset:[6,2,1,""],load_results_params:[6,2,1,""],number_scenarios:[6,2,1,""],project_specs:[6,2,1,""],scenario_file:[6,2,1,""],set_IO_scenario:[6,2,1,""],set_SUTs:[6,2,1,""],set_save_directory:[6,2,1,""],transform_to_io:[6,2,1,""]},"pycirk.results":{iter_thru_for_results:[6,3,1,""],retrieve_specified_data:[6,3,1,""],rsd_engine:[6,3,1,""]},"pycirk.save_utils":{add_date_to_gen_specs:[6,3,1,""],save_outputs:[6,3,1,""]},"pycirk.transformation_methods":{Transform:[6,1,1,""]},"pycirk.transformation_methods.Transform":{IOTpxpSTA_MSCm:[6,2,1,""],IOTpxpSTA_TCm:[6,2,1,""]},pycirk:{cli:[6,0,0,"-"],fundamental_operations:[6,0,0,"-"],labels:[6,0,0,"-"],make_scenarios:[6,0,0,"-"],make_secondary_flows:[6,0,0,"-"],organize_io:[6,0,0,"-"],positions:[6,0,0,"-"],pycirk:[6,0,0,"-"],pycirk_settings:[6,0,0,"-"],results:[6,0,0,"-"],save_utils:[6,0,0,"-"],transformation_methods:[6,0,0,"-"]}},objnames:{"0":["py","module","Python module"],"1":["py","class","Python class"],"2":["py","method","Python method"],"3":["py","function","Python function"]},objtypes:{"0":"py:module","1":"py:class","2":"py:method","3":"py:function"},terms:{"case":[6,7],"class":6,"default":[6,7],"final":[6,7],"float":6,"function":[1,6],"import":[3,8],"int":6,"new":[1,6],"public":[4,7],"return":6,"true":[6,7],The:[1,4,6,7],Then:1,These:7,Use:7,Uses:6,_name:6,a_alum:6,a_cmnt:6,a_con:6,a_copp:6,a_gla:6,a_lztp:6,a_onfm:6,a_pla:6,a_prem:6,a_pulp:6,a_stel:6,a_wood:6,about:[1,6],absolut:[6,7],accept:7,accord:6,achiev:[6,7],acillari:6,action:6,add:[1,6],add_date_to_gen_spec:6,added:[6,7],addit:7,affect:[6,7],aggreg:[6,7],all:[1,6,7],all_result:[6,7],allign:6,allocate_sec_mat:6,allow:[6,7],alreadi:6,also:6,alwai:[1,4],among:7,analysi:6,analysis_spec:6,analyt:6,ancillari:7,anew:6,ani:[1,6],anoth:6,anyth:1,appar:6,appear:6,appli:[6,7],applic:6,apply_label:6,appreci:1,arabl:7,arjan:[6,7],arnold:7,arrai:6,articl:1,assum:1,assumpt:6,audreyr:7,auguilar:7,author:6,avail:6,axi:6,balanc:6,base:6,baselin:[6,7],basic:[6,7],basic_add:6,basic_mult:6,befor:1,begin:6,being:6,belong:6,best:1,between:7,biregion:7,bit:1,bitbucket:7,black:7,blog:1,bool:6,both:7,branch:1,bugfix:1,bumpvers:1,c_alum:6,c_cmnt:6,c_con:6,c_copp:6,c_gla:6,c_lztp:6,c_onfm:6,c_pla:6,c_prem:6,c_pulp:[6,7],c_stel:[6,7],c_wood:6,caclcul:6,calc_no_of_someth:6,calcual:6,calcul:6,calculate_character:6,call:6,can:[1,4,6,7],cat_coord:6,cat_d:7,cat_o:7,categori:[6,7],cell:6,certain:6,chain:6,chang:[1,6,7],change_typ:7,check:[1,6],check_dataset_loc:6,check_expand_directori:6,checkout:1,chosen:6,circular:[6,7],cite:7,clariti:6,cli:5,clone:[1,4,7],cml:[0,6,7],co2:7,coal:7,coef:6,coeff:6,coeffici:[6,7],coeffient:6,cointain:6,coke:7,collect:6,colum:6,column:[6,7],column_label:6,com:[1,4,7],combust:7,come:6,command:[4,7],commit:1,compar:7,complet:6,comprehens:7,conceptu:7,concern:6,consid:6,consol:7,contain:6,contan:6,content:[3,5],continu:7,contribut:3,contributor:[3,6],cookiecutt:7,coordin:[6,7],copi:[1,4,6,7],could:1,count:6,counterfactu:6,counterfactual_engin:6,countri:6,creat:[1,6,7],create_output_fold:6,create_scenario_fil:6,creation:7,credit:[1,3],curl:4,data:6,data_validation_list:7,databas:[6,7],datafram:6,dataframe_of_label:6,dataset:6,defin:6,delete_previous_io_build:6,delft:6,delta_i:6,delta_x:6,demand:[6,7],depend:6,deploi:3,descript:[1,6],desir:6,destin:[6,7],detail:1,develop:[1,3],dia:7,diag:6,diag_q:6,diag_x:6,diag_yj:6,dict:6,dictionari:6,differ:[6,7],diplai:6,directori:[6,7],distribut:6,divid:6,doc:1,docstr:1,document:7,doi:7,domest:7,don:[4,6],donati:[0,6],done:[1,6],download:[4,7],driven:1,e_co2_c:7,e_hrh:7,each:6,easier:1,economi:[6,7],eeio:6,eeioa:6,effect:[6,7],effici:7,either:4,element:6,elimin:6,elin:6,emiss:[6,7],employ:7,enhanc:1,ensur:6,enter:6,entri:[1,6],environment:7,equal:6,essenti:6,etc:[6,7],even:1,everi:1,everyth:6,exampl:7,excel:6,exiobas:7,exist:6,exit:7,expan:6,expand:6,expans:6,explain:1,extend:7,extens:[6,7],extent:7,f_gove:7,f_hou:7,factor:7,fals:[6,7],fdonati:[1,4,7],fdonaticml:7,featur:3,feb:6,file:[1,6,7],filter:6,filterd_chang:6,filtered_chang:6,find:6,first:[0,2],flake8:1,flow:6,folder:6,follow:7,for_unit:6,fork:1,form:6,format:6,found:6,franco:[0,6],fri:6,from:[3,6],fundament:6,fundamental_oper:5,furthemor:7,futur:6,fx_kp:6,gather:6,gener:6,get:3,get_label:6,get_unique_label:6,git:[1,4,7],github:[1,4],given:[1,6],glenn:7,good:6,govern:7,greatli:1,guid:4,guidelin:3,handl:6,have:[1,4,6,7],help:[1,7],here:[1,6],hernandez:7,highli:7,histori:[1,3],home:7,household:7,how:[1,7],html:7,http:[1,4,7],ide:6,identif:6,identifi:6,identify_label:6,impact:7,implement:6,includ:1,ind:6,ind_or:6,index:[3,6],index_label:6,industri:6,inf:6,info:6,info_and_result:6,inform:6,initi:6,input:[6,7],insid:7,instal:[1,3,6],instead:6,institut:6,integ:6,intemedi:6,intens:6,inter_coef:6,inter_set:6,interest:7,intermedi:[6,7],intervent:[6,7],inv:6,inv_diag_g:6,inv_diag_q:6,inv_diag_x:6,inv_diag_yj:6,invers:6,iot:[6,7],iotpxpsta_mscm:6,iotpxpsta_tcm:6,iron:7,issu:1,ita:6,ita_msc:7,ita_tc:7,item:6,iter_thru_for_result:6,jan:6,joao:7,jul:6,just:[1,6],keep:1,knowledg:7,kone:[6,7],l_1:7,label:5,labels_directori:6,lalt:6,land:7,latest:7,launch:[6,7],lead:3,left:7,leiden:6,leidenuniv:0,leontief:6,less:7,level:[6,7],lib:7,life:7,line:7,link:7,list:[1,6,7],list_of_someth:6,littl:1,load:6,load_dataset:6,load_label:6,load_results_param:6,loc:6,local:[1,7],locat:6,look:[1,6],m_name:6,mai:6,main:6,maintain:1,major:1,make:[1,6],make_coord_arrai:6,make_coord_array_for_make_sec:6,make_counterfactu:6,make_new:6,make_scenario:5,make_secondari:6,make_secondary_flow:5,mani:1,mar:6,mark:6,market:[6,7],master:4,materi:[6,7],matric:[6,7],matrix:[6,7],max:[6,7],mean:7,meet:1,messag:7,method:[4,6,7],might:1,minor:1,miss:6,mkvirtualenv:1,model:[6,7],modifi:6,modul:[3,5],mofifi:6,mon:6,more:1,most:4,move:6,msc:7,much:7,multi:6,multiindex:6,multipl:6,multipli:6,multiregion:7,munch:6,my_work:7,name:[1,6],nan:6,narrow:1,natur:7,necessari:6,need:7,neg:7,no_categori:6,no_countri:6,nomenclatur:6,none:[0,6,7],note:6,nov:6,now:[1,6],number:6,number_scenario:6,numer:6,numpi:6,obj:6,object:6,obtain:6,oepbzjqgdicsan1:7,offici:1,onc:[4,6,7],one:[6,7],onli:[6,7],onto:6,open:[1,7],oper:[1,6],option:7,order:6,org:[1,7],organ:6,organize_io:5,organize_unique_label:6,origin:[1,6,7],other:[1,6],otherwis:6,ouput:6,output:[6,7],output_datas:6,output_dataset:[6,7],packag:[3,5],page:3,panda:6,paramet:[6,7],part:[1,6],pass:[1,6],past:6,patch:1,penet:6,penetr:[6,7],perform:[6,7],physic:7,pickl:6,pip:[1,4,7],pkl:6,place:[6,7],pleas:[1,6,7],plu:6,point:[6,7],polici:[6,7],pos:6,posit:5,possibl:[1,6,7],post:1,pre:6,prefer:4,presenc:6,present:6,pretti:6,previou:6,previous:6,price:7,primari:[6,7],proccess:6,process:[4,6],prod:6,prod_or:6,product:[6,7],prodxprod:6,programm:6,project:[1,6,7,8],project_spec:6,properti:7,propos:1,proxi:7,pull:3,pull_request:1,pulp:7,push:1,put:[1,6],pxp:[6,7],pxp_ita_msc:6,pxp_ita_tc:6,pycirk:[1,4,8],pycirk_set:5,pypackag:7,pypi:[1,2],python3:7,python:[1,4,7],rang:6,read:6,readi:1,readm:[1,7],readthedoc:7,rebound:[6,7],recent:4,recycl:7,reduct:7,refactor:6,refer:6,reg_coord:6,reg_d:7,reg_o:7,region:[6,7],rel:6,relabel:6,relabel_to_sav:6,releas:[2,3],rememb:1,remind:1,renam:6,repeat:6,repo:[1,4],repositori:[4,7],reproduc:1,request:3,requir:[6,7],resconrec:7,research:7,resourc:7,result:[5,7],retriev:6,retrieve_specified_data:6,rice:7,right:6,rodriguez:7,row:[6,7],rsd_engin:6,rst:1,run:[1,4,6],same:6,sat:6,save:6,save_directori:6,save_label:6,save_output:6,save_result:[6,7],save_util:5,scen_fil:6,scen_no:[6,7],scenario:6,scenario_1:6,scenario_fil:6,scenario_result:[6,7],scope:[1,6],scrap:6,script:7,search:3,secondari:6,sector:6,see:7,select:6,send:1,separ:6,seri:6,set:[1,6],set_io_scenario:6,set_save_directori:6,set_sut:6,setup:[1,4,7],shape:6,share:[6,7],sheet:[6,7],sheet_nam:6,should:[1,6,7],show:7,simpl:6,simul:7,singl:6,single_posit:6,site:7,size:6,skill:7,softwar:7,solut:6,some:6,sourc:[3,6],spead:6,spec:6,spec_row:6,specfic:6,speci:6,specif:[6,7],specifi:[6,7],stabl:3,stackstorag:7,start:[3,7],step:[1,7],store:6,str:6,studi:7,sub:6,subclass:6,subject:6,submodul:5,subset:1,subsidi:7,subsitut:6,substituion:7,substitut:[6,7],sum:6,supervis:7,suppli:6,support:[1,7],sure:[1,6],sut:[6,7],sutop:6,swk:7,system:[1,6],t_tlsa:7,tabl:[6,7],tag:1,take:6,tarbal:4,tax:7,tech:6,technic:[6,7],technolog:[6,7],tell:7,templat:7,termin:[4,7],test:[1,6,7],test_pycirk:1,text:7,thank:7,thei:[1,6],them:[1,6],thi:[1,4,6,7],through:[1,4,7],time:6,timemark:6,tip:3,togeth:6,top:6,tot:6,total:[6,7],tox:1,tpm:6,trans_method:6,transact:[6,7],transat:7,transf_method:7,transform:6,transform_to_io:6,transformation_method:5,trasform:6,travi:1,troubleshoot:1,tue:6,tukker:7,two:6,type:[3,6,7],under:6,understand:6,uniqu:6,unit:[6,7],univers:6,updat:1,usag:3,use:[1,6,7,8],used:[6,7],useful:7,user:6,usernam:7,uses:6,using:6,valu:[6,7],variabl:7,variou:6,verifi:6,verifyiot:6,version:1,virtualenv:1,virtualenvwrapp:1,volunt:1,wai:[1,6],want:[1,6],web:1,websit:1,wed:6,weigh:7,welcom:1,what:6,when:[1,6],where:6,whether:[1,6,7],which:[6,7],whoever:1,why:0,within:6,work:[1,6],would:[1,6],x_iai:6,xls:6,xlsx:6,xlxl:6,yalt:6,yes:7,yet:0,you:[1,4,6,7],your:[1,4,6],your_name_her:1,zenodo:7},titles:["Credits","Contributing","History","Welcome to pycirk\u2019s documentation!","Installation","pycirk","pycirk package","pycirk","Usage"],titleterms:{"import":7,analysi:7,bug:1,cli:6,content:6,contribut:1,contributor:0,credit:[0,7],data:7,deploi:1,develop:0,document:[1,3],featur:[1,7],feedback:1,fix:1,from:[4,7],fundamental_oper:6,get:1,guidelin:1,histori:2,implement:1,indic:3,initi:7,instal:[4,7],label:6,lead:0,make_scenario:6,make_secondary_flow:6,modul:[6,7],organize_io:6,packag:[6,7],posit:6,pull:1,pycirk:[3,5,6,7],pycirk_set:6,releas:[4,7],report:1,request:1,result:6,run:7,save:7,save_util:6,scenario:7,set:7,sourc:[4,7],stabl:[4,7],start:1,submit:1,submodul:6,tabl:3,tip:1,transformation_method:6,type:1,usag:[7,8],welcom:3,write:1,xls:7,your:7}}) \ No newline at end of file diff --git a/docs/_build/html/usage.html b/docs/_build/html/usage.html index b27e54d..3342033 100644 --- a/docs/_build/html/usage.html +++ b/docs/_build/html/usage.html @@ -1,11 +1,9 @@ - + - - + Usage — pycirk 1.5.0 documentation @@ -13,6 +11,7 @@ + @@ -79,13 +78,11 @@

    Related Topics

    @@ -106,7 +103,7 @@

    Quick search

    ©2019, Franco Donati. | - Powered by Sphinx 1.8.2 + Powered by Sphinx 2.2.0 & Alabaster 0.7.12 | diff --git a/docs/pycirk.rst b/docs/pycirk.rst index 3262eb4..4258a86 100644 --- a/docs/pycirk.rst +++ b/docs/pycirk.rst @@ -8,103 +8,103 @@ pycirk.cli module ----------------- .. automodule:: pycirk.cli - :members: - :undoc-members: - :show-inheritance: + :members: + :undoc-members: + :show-inheritance: pycirk.fundamental\_operations module ------------------------------------- .. automodule:: pycirk.fundamental_operations - :members: - :undoc-members: - :show-inheritance: + :members: + :undoc-members: + :show-inheritance: pycirk.labels module -------------------- .. automodule:: pycirk.labels - :members: - :undoc-members: - :show-inheritance: + :members: + :undoc-members: + :show-inheritance: pycirk.make\_scenarios module ----------------------------- .. automodule:: pycirk.make_scenarios - :members: - :undoc-members: - :show-inheritance: + :members: + :undoc-members: + :show-inheritance: pycirk.make\_secondary\_flows module ------------------------------------ .. automodule:: pycirk.make_secondary_flows - :members: - :undoc-members: - :show-inheritance: + :members: + :undoc-members: + :show-inheritance: pycirk.organize\_io module -------------------------- .. automodule:: pycirk.organize_io - :members: - :undoc-members: - :show-inheritance: + :members: + :undoc-members: + :show-inheritance: pycirk.positions module ----------------------- .. automodule:: pycirk.positions - :members: - :undoc-members: - :show-inheritance: + :members: + :undoc-members: + :show-inheritance: pycirk.pycirk module -------------------- .. automodule:: pycirk.pycirk - :members: - :undoc-members: - :show-inheritance: + :members: + :undoc-members: + :show-inheritance: pycirk.pycirk\_settings module ------------------------------ .. automodule:: pycirk.pycirk_settings - :members: - :undoc-members: - :show-inheritance: + :members: + :undoc-members: + :show-inheritance: pycirk.results module --------------------- .. automodule:: pycirk.results - :members: - :undoc-members: - :show-inheritance: + :members: + :undoc-members: + :show-inheritance: pycirk.save\_utils module ------------------------- .. automodule:: pycirk.save_utils - :members: - :undoc-members: - :show-inheritance: + :members: + :undoc-members: + :show-inheritance: pycirk.transformation\_methods module ------------------------------------- .. automodule:: pycirk.transformation_methods - :members: - :undoc-members: - :show-inheritance: + :members: + :undoc-members: + :show-inheritance: Module contents --------------- .. automodule:: pycirk - :members: - :undoc-members: - :show-inheritance: + :members: + :undoc-members: + :show-inheritance: diff --git a/pycirk/__init__.py b/pycirk/__init__.py index 7c98474..ce62d6d 100644 --- a/pycirk/__init__.py +++ b/pycirk/__init__.py @@ -4,6 +4,6 @@ __author__ = """Franco Donati""" __email__ = 'f.donati@cml.leidenuniv.nl' -__version__ = '1.5.0' +__version__ = '1.5.5' from pycirk.pycirk import Launch \ No newline at end of file diff --git a/setup.cfg b/setup.cfg index ba2f433..d7e8652 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 1.5.0 +current_version = 1.5.5 commit = True tag = True