LoginSignup
1
0

More than 5 years have passed since last update.

SDAPSで塗りつぶしたチェックも数えたい

Last updated at Posted at 2018-03-24

きっかけ

SDAPSで質問票を作成して、160人ぐらいから回収したところ、(おそらく)チェックのつもりで塗りつぶされたシートが1/3ぐらいありました。

そこで、この塗りつぶされたチェックも、修正ではなく、回答として扱って、レポートを出力させてみました。

対応策

あらかじめ修正機能のない質問票を作成する

TeXで質問票を作成する時に、文書クラスのオプションで、a4paper,などの指定と同時にcheckmode=check,などと指定することで、「塗りつぶすと訂正」という動きを「塗りつぶしもチェックとして扱う」、「塗りつぶしのみカウントする」などのように変更することができます。

質問票を回収した後に挙動を変更する。

残念ながら、回収後にこの挙動を変更する方法は想定されていないようだったので、プログラムに手を加えてみました。

.../sdaps/recognize/buddies.py
--- /usr/lib/python2.7/dist-packages/sdaps/recognize/buddies.py.20180320        2018-03-20 21:51:44.634608043 +0900
+++ /usr/lib/python2.7/dist-packages/sdaps/recognize/buddies.py 2018-03-20 21:51:34.702608231 +0900
@@ -687,6 +687,7 @@
         quality = -1
         # Iterate the ranges
         for metric, value in self.obj.data.metrics.iteritems():
+            self.obj.sheet.survey.defs.checkmode = 'check'
             metric = defs.checkbox_metrics[self.obj.sheet.survey.defs.checkmode][metric]

             for lower, upper in zip(metric[:-1], metric[1:]):

強引にオプションをcheckcorrectからcheckに変更する方法

ちなみに、checkmodeの指定は次のようなコードでsurveyファイルに保存されていますので、後から変更するプログラムを作成することは比較的容易と思われます。

.../model/survey.py
def save(self):
    import ConfigParser
    file = bz2.BZ2File(os.path.join(self.survey_dir, '.survey.tmp'), 'w')
    cPickle.dump(self, file, 2)
    file.close()
    # ...
    os.rename(os.path.join(self.survey_dir, '.survey.tmp'), os.path.join(self.survey_dir, 'survey'))

修正機能のないシート生成時の考慮点

確認のため、シートの再生成も試してみましたが、単純にcheckmode=checkとするだけでは、コンパイルに失敗します。example.texから、checkmode=checkを指定してコンパイル可能にしたファイルは以下のようになりました。

.../example/example.tex
$ diff -u example.tex example_check_noinfo.tex
--- example.tex 2017-07-17 06:46:44.000000000 +0900
+++ example_check_noinfo.tex    2018-03-22 10:02:49.542978093 +0900
@@ -20,7 +20,7 @@
   % With SDAPS 1.1.6 and newer you can choose the mode used when recognizing
   % checkboxes. valid modes are "checkcorrect" (default), "check" and
   % "fill".
-  %checkmode=checkcorrect,
+  checkmode=check,
   %
   % The following options make sense so that we can get a better feel for the
   % final look.
@@ -30,6 +30,12 @@
 % For demonstration purposes
 \usepackage{multicol}

+\usepackage{xltxtra}
+\setmainfont{IPAPMincho}
+\setsansfont{IPAPGothic}
+\setmonofont{IPAGothic}
+\XeTeXlinebreaklocale "ja"
+
 \author{The Author}
 \title{The Title}

@@ -38,7 +44,7 @@

   % If you don't like the default text at the beginning of each questionnaire
   % you can remove it with the optional [noinfo] parameter for the environment
-  \begin{questionnaire}
+  \begin{questionnaire}[noinfo]
     % There is a predefined "info" style to hilight some text.
     \begin{info}
       Some information here. Nothing special, just adds a line above/below.

途中のsetfontなどはXeTeXを使用しているために必要な部分です。

これでシートを再生成した場合、survey-idなどを含めて体裁が変更されるため、改めて質問票を配布して回答を集める必要があると思われますが、テストしていません。

また2箇所にチェックをつけている場合には、レポートの平均、標準偏差などのデータには使用されませんが、CSVファイル上では"-2"が出力されます。無回答のデータは"-1"となります。データを母集団から除く場合の条件には、"-1"だけでなく、負数全体を含めないといけないのかなと思われます。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0