Open goraj opened 5 years ago
All the "static" information of a stimulus (i.e., everything that can be passed as a kw argument and does not have to be interpolated) get logged into the "log" field of the json experiment metadata. For such quantities, which remain constant for each stimulus object, you don't need a column in the dataframe. After running your script, open the json file as a dictionary, and look into the stimulus/log field:
import json
with open(r"C:\Users\lpetrucco\Desktop\gratings_protocol\190628_f0\134825_metadata.json", "r") as f:
metadata_dict = json.load(f)
metadata_dict["stimulus"]["log"]
This will be a list containing all the static attributes of you stimuli sequence. After running your script, I have a 3 elements list, each element being a dictionary with a "color" field containing the value that you passed to the stimulus class as the "grating_col_1" argument (I only now notice this naming inconsistency, that the "grating_col_1" argument is actually passed as the "color" field in the stimulus. we will maybe fix this in the future).
Note that in your code the df is not doing anything to the stimulus color, and the code is working only because you are passing it as a static argument. For the dataframe to effectively act on the stimulus properties, its columns need to be named exactly as the stimulus property that should be changing, in this case "color" instead of "stimulus_color".
Sorry if things were not clear - we will add soon a more detailed section in the documentation!
Indeed the class attributes are not consistent with the passed kwargs in some cases, ie. direction/angle ends up as theta. This was a little bit confusing. Thank you for clearing that up!
I'll reopen this issue as we need to make the stimulus construction and documentation more consistent.
Hi,
I would like to log additional information for an experiment. A good example would be the stimulus color and direction that is presented to the fish.
I tried adding two dynamic columns to dynamic_parameters in my stimulus class, that way I can use these columns to store some information as float in df_param.
Unfortunately this does not seem to work correctly and it seems not very clean to me as it ends up in np.interp. It would be great if you could suggest the best way to log information/conditions like this.
I attached a small example that tries to log color and direction using the df_param.